SRS Labs Robotics SRS Robot Level 1 Kit User Manual

SRS Robot Level 1 Kit  
Table of Contents  
Getting Started ................................................................................................................... 2  
Computer Requirements..................................................................................................... 2  
Recommended Equipment ................................................................................................. 2  
Kit Contents ....................................................................................................................... 3  
AVR Robot Controller 1.1 Assembly Instructions............................................................. 5  
AVR Robot Controller 1.1 Software Tools...................................................................... 10  
Chassis Assembly............................................................................................................. 14  
Wiring Connections ......................................................................................................... 18  
ATmega16 Programming................................................................................................. 19  
Sample Programs ............................................................................................................. 27  
AVR Robot Controller 1.1 Hardware Description........................................................... 31  
AVR Robot Controller 1.1 Schematic.............................................................................. 34  
The content of this document is © 2004-2005 Cathy Saxton and Larry Barello.  
11-3-2005  
1
Download from Www.Somanuals.com. All Manuals Search And Download.  
Kit Contents  
Kit Contents  
Level 1 Kit  
Anti-Static Bag  
Item  
Qty Vendor  
Part  
Fairchild QRB1134 light sensor  
ARC 1.1 PCB  
ATMEGA16-16PC microcontroller  
TI 754410 H-bridge  
2
1
1
1
1
1
1
1
1
3
8
1
3
3
2
2
3
Digi-Key  
Barello.net  
Digi-Key  
QRB1134  
ARC-01  
ATMEGA16-16PC-ND  
296-9911-5-ND  
SP232ACP  
LM2940CT-5.0  
X908-ND  
160-1708  
160-1710  
P11196-ND  
P4924-ND  
1N4001GCT-ND  
180EBK-ND  
330EBK-ND  
680EBK-ND  
1.0KEBK-ND  
4.7KEBK-ND  
Digi-Key  
RS232 driver  
Future Electronics  
Future Electronics  
Digi-Key  
Digi-Key  
Digi-Key  
Digi-Key  
Digi-Key  
Digi-Key  
Digi-Key  
Digi-Key  
Digi-Key  
Digi-Key  
Digi-Key  
LM2940CT-5.0 voltage regulator  
ZTT-16.0MX ceramic resonator  
red LED  
green LED  
47 uf 16v electrolytic capacitor  
.1 uf ceramic Z7T .1" capacitor  
diode, 1A  
180 ohm 1/8 W resistor (brown-gray-brown)  
330 ohm 1/8 W resistor (orange-orange-brown)  
680 ohm 1/8 W resistor (blue-gray-brown)  
1k ohm 1/8 W resistor (brown-black-red)  
4.7k ohm 1/8 W resistor (yellow-violet-red)  
Electro-Mechanical Bag  
Item  
Qty Vendor  
Part  
40 pin DIP socket  
16 pin DIP socket  
1
2
1
1
2
2
3
3
2
1
1
2
7
1
1
2
1
1
2
Jameco  
Jameco  
Jameco  
Jameco  
Jameco  
Samtec  
Samtec  
Jameco  
Jameco  
Jameco  
Jameco  
Jameco  
112310  
112221  
15114  
15771  
DB25 solder cup male  
DB9 solder cup female  
10-contact IDC socket connector  
1x3 .1" boardmount socket  
1x4 .1" boardmount socket  
1x3 .1" male header  
32491  
SSW-103-01-T-S  
SSW-104-01-T-S  
103341  
115035  
67820  
203932  
157382  
100765  
EG1903-ND  
S9002-ND  
FP332K-R50-ND  
126543  
2x3 .1" male header  
2x5 .1" male header  
2x5 .1" right angle male header  
1x3 .1" connector housing  
female crimp pin  
switch, SPDT, PCB mount  
.1" shorting jumper  
shrink tubing, 3/32" x 1/2"  
cable tie  
velcro, 1/2" x 2" loop, adhesive-back  
mounting square (double-stick square)  
Jameco  
Digi-Key  
Digi-Key  
Digi-Key  
Jameco  
McMaster-Carr  
Make An Impression  
9273K173  
Hardware Bag  
Item  
Qty Vendor  
Part  
6-32 x 1.5" standoff (F-F 1/4" OD)  
4-40 x 1" standoff (F-F 1/4" OD)  
4-40 x 1/2" standoff (F-F 3/16" OD)  
4-40 x 1/4" round standoff (F-F 1/4" OD)  
6-32 x 3/8" machine screw  
4-40 x 1" machine screw  
4-40 x 1/2" machine screw  
4-40 x 1/4" machine screw  
3
4
4
2
6
1
4
18  
McMaster-Carr  
McMaster-Carr  
Digi-Key  
91780A337  
91780A167  
1893K  
Digi-Key  
3478K  
McMaster-Carr  
McMaster-Carr  
Digi-Key  
90272A146  
90272A115  
H346  
McMaster-Carr  
90272A106  
11-3-2005  
3
Download from Www.Somanuals.com. All Manuals Search And Download.  
Kit Contents  
2-56 x 1" machine screw  
small wood screw (in motor if not here)  
4-40 nut  
2-56 nut  
#4 flat washer  
4
2
5
4
8
2
8
McMaster-Carr  
91772A086  
McMaster-Carr  
McMaster-Carr  
McMaster-Carr  
McMaster-Carr  
McMaster-Carr  
90480A005  
90480A003  
92141A005  
91113A005  
91113A003  
#4 lock washer  
#2 lock washer  
Loose  
Item  
Qty Vendor  
Part  
chassis  
Solarbotics GM8 motor  
wheel  
rubber band (for wheel)  
Tamiya ball caster (pair)  
battery holder  
velcro, 1/2" x 16" strap  
4-conductor cable, 3'  
10-conductor ribbon cable, 3'  
servo cable  
1
2
2
4
1
1
1
1
1
2
2
Pololu  
Solarbotics  
GM8PW  
Pololu  
Jameco  
McMaster-Carr  
Jameco  
Jameco  
0066  
216215  
94905K33  
31860  
135538  
Barello.net  
McMaster-Carr  
insulated copper wire, 7"  
8073K64  
ARC Board Connection Kit  
This optional add-on kit provides parts to terminate sensor wires and align them in housings for easy connection to  
the board sockets. The default kit has wires tinned and inserted directly into the sockets.  
Item  
Qty Vendor Part  
1x3 .1" pin housing  
1x4 .1" pin housing  
male crimp pin  
2
3
20  
Jameco 157382  
Jameco 100802  
Jameco 145357  
Vendor Information  
Digi-Key  
Jameco  
Barello.net  
McMaster-Carr  
Pololu  
Solarbotics  
Samtec  
Future Electronics  
Mark III Robot Store  
Make An Impression  
B.G. Micro  
All Electronics  
4
11-3-2005  
Download from Www.Somanuals.com. All Manuals Search And Download.  
AVR Robot Controller 1.1 Assembly Instructions  
AVR Robot Controller 1.1 Assembly Instructions  
Preparation  
Identify the parts used in the AVR Robot Controller (ARC).  
Refer to the Kit Contents section for a list of parts in each  
bag.  
Anti-Static Bag: everything except the QRB1134 light  
sensors.  
Electro-Mechanical Bag: everything except the velcro,  
mounting squares, shrink tubing, and rubber bands.  
Loose items: the battery holder, 4-conductor cable, and  
ribbon cable.  
It is recommended that you return unused items to their  
original locations so that you can find them later!  
Soldering Overview  
The ARC can be assembled using a fine tip 25-40wt  
soldering iron, thin 60:40 rosin core solder, flush side  
cutters and a pair of small needle nose pliers. Additional  
items that are useful are a solder tip cleaner (damp sponge  
or cloth), paste solder flux and a small gauge wire stripper  
(18-26). Because it is fairly small you need a well-lighted  
area to work in. A magnifying glass might be useful for  
inspecting solder joints.  
The side cutters are used to trim component leads flush to the board after soldering them. With a little practice the  
side cutters can be used to strip wire as well: the trick is to cut into the insulation, but not the wire, and then pull the  
end off.  
The key to obtaining a good solder joint is to get everything hot enough so that the solder “wets” the surface and  
wicks into the spaces between the wire and what you are soldering it to. First clean the iron tip by wiping it across a  
damp sponge. Then tin the tip with a bit of fresh solder. Then place the tip against the pin and the solder pad, i.e.  
wedging it in the corner of the two. Then touch the solder to the pin or the board near to the tip. Usually it takes just  
a fraction of a second to get the joint hot enough to melt the solder. Then leave the tip on the joint for a couple  
seconds more until the solder visibly wicks into the hole. If the hole looks empty you can put another touch of solder  
on. When done, snip the excess lead material off flush to the bottom of the board. Usually cleaning and tinning the  
tip is needed only between rounds of soldering or after soldering 20-30 joints in a row.  
You need a workspace as well. The ARC uses static-sensitive components and you need to exercise care while  
assembling it. The best is an anti-static mat with a wrist strap and grounding it to the same ground as the soldering  
iron uses. An alternative is to work on a bare wooden surface. Wood neither conducts nor accumulates static  
electricity. Sometimes you can obtain a sheet of conductive foam and work on that. Keep it grounded through a  
large resistor (e.g.1-2 meg ohms) and make sure some exposed skin touches the surface before you pick up static  
sensitive parts (anything that looks like an IC). Once the board is assembled and the IC’s inserted, it is much less  
sensitive to static discharge.  
11-3-2005  
5
Download from Www.Somanuals.com. All Manuals Search And Download.  
AVR Robot Controller 1.1 Assembly Instructions  
Prepare Boards  
The PCB comes with a serial adapter and a programming adapter that need to be detached. First break the long line  
of holes. You might find it easier to break if you run a razor knife along the top and bottom of the line of holes. Then  
snap the two smaller boards apart. Finally, if you want, you can sand or file the rough edges smooth.  
Controller  
The control board has been designed with oversized holes to facilitate hand assembly and disassembly. The problem  
is that components will fall out when the board is turned upside down. If you assemble from shortest to tallest  
components, then it is possible to load several parts onto the board, cover it with a piece of conductive foam or  
cardboard and turn it over. Still, parts will tilt and move about. The trick is to solder one pin of each part into place,  
turn the board over and re-position the parts by re-heating the soldered pin while pushing on the other side with your  
finger. When all the parts are positioned to your satisfaction, then turn the board back over and finish soldering the  
rest of the pins.  
The picture on the right shows the completed ARC board for the SRS Level 1 Robot Kit. The “front” of the board is  
at the top of the picture. This refers to how the board will be mounted on the robot, and is used to describe locations  
in the instructions below.  
Solder Components  
Part locations are labeled on the board, but some labels are incomplete due to solder pad location, and some parts  
have changed. Please read the instructions to ensure that parts are installed correctly.  
The following list is in order of shortest to tallest component. All the components in each section can be soldered at  
one time, or each component can be soldered in separately.  
Resistors and diode  
The picture on the right shows the locations for:  
ƒ 3 - 180 ohm resistors (brown-gray-brown)  
ƒ 3 - 4.7k ohm resistors (yellow-violet-red)  
ƒ 2 - 1k ohm resistors (brown-black-red)  
ƒ 2 - 680 ohm resistors (blue-gray-brown)  
ƒ 1 - diode  
Important: Note the locations for the 180 and 4.7k resistors at  
the top of the picture. They are installed in locations marked 680  
and 33k, respectively. (R3 and R8 remain 680 ohms, as shown at  
the bottom of the picture.) These resistors are selected to work  
well with the Fairchild QRB1134 phototransistors (light sensors)  
in the kit. For more information, read the section titled “Left,  
Center, and Right Floor Sensor Inputs.”  
Orientation of the resistors is not important. Resistors do not  
have “polarity,” so it does not matter which end goes into each  
hole on the board.  
The diode is inserted with the band toward the end of the arrow  
on the board. If you know what you are doing and want  
maximum power you may omit the diode, replacing it with a short piece of wire. This will remove the reverse  
battery protection that prevents destruction of the H-Bridge chip and/or attached servos. The voltage regulator  
protects the rest of the board from battery reversal.  
6
11-3-2005  
Download from Www.Somanuals.com. All Manuals Search And Download.  
AVR Robot Controller 1.1 Assembly Instructions  
Small capacitors and LEDs  
The picture on the right shows the locations for:  
ƒ 8 - 0.1uF capacitors  
ƒ 1 - red LED  
ƒ 1 - green LED  
Orientation of the small capacitors is not important.  
Note that one of the capacitors (second from the top) will be  
under the microcontroller. Be sure that it sticks up no higher  
than the DIP socket (to be installed in the next step). You may  
need to bend the capacitor’s leads a bit to get it to sit close  
enough to the board. Another option is to mount the capacitor  
“lying down” by gently putting right angle bends into the leads  
before inserting them into the board.  
The red LED is power and the green LED is program. The LEDs  
have a flat side that is oriented toward the near edge of the board  
(the edge at the bottom of the picture). There is a long and a  
short lead; the short lead should be near the edge of the board  
and the longer lead toward the center of the board.  
DIP sockets and voltage regulator  
In this step you will install:  
ƒ 1 - 40-pin DIP socket  
ƒ 2 - 16-pin DIP sockets  
ƒ 1 - LM2940 voltage regulator  
All ICs can be mounted directly on the board. However, if you are a beginner or an experimenter, you probably  
should use the DIP sockets so the ICs are easy to replace. Make sure the notch on the bottom of the socket  
matches the notch in the markings on the board (on the left side in the photos).  
If you want to maximize the power handling capabilities of the 754410 H-bridge,  
you must solder that chip directly onto the board. The ground plane of the board  
provides the heat sink needed for maximum power output. This is not  
recommended for beginners.  
Bend the leads of the voltage regulator half-way through the fat part, near the body  
of the IC, as shown in the picture on the right. This will align the mounting hole  
over the hole in the PCB and the IC should lie flat when soldered in. (Board  
location is shown in the picture in the next section.)  
Switch and resonator  
In this step you will install:  
ƒ 1 - switch  
ƒ 1 - ZTT-16.0 resonator  
Install in the locations identified in the picture on the right (which shows the  
lower right corner for the board). Orientation is not important for the switch or  
resonator. The resonator is optional. The ATmega16 has an internal 1, 2, 4, or 8  
MHz oscillator. In addition, it can operate with an external source of up to  
16MHz, which this resonator provides.  
11-3-2005  
7
Download from Www.Somanuals.com. All Manuals Search And Download.  
AVR Robot Controller 1.1 Assembly Instructions  
Sockets, headers, and jumper  
The picture on the right shows the locations for:  
ƒ 2 - 1x3 boardmount sockets  
ƒ 3 - 1x4 boardmount sockets  
ƒ 3 - 1x3 male headers  
ƒ 2 - 2x3 male headers  
ƒ 1 - 2x5 male header  
ƒ 1 - shorting jumper  
Install the sockets along on the front of the board (as shown at  
the top of the picture). The headers should be installed with the  
shorter end of the pins inserted into the board. Install the 1x3 pin  
headers in the locations marked JP5 (serial communications),  
JP13 (power), and “servo.” Install the 2x3 pin headers (motors)  
at the back of the board, in the locations marked LEFT and  
RIGHT. Install the 2x5 pin header (programming) in the location  
marked JP9.  
Install the shorting jumper on the “servo” header. The picture on  
the right shows the jumper positioned to select “Bat.” The other  
option is “5V.” Either setting is fine for Level 1. Please see “Left  
and Right Motor Connectors” in the ARC 1.1 Hardware Description section for details.  
Large capacitors  
In this step you will install:  
ƒ 3 - 47uF capacitors  
Pay attention to the orientation of these devices. The longer lead goes into the hole marked with a ‘+’. The gold  
bar on the side of the capacitor should be on the side marked with a ‘-’ sign.  
Cleaning and Inspection  
After all components are installed, inspect the bottom of the board with a magnifying glass. Look at each solder pad  
and make sure that the solder is shiny and has a “wet” look. Reheating and applying a touch of solder can rework  
pads that are incompletely filled with solder or look gray and dull.  
Look for solder bridges between pads or pins that are close together. If you used a fine tip iron and no more solder  
than needed for a good joint, you shouldn’t have any bridges.  
You can clean the flux (from the solder) from the board with denatured ethanol (alcohol). Use an old toothbrush to  
scrub all the pads with the alcohol.  
Attach Connector to Battery Holder  
For this step, you will need:  
ƒ 1 - battery holder  
ƒ 2 - female crimp pins  
ƒ 1 - 1x3 connector housing  
The ends of the battery holder’s wires are already stripped and tinned. Place one  
wire into the “trough” of a female crimp pin, with the insulation just barely  
reaching into the area between the two triangles. Using needle-nose pliers, fold  
over one triangle to hold the wire in place for soldering (as shown in the picture  
on the right). Apply a small amount of solder between the bare wire and pin, then crimp the pin closed using needle-  
nose pliers or a specially-designed crimp tool. Repeat with the other wire.  
Insert the crimp pins into the housing with the flat part of the pin against the  
flat part of the connector. The black wire must go into the middle location of  
the housing; the red wire can go on either side.  
8
11-3-2005  
Download from Www.Somanuals.com. All Manuals Search And Download.  
AVR Robot Controller 1.1 Assembly Instructions  
Install Chips  
Be sure to inspect the board before applying power. Connect the battery pack to the 3-pin header next to the switch  
(JP13). With the switch in the on position (toward the near edge of the board) the red power LED should light.  
Now you can install the various chips. (Turn off power to the board first.) All chips are installed with the notch (pin  
1) oriented away from the switch and voltage regulator (the notch is on the left side in the photos above). The RS232  
driver is installed in the location closer to the ATmega16; the 754410 H-bridge is near the 2x3 headers.  
Serial Cable  
The kit includes materials to make a serial interface cable that can be used to connect the ARC board to your PC.  
This is useful when debugging your programs as it allows the program to tell you what is going on.  
For this step, you will need:  
ƒ 1 - serial adapter PCB (the one with “Gnd Tx Rx” labeling)  
ƒ 1 - DB9 solder cup  
ƒ 3’ - 4-conductor cable  
ƒ 3 - female crimp pins  
ƒ 1 - 1x3 connector housing  
ƒ 1 - cable tie  
Strip one inch of gray insulation from each end of the 4-conductor cable to expose the wires. Snip off the bare  
wire and one of the four insulated wires.  
Strip 1/4” of insulation from the ends of each remaining wire and tin the exposed ends.  
Trim the tinned wire to 1/8” long.  
Solder to the crimp pin sockets and crimp the pins to the wire, as shown in the pictures below.  
Insert the crimped pins into the connector housing. The pins  
should snap into place when inserted correctly.  
Mark the 3-pin socket with Rx, Tx, and GND, as shown in the  
picture on the right. A piece of masking tape (not included) works  
well. Each line will have a corresponding label on the PCB.  
Solder the DB9 connector to the board, paying attention to the  
orientation so each solder cup covers a pad.  
Solder the wires to the board, referring to the socket connector to  
determine which color wire to use for each signal.  
Fasten the cable to the board using the cable tie. This provides strain relief.  
Finished Serial Connector  
11-3-2005  
9
Download from Www.Somanuals.com. All Manuals Search And Download.  
AVR Robot Controller 1.1 Software Tools  
Programming Cable  
The kit is supplied with material to make a programming cable that works  
with the BASCOM Basic Compiler or the AVRDUDE program (included  
in the WinAVR suite for C/C++ programming). BASCOM and AVRDUDE  
work with any third party programmer that has an Atmel 10-pin  
programming socket, so you only need to build the cable if you don’t  
already own a programmer.  
The programmer uses a male DB25 connector that plugs directly into a PC  
printer (parallel) port.  
For this step, you will need:  
ƒ 1 - programming adapter PCB  
ƒ 3 - 330 ohm resistors (orange-orange-brown)  
ƒ 1 - 2x5 pin right angle header  
ƒ 1 - DB25 solder cup  
ƒ 3’ - 10-conductor ribbon cable  
ƒ 2 - IDC socket connectors (and strain-relief clips)  
Solder the resistors, header, and DB25 connector to the board.  
Hold an IDC connector with the sockets aiming down and the “pin 1” arrow on the right side. Align the ribbon cable  
with the red stripe toward you, and slide the cable into the connector from the right  
side until the edge of the cable just aligns with the left side of the connector. The  
red stripe should be aligned with the arrow. Gently press on the top of the  
connector to crimp it together. You may find it useful to use a vise or pliers, but be  
careful, squeeze gently, and try to apply even pressure. After the connector is  
together, fold the cable over the top so that it extends to the left. Insert a strain-  
relief clip into the top. The final result should look like the picture on the right.  
Install the second IDC connector on the other end of the cable in the same way. Plug one end of the cable into the  
programming adapter, aligning the red stripe with pin 1, which is next to the “JP6” label. The other end plugs into  
the programming header on the ARC board, with the red stripe aligned with the caret by pin 1.  
AVR Robot Controller 1.1 Software Tools  
This is a good point to test your robot controller. This section explains the basic terminology and procedure for  
programming, and has instructions for loading your microcontroller with a program that will flash the green LED.  
There are three main steps in teaching your robot to do something:  
1. Write instructions (a “program”) for the robot to follow.  
2. Translate (“compile”) those instructions into binary code that the robot can execute.  
3. Convey (“download”) the binary code to the robot’s microcontroller using a special cable (the “programmer”).  
Options for the first two steps are discussed below in the Tool Options section.  
To download your program, you need to connect your computer to your robot using one of the following options:  
The least expensive option is to use the programmer included as part of the kit. It can be used for either BASIC or  
C/C++ on Windows if you have a (DB-25) parallel port on your machine. (Note that it will most likely not work  
to use a USB-to-parallel converter; they do not provide full parallel port functionality, just what's necessary for  
printing!)  
If you are using a Mac, or a Windows machine without a parallel port, you can purchase an AVR-ISP  
programmer from Digi-Key (part number ATAVRISP-ND) for $29. That programmer hooks up to a (DB-9) serial  
port. You will also need to get a USB-to-serial converter if your machine does not have a serial port.  
10  
11-3-2005  
Download from Www.Somanuals.com. All Manuals Search And Download.  
AVR Robot Controller 1.1 Software Tools  
Tool Options  
Free, high-quality tools are available for the Atmel AVR series of microcontrollers. On Windows systems, two  
popular options are the BASCOM (BASIC) compiler and the WinAVR suite of tools for C/C++ programming. Mac  
OS X supports the avr-gcc C/C++ compiler (which should work equally well on Linux and FreeBSD).  
The following sections each provide instructions for installing a compiler and downloading a simple program to  
your ARC board. Choose the option that best suits your needs and follow the steps in that section.  
BASCOM on Windows  
BASCOM-AVR is an “integrated development environment” (IDE) that provides an editor, BASIC compiler, and  
downloader. This is a good starting point for people new to programming.  
You can download the BASCOM-AVR DEMO from http://www.mcselec.com. This site also provides information  
on installing BASCOM.  
Copy the “BASCOM Samples” folder from http://www.seattlerobotics.org/WorkshopRobot/Level1/ (or the  
Workshop CD’s “Samples” folder) to a convenient place on your hard drive.  
Start the BASCOM-AVR program. Use File/Open to open FlashLED.bas in the “01aFlashLed” folder (in BASCOM  
Samples).  
While power to the ARC board is off, plug the programming cable into the ISP header on the board and the parallel  
(printer) port of a PC. (If you have an AVRISP or STK200/300 compatible programming cable you can use that  
with BASCOM by changing the programmer in the Options/Programmer menu. (The kit’s programmer uses the  
default “Sample Electronics programmer” option.) Please refer to the BASCOM documentation for additional  
information.)  
Turn on power to the ARC board, click on the Compile button (or use menu Program/Compile), then click on the  
Run button (Program/Send To Chip). The Sample programmer should pop up with the ARC CPU identity listed  
(m16). Click on the Auto-Program button (menu: Chip/Autoprogram) and the program should load in a couple  
seconds. Close the Sample programmer window.  
The green program LED flashes with a one second cycle time after a successful download. If the LED flashes very  
slowly, then the oscillator options for the CPU have not been set and the CPU is likely running off the factory  
default 1 MHz internal oscillator. You can re-program the chip to run off the external crystal/resonator, or the  
internal 8 MHz oscillator by reading about the fuse bits and programming them appropriately. See “Customizing the  
Microcontroller” below.  
WinAVR (avr-gcc) on Windows  
WinAVR (pronounced “whenever”) is a suite of software development tools for the Atmel AVR series of  
microprocessors. It includes the avr-gcc compiler for C and C++, AVRDUDE downloader, and Programmers  
Notepad editor.  
You can download the WinAVR suite from http://sourceforge.net/projects/winavr/. When you run the installer, it is  
a good idea to uncheck the option “Add Directories to PATH.” (Adding the WinAVR tools to the path may cause  
grief for other apps since that puts Cygwin (Linux emulation) files before system files.)  
If you are using an “NT” version of Windows (e.g. NT 4.0, 2000, XP, 2003), you will need to do the following to set  
up AVRDUDE (it enables communication with the ports needed for downloading):  
Launch a Command Prompt (from the Programs menu, choose Accessories, then Command Prompt).  
At the prompt, type:  
cd c:\WinAVR\bin  
and hit Enter  
Then type:  
install_giveio  
and hit Enter  
You should see output from this program, ending with a “Success” message. Close the command prompt window.  
Copy the “C Samples” folder from http://www.seattlerobotics.org/WorkshopRobot/Level1/ (or the Workshop CD’s  
“Samples” folder) to a convenient place on your hard drive.  
11-3-2005  
11  
Download from Www.Somanuals.com. All Manuals Search And Download.  
AVR Robot Controller 1.1 Software Tools  
Double-click on “LaunchPN.bat” in the “C Samples” folder. This will launch Programmers Notepad with the path  
changes needed by the compiler and downloader. (If you installed WinAVR in a non-default location, you’ll need to  
edit this batch file.)  
While power to the ARC board is off, plug the programming cable into the ISP header on the board and the parallel  
(printer) port of a PC. (If you are using an AVRISP via a serial (or USB) port, you will need to open the “makefile”  
file in the “01a FlashLED” folder and change two definitions: “AVRDUDE_PROGRAMMER = avrisp” and  
“AVRDUDE_PORT = com1”. You may also want to define environment variables for these.)  
In Programmers Notepad, use File/Open to open FlashLED.c in the “01a FlashLED” folder (in C Samples). In the  
Tools menu, choose the “Make All” option. An “output” window will show the results of your build. (If you get a  
message that “the system cannot find the file specified,” you probably just need to restart Programmers Notepad  
using LaunchPN.bat.) To download the program, turn on power to the ARC board, then from the Tools menu,  
choose the “Program” option.  
You should now see the green LED flash with a one-second cycle time.  
avr-gcc on Mac OS X  
The easiest option for programming on the Mac is to use the C compiler and UISP downloader available via a  
package installer from http://www.eecs.berkeley.edu/~mseeman/resources/macmicro.html. It’s an easy install  
process, but only compiles C, not C++, programs.  
If you would like to use C++, you’ll need to do a full manual install (building all of the tools from source).  
Fortunately, there are complete instructions in the AVR runtime library manual (avr-libc-user-manual-1.0.4.pdf)  
available at http://savannah.nongnu.org/projects/avr-libc/. Follow the steps in section 7.8, “Installing the GNU Tool  
Chain.” This document also lists the locations for downloading the other tools. One thing to be aware of is that you  
need to have TeX installed to build AVRDUDE (it’s apparently used when building the included documentation); if  
you have Fink installed, use the command: “fink install tetex”. You can avoid this by using the UISP downloader  
instead of AVRDUDE.  
Note: The AVR runtime library manual mentioned in the previous paragraph contains lots of useful information for  
programming the Atmel ATmega processors, making it a good resource regardless of which compiler option you  
choose.  
Using these tools requires using the command line interface to the Mac’s Unix-based underpinnings. If you don’t  
know how to use the Terminal program, you should read up on that before tackling the install and use of the AVR  
tools.  
Copy the “C Samples” folder from http://www.seattlerobotics.org/WorkshopRobot/Level1/ (or the Workshop CD’s  
“Samples” folder) to a convenient place on your hard drive.  
While power to the ARC board is off, plug the AVRISP device into the ISP header on the board and connect it to a  
USB-to-serial converter attached to your Mac. Open the makefile in the “01a FlashLED” folder and change two  
definitions: “AVRDUDE_PROGRAMMER = avrisp” and “AVRDUDE_PORT = ___”. For the port, you will need  
to use the name of the serial port supplied by your USB-to-serial adapter. You can get a list of available serial  
devices by typing in the Terminal window: “ls /dev/cu.*”. You will need to supply the full name, e.g.  
“AVRDUDE_PORT = /dev/cu.USA281b1P2.1”.  
In the Terminal window, change to the “01a FlashLED” folder. At the command line type “make” to compile the  
program. Turn on power to the ARC board, then type “make program” to download the program.  
You should now see the green LED flash with a one-second cycle time.  
Customizing the Microcontroller  
The ATmega16 microcontroller provided in the kit can be customized by changing “fuse bits.” These settings may  
be modified with built in programmer that comes with BASCOM, or with the AVRDUDE program included in the  
WinAVR suite.  
Every fuse bit has a default value. There are several fuse states that it’s useful to change. These are explained in  
more detail in the “ATmega16 Overview” section. The suggested changes are: (1) set the internal oscillator (clock)  
12  
11-3-2005  
Download from Www.Somanuals.com. All Manuals Search And Download.  
AVR Robot Controller 1.1 Software Tools  
to 8 MHz; (2) enable brown-out detection; (3) disable JTAG; and (4) disable erasing EEPROM when downloading a  
new program. Please refer to the chip data sheet (www.atmel.com) for a complete list of the fuse bits.  
The following steps set the microcontroller to the suggested state.  
If you are using BASCOM-AVR: Connect the programmer to your board as above, select “Send to Chip” from the  
Program menu to bring up the Sample programmer window. Click on the “Lock and Fuse Bits” tab.  
In the Fusebits section:  
Click on Fusebit B and change the option to “0:BODEN enabled”  
Click on FusebitA987 and change the option to “0100:Internal RC oscillator 8MHz”  
Click on the WriteFS button.  
In the Fusebits High section:  
Click on Fusebit J and change the option to “1:Disable JTAG”  
Click on Fusebit G and change the option to “0:Preserve EEPROM when chip erase”  
Click on the WriteFSH button.  
Close the Sample programmer window.  
If you are using avr-gcc and AVRDUDE, downloading the FlashLED (or FlashLEDAlias) program will set the fuse  
bits as part of the download process. (If you are setting the fuse bits manually, the changes above are accomplished  
with 0xA4 for the low byte and 0xD1 for the high byte.)  
Resources  
You can find tools, support, and samples for Atmel’s AVR microcontrollers at the following sites:  
Home page for the SRS Robot Level 1 Kit with links for sample code, data sheets, etc.  
AVR Robot Controller resource page, user guide and sample code.  
Assembler, Simulator, Application notes, software.  
Technical support, applications, code fragments, documentation, design files.  
The BASCOM compiler and various application notes can be found here.  
Discussion groups, sample code and projects, avr-gcc C compiler.  
Download site for the WinAVR suite of development tools, including GNU avr-gcc C/C++ compiler and  
AVRDUDE downloader.  
Home page for the WinAVR suite of tools.  
Information about the AVR tools on Mac OS X and a download for a binary installer that will give you all the  
software you need to program AVR chips on Mac OS X in C.  
Detailed info on the free AVR tools is located on the site for the AVR runtime library.  
11-3-2005  
13  
Download from Www.Somanuals.com. All Manuals Search And Download.  
Chassis Assembly  
Chassis Assembly  
Preparation  
Identify the parts used in the chassis. Refer to the Kit Contents section for a list of parts in each bag.  
Anti-Static Bag: QRB1134 light sensors.  
Electro-Mechanical Bag: velcro, mounting squares, shrink tubing, and rubber bands.  
Hardware Bag: everything except the four 1” standoffs and eight of the 4-40 x 1/4” machine screws.  
Loose items: everything except the 4-conductor cable and ribbon cable.  
Remove the paper from the (twelve) chassis pieces. (The Level 1 kit contains the chassis parts needed for all levels;  
keep the extra pieces somewhere convenient for use later.)  
Cut the 1/2” x 2” strip of adhesive-back velcro loop into two 1/4” x 2” strips. Attach one of them to one of the long  
sides of the battery holder. This will help hold the batteries in place. Attaching the second strip to the other side is  
optional; it will make the holder even more secure, but it will be harder to insert and remove it.  
Cut each 1/2” piece of shrink tubing in half. Slide one 1/4” piece onto the orange wire of a servo  
cable (you can gently pull to separate the colored wires, but don’t shorten the cable). Referring to  
the picture on the right, solder the orange wire to the “left” connection on the motor, keeping the  
shrink tubing away from the joint while you work. Slide the tubing over the connection and  
shrink it with a heat gun or hair dryer. Repeat with the red wire, and then for the second motor.  
Trim the wires connected to the light sensors, leaving 6” of colored wire. Strip the insulation off  
1/4” of the end of each wire, then tin those ends. Note: if you are using the optional ARC Board Connection Kit,  
connect male crimp pins to the light sensor wires and insert them into a 4-position housing with the orange wire in  
the slot with the triangle, and the other wires arranged so that the color order is orange - green - blue - white.  
Using leftover wires from the light sensors, cut two 7” lengths of blue and two of white. Strip and tin ~1/4” on one  
end and 3/8” on the other end. (Do not use ARC Board Connection Kit parts here.)  
Motors  
Find the two copies of the “motor plate” pictured on the right.  
Hardware:  
4 2-56 x 1” screws  
4 2-56 nuts  
8 2-56 lock washers  
Place a motor in front of the plate, with the holes aligned and the motor’s green  
axle in the circular cutout (as shown on the right).  
Put a lock washer onto a screw and insert the screw through the motor and then  
through the hole in the plate. Finish with another lock washer and a nut, but  
don’t tighten it, yet. The assembly should stack like this: screw head, washer,  
motor, plate, washer, nut. Repeat the same sequence with the other hole, then  
tighten both.  
For the other motor, hold the other piece with the cutout on the right and the  
motor placed as shown in the picture on the right. Fasten in the same manner as  
the first motor.  
Stretch a band around each wheel, but don’t connect them to the motors, yet.  
14  
11-3-2005  
Download from Www.Somanuals.com. All Manuals Search And Download.  
Chassis Assembly  
Light Sensors  
Find the two copies of the “light sensor plate” pictured on the right.  
Hardware:  
1 4-40 x 1” screw  
1 4-40 nut  
2 4-40 lock washers  
4 4-40 flat washers  
Stack items onto the screw as follows: lock washer, plate, 2 flat washers,  
both light sensors (orient them the same way), 2 flat washers, the other plate  
(oriented the same direction as the first plate), lock washer, nut. Tighten.  
Bottom Plate  
The picture below shows the bottom plate.  
Hardware:  
Open the Tamiya ball caster package and retrieve the  
following parts:  
1 H3 (ball holder, triangular)  
3 6-32 x 1 1/2” standoffs  
3 6-32 x 3/8” screws  
Attach the standoffs to the plate through the highlighted  
holes, with the screws on the side with the etching.  
1 ball  
3 shafts  
1 H2 (triangular)  
3 H1 (spacers)  
3 3x15mm machine screws (longer ones)  
3 nuts  
Note that the package contains additional parts (for a  
second caster and alternate configurations), but they are  
not needed here.  
Insert the ball into H3, and place the shafts on top of the  
ball, parallel with the edges of the holder, as shown in  
the upper left image in the picture below.  
Place H2 on top of the H3 assembly, as shown by the  
pink arrows.  
Place the three H1 spacers into the indentations on H2,  
as shown by the blue arrows.  
© 2004 C. Saxton  
Insert each machine screw from the “ball” side, up  
through H3, H2, and a spacer. Hold the bottom plate of  
the chassis with the standoffs on the top and place it over  
the caster, inserting the screws through the holes  
highlighted in the picture on the left. Fasten with the  
nuts.  
11-3-2005  
15  
Download from Www.Somanuals.com. All Manuals Search And Download.  
Chassis Assembly  
Strip about 2” from one end of each 7” length of 18 AWG  
insulated wire.  
Hardware (for one side):  
1 4-40 x 1/4” round standoff  
1 4-40 x 1/4” screw  
2 4-40 x 1/2” screws  
C
A
B
2 4-40 washers  
2 4-40 nuts  
Mount the standoff in hole C, on the same side of the plate  
as the caster, using the 1/4” screw.  
For holes A and B, put a washer on a 1/2” screw and put the screw through the plate from the side with the caster.  
Attach a nut (on the side with the standoffs). Bend the stripped end of the wire around pins A and B as shown.  
Fasten between the washer and the plate. Make sure that the section of the wire next to C is stripped. Place  
additional bends in the wire to make an effective bump sensor.  
Hold the plate so that the caster is on the bottom.  
Connect one of the spare blue wires (from the light sensors) to A,  
wrapping the 3/8” tinned end around the screw and fastening it under  
the nut (on the opposite side of the chassis from the bumper wire).  
Connect one of the spare white wires to C, fastening it under the  
screw head (on the same side of the chassis as the blue wire).  
Repeat the bumper installation on the other side.  
Top Plate  
The picture at the right shows the top plate as seen from  
above.  
Note: this piece is not symmetric. Make sure that you are  
holding the piece so that there’s a hole in the lower left  
corner (marked by the star in the picture). If the hole is in  
the lower right corner, flip the piece over.  
Hardware:  
4 4-40 x 1/2” standoffs  
4 4-40 x 1/4” screws  
Insert the screws through the highlighted holes from  
underneath, sticking up through the plate.  
Attach the standoffs to the screws.  
Double-check to make sure that with the standoffs sticking  
up from the plate, you have a hole in the lower left corner.  
16  
11-3-2005  
Download from Www.Somanuals.com. All Manuals Search And Download.  
Chassis Assembly  
Flip the top plate over. The screws will be visible, and the standoffs will be underneath (and you should have a hole  
in the lower right corner).  
Find this piece (the battery spacer), and hold it like this:  
You will mount this to what is  
the underside of the top plate  
(which is now face up since you  
flipped it over!)  
Stick the two mounting squares  
onto the battery spacer. Then,  
flip the spacer over and attach it  
to the top plate, as shown on the  
far right. The battery spacer  
will fit between the slots and  
the holes will be aligned.  
Cut the velcro strap in half (into  
two 8” strips). Feed each strip  
through a pair of slots so that  
the “hook” side of the velcro is  
against the chassis and the ends  
are on the side with the battery  
spacer, as shown on the right.  
Final Assembly  
To assemble the robot:  
Put the bottom plate on the ground with the caster down  
and the standoffs up.  
Place the light sensor assembly into the slots at the front of  
the robot, as indicated at the top of the picture on the right.  
The angled edge will go toward the interior of the robot.  
Place the tabs of the motor assemblies into the slots on the  
bottom plate, with the motors resting on the bottom plate  
and oriented as shown in the picture on the right.  
Hold the top plate with its standoffs sticking up. Feed the  
wires from the light sensors and bumpers through the  
rectangular hole near the front of the top plate. Align the  
slots in the top plate with the tabs from the motor and light  
sensor assemblies.  
Hardware:  
3 6-32 x 3/8” machine screws  
2 small (wood) screws  
4 4-40 x 1/4” screws  
Fasten the 6-32 x 3/8” machine screws through the top plate and into the standoffs.  
Attach the wheels to the motors and secure using the small screws.  
Place the ARC board on the standoffs mounted to the top plate, oriented so that the switch is in the corner. Attach  
the board to the standoffs using the 4-40 x 1/4” screws.  
11-3-2005  
17  
Download from Www.Somanuals.com. All Manuals Search And Download.  
Wiring Connections  
Leftover Parts  
At this point, your robot is together and you’re probably wondering about those extra parts. They are used for Levels  
2 and 3 of the SRS Robot. Here’s a summary.  
The hardware bag should still contain four 1” standoffs and eight 1/4” machine screws. They are explained below.  
There will be five plastic chassis pieces remaining:  
These two pieces are used to hold Sharp GP2D12 infrared distance sensors (part of the  
Level 2 kit). They mount on the front corners of the chassis between the top and  
bottom plates.  
This piece can hold the Devantech SRF-04 Ultrasonic Rangefinder (sonar distance  
sensor). It mounts with the single tab into a slot near the front of the top plate and the  
double-tab side held in place by either of the following pieces (above the top plate).  
Either of these pieces can be used as a “cap” for the sonar plate. They are mounted to  
the top plate via the remaining standoffs and screws (two sets for the small piece, all  
four sets for the large piece).  
The larger piece can hold an LCD screen (part of the Level 2 kit). The LCD can also  
be mounted directly to the top plate.  
Wiring Connections  
Plug the servo cables from the motors into the “LEFT” and “RIGHT” pins at the back of the board, using the row of  
pins further from the edge of the board, with the orange wire aligned with the “W” and the brown wire aligned with  
the “B.”  
Plug the wires from the light sensors and bumpers into the sockets on the front of the ARC board as follows:  
Plug the right light sensor wires into the “RF” sockets at the front of the board. There is a “1” identifying  
position 1. The colors, from position 1 to 4 are orange, green, blue, and white. (If you are using the ARC  
Board Connection Kit, plug the connector into the board so that the triangle (orange wire) is at position 1.)  
Plug the left light sensor wires into the “LF” sockets, using the same color order as above.  
Plug the right bumper wires into the “RIGHT” sockets at the front of the board. Plug the white wire into  
position 1; plug the blue wire into position 2. (There is no connection to position 3.)  
Plug the left bumper wires into the “LEFT” sockets, as above.  
You may find it useful to label the connectors at the end of the cables for the motors (and light sensors if you are  
using the connection kit). A small piece of masking tape (not supplied) with “L” or “R” works well.  
Place 6 AA batteries into the battery holder, flip the robot over, and fasten the velcro straps around the battery  
holder to fasten it in place. Feed the connector through the slot in the top plate of the chassis, and plug it into the  
power connection on the board (next to the switch). Be sure that the housing aligns with the three pins. The red wire  
can be on either end; the black wire should be in the middle.  
18  
11-3-2005  
Download from Www.Somanuals.com. All Manuals Search And Download.  
ATmega16 Programming  
ATmega16 Programming  
Part 1  
11-3-2005  
19  
Download from Www.Somanuals.com. All Manuals Search And Download.  
ATmega16 Programming  
20  
11-3-2005  
Download from Www.Somanuals.com. All Manuals Search And Download.  
ATmega16 Programming  
Part 2  
11-3-2005  
21  
Download from Www.Somanuals.com. All Manuals Search And Download.  
ATmega16 Programming  
22  
11-3-2005  
Download from Www.Somanuals.com. All Manuals Search And Download.  
ATmega16 Programming  
Part 3  
11-3-2005  
23  
Download from Www.Somanuals.com. All Manuals Search And Download.  
ATmega16 Programming  
24  
11-3-2005  
Download from Www.Somanuals.com. All Manuals Search And Download.  
ATmega16 Programming  
11-3-2005  
25  
Download from Www.Somanuals.com. All Manuals Search And Download.  
ATmega16 Programming  
Part 4  
26  
11-3-2005  
Download from Www.Somanuals.com. All Manuals Search And Download.  
Sample Programs  
Sample Programs  
There are sample programs available from http://www.seattlerobotics.org/WorkshopRobot/Level1/ (or the  
Workshop CD’s “Samples” folder). There are versions for BASCOM (BASIC) and C. The program files contain  
descriptive comments to explain what the code is doing.  
The programming concepts are explained in the slides in the “ATmega16 Programming” section. The “Program  
Descriptions” section below describes the programs that are listed at the end of each section of slides. The  
extensions are suggestions for modifications you can make to the code to experiment and learn. The challenges are  
optional, harder modifications.  
Please see the “AVR Robot Controller 1.1 Software Tools” section for instructions on installing and using the  
software to program the microcontroller.  
Please see the “AVR Robot Controller 1.1 Hardware Description” section for details on the I/O pins used by the  
SRS Robot.  
Creating New Programs  
For some of the challenges, you may wish to create a new program instead of modifying one of the sample  
programs.  
11-3-2005  
27  
Download from Www.Somanuals.com. All Manuals Search And Download.  
Sample Programs  
A good way to get started with a new program is to make a copy of a folder for an existing program, then rename the  
new folder and its .bas or .c file. (For C programs, you will also need to edit the makefile to reflect the name change  
for the .c file. Look for the SRC= line. You may also change the PRG= line for consistency.)  
C Programming  
Each sample program is in its own folder. Each of these folders contains the C files needed for the program and a  
“makefile” that provides information for the tools. All the files created by the build process are stored in this folder  
as well. The concept of a makefile will be new to many people, even experienced programmers. You do not need to  
understand the makefile, but it’s important that you do not rename it!  
The makefile is set up to use the BASCOM programmer (supplied with the kit). If you will be using an AVRISP,  
you’ll need to override the settings in the makefile. You can modify the makefile (in each program folder), but a  
better way is to define environment variables:  
AVRDUDE_PROGRAMMER = avrisp  
AVRDUDE_PORT = com1  
(see the Software Tools section for Mac information)  
When using Programmers Notepad, but sure to use LaunchPN.bat (from the “C Samples” folder) to start it. To build  
a program, open a C file that is part of the program you want to build. Make any edits you want, save the file, then  
choose the Tools/Make All command to build. This will automatically use the makefile in the same folder as your C  
file. An “output” window will show the results of your build. (If you get a message that “the system cannot find the  
file specified,” you probably just need to restart Programmers Notepad using LaunchPN.bat.) To download the  
program, make sure the robot is on, then choose the Tools/Program command.  
(You can also use the command line to build and download your programs. Run setpath.bat (from “C Samples”) in  
the command window to set up the environment, then call make manually.)  
Program Descriptions  
Program 1  
Purpose: Learn how to use outputs to make the green LED flash.  
Programs: FlashLED, FlashLEDAlias -- note how the code in FlashLEDAlias is easier to read; you don’t need the  
comments to explain what’s going on.  
Extensions:  
o Change the rate at which the LED flashes.  
o Change the code so that the LED is on longer than it is off.  
Program 2  
Purpose: Learn how to use inputs to detect obstacles, lighting the LED when a bumper (whisker) is touched.  
Programs: Whisker, WhiskerAlias  
Extension: Add code so that touching either bumper turns on the LED.  
Challenge: Make the LED flash at four different rates when bumpers are: open-open, open-closed, closed-closed,  
closed-open.  
Program 3  
Purpose: Drive! Learn how to control the motors.  
Program: PWM  
Extensions:  
o Experiment with other PWM values, e.g. set both motors to 255 or -128.  
o What happens when you use 128 for the left motor PWM and 255 for the right motor PWM?  
o What happens when you use -100 for the left motor PWM and 100 for the right motor PWM?  
o Flash the LED once a second for five (or three) seconds before starting.  
o Wait for a bumper touch (instead of delay) before starting the motors.  
o Make a bumper touch cause the robot to back up, then stop.  
o Make the robot go forward 10 inches, then turn left 90 degrees.  
o Make the robot do the previous extension 4 times.  
28  
11-3-2005  
Download from Www.Somanuals.com. All Manuals Search And Download.  
Sample Programs  
Challenges:  
o Make a bumper touch cause the robot to back up, turn away from the obstacle, and then resume exploring.  
(The BumpNGo program shows one possible solution, including waiting for a bump at the beginning of the  
program before starting.)  
o Teach the robot how to navigate a (specific) obstacle course.  
o “Bounce” along a wall: drive until you touch a wall, then turn away from it and arc back toward it, continuing  
to “bounce” along.  
BumpNGo  
This program is an example of a solution to the first challenge in Program 3. It waits for a bump at the beginning of  
the program, then drives forward until it bumps something, at which point it backs up, turns away from the obstacle,  
and then continues forward again (continuing to avoid obstacles).  
Program 4  
Purpose: Learn how to send text from the robot to a PC via a serial connection. The text is received by a program  
such as HyperTerminal on Windows.  
Program: HelloWorld  
Extensions:  
o Change the text.  
o Send the text once a second.  
o Print “open” or “closed” based on the state of the left bumper.  
Challenges:  
o Print text once a second until either bumper is closed.  
o Print “open” or “closed” based on the state of the left bumper, but only print it when the state changes. (Hint:  
you will need a variable to remember the current state.)  
o Print open and closed messages (as in the previous challenge) for both bumpers.  
Program 5  
Purpose: Learn how to receive text/commands to the robot from a PC via a serial connection.  
Programs: InputChar, InputText  
Extension: Change InputText to print a special message when the program receives a ‘?’.  
Challenges:  
o Use serial input to control the robot, e.g. moving forward, turning left/right, and moving backward in response  
to ‘f’, ‘l’, ‘r’, and ‘b’. Have each motion performed for 1 second, then wait for more input.  
o Take code from a couple of your previous programs, create functions for those activities, and use input to  
determine which activity to perform. Have your program start by sending text with a menu of options.  
Program 6  
Purpose: Learn how to read analog input values from the light sensors. This program sends the values to a PC via a  
serial connection.  
Program: ADCPrint  
Extension: Add output for the second sensor.  
Challenge: Drive forward until the light sensor reads much higher or lower than the initial reading  
RemoteControl  
This program uses input from the numeric keypad to drive the robot in short bursts. It prints (via serial output) the  
values of the light sensors each time a character is received (any character works, not just “driving” keys). This  
program combines driving, serial input, serial output, and reading of analog sensors.  
Program 7  
Purpose: Learn how to read from and write to the EEPROM memory. This program reads and stores the light sensor  
values.  
Program: EEPROM  
Extension: Show sensor values while you are waiting for a key press (e.g. every 200 ms).  
11-3-2005  
29  
Download from Www.Somanuals.com. All Manuals Search And Download.  
Sample Programs  
Program 8  
Purpose: Learn to use the Timer/Counter for timing. This program flashes a LED at a specific rate while reading  
sensors.  
Program: Timer  
Extensions:  
o Change the flash rate.  
o Add more code to the loop, e.g. showing sensor values. Notice that the flashing still maintains its rate, with no  
changes necessary.  
Challenges:  
o Modify your EEPROM program to use the timer instead of WaitMs when showing sensor readings.  
o Read sensors for 10 milliseconds and calculate the average value.  
Program 9  
Purpose: Learn how to use proportional steering to follow a line.  
Program: LineFollow  
Extension: Tune values for your robot. Adjust the light thresholds (use ADCPrint to see sensor values). Adjust the  
scaling proportion for steering.  
Challenge: Go faster without falling off the line.  
Program 10  
Purpose: This program shows how to implement the states involved in detecting and identifying a junction. It will  
determine which options are available (left, right, forward), then stop.  
Program: Junction  
Extension: Tune values for your robot.  
Challenges:  
o Detect end of maze (solid 6” diameter black circle).  
o Use sensor sample averaging -- take several readings and use their average when making decisions.  
o Save light sensor thresholds in EEPROM.  
Program 11  
Purpose: This program shows how to implement the states involved in turning at a junction.  
Program: Turn  
Extension: Tune values for your robot.  
Challenge: Go faster!  
Program 12  
Purpose: This program shows how to use a table to store a sequence of control commands for the robot. It also  
demonstrates how to store constant data (the table) in program memory (Flash) instead of the default SRAM.  
Program: DeadReckon  
Extension: Modify/Add commands to the table.  
Challenge: Add another piece of data to the state, e.g. LED on/off.  
30  
11-3-2005  
Download from Www.Somanuals.com. All Manuals Search And Download.  
AVR Robot Controller 1.1 Hardware Description  
AVR Robot Controller 1.1 Hardware Description  
The Level 1 Robot Kit ships with an ATmega16 microcontroller. The Atmel AVR microcontrollers are designed to  
be pin- and code-compatible where possible. In this case, for example, you could substitute an ATmega8535 or  
ATmega32. These chips will all function in the ARC board with minimal software changes (typically just a re-  
compile), the primary difference being the amount of internal memory available. Please see Atmel’s site  
Power  
Power can be any source from 6-24 volts DC. Pay attention to the polarity symbols near the power plug -- ground is  
in the center, with +V applied at either end. The ARC board is protected against battery reversal with a diode. This  
diode reduces the available power to the board and prevents destruction of the H-Bridge in case of accidental battery  
reversal. If you want, you can use a polarized battery connector and solder it directly to the board and replace the  
diode with a bare wire.  
I/O Pins  
The ATmega16 microcontroller has four 8-bit I/O ports and many peripheral functions that work through these I/O  
pins. Port A also doubles as the analog input port. Port D doubles for many of the built in functions like serial I/O,  
PWM and timers. Port B doubles as the programming interface.  
The following table lists the I/O pins that are brought out to headers on the ARC board. (The expansion headers JP3  
and JP10 are not included since they bring out all I/O port bits as well as power and ground.) Connection lists what  
device or feature the robot communicates with. Physical Pin is the connection to the ATmega16. Functional Name  
indicates how each connection is used in the programs. Input/Output describes the communication direction as  
viewed from the ATmega16. Header is the text identifying that connection on the board. (See the schematic for pin  
details.)  
Physical Functional Input/  
Connection  
Left bump sensor  
Right bump sensor  
Left distance sensor (Level 2)  
Right distance sensor (Level 2)  
Left light sensor  
Center light sensor (not included with kit) PA2  
Right light sensor  
Left motor direction  
Left motor PWM  
Left motor channel A (encoder, Level 3)  
Left motor channel B (encoder, Level 3)  
Left servo (not included with kit)  
Right motor direction  
Right motor PWM  
Right motor channel A (encoder, Level 3) PD2  
Right motor channel B (encoder, Level 3) PC5  
Right servo (not included with kit)  
Serial input  
Pin  
Name  
PA0  
PA7  
Output Header  
LEFT (at front of board)  
PA0  
PA7  
PA0  
PA7  
PA1  
input  
input  
input  
input  
input  
input  
input  
output  
output  
input  
input  
output  
output  
output  
input  
input  
output  
input  
output  
output  
LEFT (at front of board)  
RIGHT (at front of board)  
RIGHT (at front of board)  
LF (“left floor”)  
CF (“center floor”)  
RF (“right floor”)  
LEFT (at back of board)  
LEFT (at back of board)  
LEFT (at back of board)  
LEFT (at back of board)  
LEFT (at back of board)  
RIGHT (at back of board)  
RIGHT (at back of board)  
RIGHT (at back of board)  
RIGHT (at back of board)  
RIGHT (at back of board)  
JP5  
ADC0  
ADC7  
ADC1  
ADC2  
ADC3  
PC3  
OC1B  
INT1  
PC2  
PC2  
PC4  
OC1A  
INT0  
PC5  
PA3  
PC3  
PD4  
PD3  
PC2  
PC2  
PC4  
PD5  
PC5  
PD0  
PD1  
PB4  
PB6  
PB7  
PB4  
PC5  
RXD  
TXD  
PB4  
PB6  
PB7  
Serial output  
Green “program” LED  
Option A  
Option B  
Option C  
JP5  
PROG (green LED)  
ISP/JP9, A  
ISP/JP9, B  
ISP/JP9, C  
PB4  
11-3-2005  
31  
Download from Www.Somanuals.com. All Manuals Search And Download.  
AVR Robot Controller 1.1 Hardware Description  
Expansion Headers JP3 and JP10  
Refer to the schematic for the connections to these headers. All CPU I/O, +5v, ground, +/- 10v and battery voltages  
are supplied. JP3 supplies +5v and ground from the analog section. JP10 supplies +5v, ground, +10v and –10v from  
the digital section. The +/-10v is from the serial interface chip and can only supply about 10ma of current. This is  
sufficient for one or two low powered op-amps. JP3 and JP10 are oriented with pin 1 toward the notch side of the  
CPU.  
Left and Right Analog Inputs  
These are the headers labeled “LEFT” and “RIGHT” at the front of the board, with the  
3-connector sockets. They are raw analog inputs with filtered +5v and ground. They  
are intended to connect directly to the Sharp GP2D12 or 15 sensors. However any 0-5v  
output sensor may be used. You can also connect a potentiometer to these inputs for  
position feedback or variable input.  
Left, Center, and Right Floor Sensor Inputs  
These are the headers labeled “LF,” “CF,” and “RF” at the front of the board, with the 4-connector sockets. These  
match the pin-out of QRB1134 phototransistors. The resistors supplied with the kit are selected to work well with  
these sensors. Pin 1 is attached to the outer E (emitter) wire. Pin 4 is attached to the outer S (sensor) wire. If you do  
not want to commit the board to these sensors, you can replace the 180-ohm resistor with a piece of wire and leave  
out the 4.7k resistors. The resulting circuit is similar to the Left and Right analog inputs and allows +5v-powered  
sensors to be connected to the board.  
Normal Wiring  
Alternate Wiring  
Left and Right Motor Connectors  
These are the headers labeled “LEFT” and “RIGHT” at the back of the board, with the 2x3 pin headers. The left and  
right motor connectors provide output from the H-bridge, power, ground, and two CPU I/O lines. The additional  
lines can be used to implement an encoder feedback or input mechanism, or can be used as output lines to drive a  
standard R/C servo.  
H-bridge output  
The H-bridge output is on the inner pins of the header and is directly connected to the 754410 H-bridge. This can  
supply up to 1A with a battery voltage of up to 24V. If you gut a servo and re-attach the servo cable wires to the  
motor, be aware that the two H-bridge output pins are not aligned with the power pins: you either need to wire the  
servo motor to Red, White, or connect the plug in reverse.  
Encoder input  
When driving motors with the H-bridge, the additional two signal wires and  
power can be used to gather encoder feedback. When driving an encoder make  
sure the jumper block labeled SERVO is connected for +5v.  
Left Motor  
Portc.3  
Right Motor  
Portc.4  
DIR  
PWM Portd.4 (OC1B)  
CH-A Pind.3 (INT1)  
Portd.5 (OC1A)  
Pind.2 (INT0)  
Pinc.5  
CH-B  
Pinc.2  
32  
11-3-2005  
Download from Www.Somanuals.com. All Manuals Search And Download.  
AVR Robot Controller 1.1 Hardware Description  
R/C servo output  
When driving an R/C servo, use the pins nearest to the edge of the board. They  
are marked with letters indicating polarity: “W R B” for White, Red, and Black.  
Some servo brands substitute yellow for white.  
When driving servos, the board has the option of selecting regulated +5v or raw  
battery voltage to drive the servos. R/C servos are usually rated at 4.8v and 6.0v,  
but can be driven with 9-12 volts without damaging the internal electronics.  
Higher voltages will increase speed and torque of the motors. A rough rule of  
thumb is that doubling the voltage (9.6 vs. 4.8) doubles the RPM and the maximum torque of the servo.  
Power Source  
A 3-pin header is used to select the power source for the Motor Headers (V+ in  
the picture above) when used for R/C servos or encoders. There are two options:  
regulated +5 volts, or the battery supply. Use the shorting jumper to make this  
connection. The H-Bridge is always connected to the main power source.  
In-System Programming and Option Select  
The 2x5 pin header labeled ISP (and JP9) is for In-System Programming of the CPU. This is the mechanism by  
which the CPU is loaded with a new program. This connector works with any Kanda-compatible 10-pin AVR  
programmer. The cable connects to the ISP header with the pin 1 marker (a triangle) next to the 1 and caret printed  
on the board.  
The header has a dual use. When the programming cable is removed, several of the pins may be used to select  
options or give feedback. All pins are available from the expansion headers – refer to the schematic for more details.  
In addition, one pin is used to control the program LED (green). This gives both visual feedback while  
programming, and can be controlled by the user’s program to give feedback.  
When a shorting bar is across the inputs, the corresponding pin value will be zero. There are no pull-up resistors on  
these inputs, so you need to enable the CPU pull-up on those ports if you intend to use them as inputs.  
Reset has no CPU readable input. It simply resets the CPU when shorted.  
Pin  
9
7
Pair label  
A
B
Direction  
Input  
Input  
IO port  
Pinb.6 (MISO)  
Pinb.7 (SCK)  
CPU reset  
5
Input  
3
C (Prog LED)  
Input/Output Pinb.4/Portb.4  
1
Output  
Portb.5 (MOSI)  
Options I/O port assignments  
Program LED output  
The program LED output is inverted. I.e. writing a 0 to portb.4 will illuminate the LED, writing a 1 will turn it off.  
Remember to configure that I/O pin as an output or it will never turn on. When using Option C as an input, you  
cannot use the LED (they are connected together).  
11-3-2005  
33  
Download from Www.Somanuals.com. All Manuals Search And Download.  
AVR Robot Controller 1.1 Schematic  
AVR Robot Controller 1.1 Schematic  
34  
11-3-2005  
Download from Www.Somanuals.com. All Manuals Search And Download.  

Silvercrest Hair Dryer SRHT 1500 A1 User Manual
Sony Camcorder CCD TR66 8 User Manual
Sony Camcorder CCD TRV 64 E User Manual
Sony Car Satellite TV System KDL 32R41xB User Manual
Sony DVD VCR Combo RDR VX521 User Manual
Sony Speaker System SRS A202 User Manual
Sony Water Dispenser SGPT12 User Manual
StarTechcom Computer Accessories VGA2VID User Manual
Sterling Marine Instruments S 8613 User Manual
SV Sound Car Speaker PB12 NSD User Manual