Home

SRS Labs SRS Robot Level 1 Kit User's Manual

image

Contents

1. 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 Ola 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 ATmegal6 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 ATmegal6 Overview section The suggested changes are 1 set the internal oscillator clock 12 1 1 3 2005 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 se
2. 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 1 1 3 2005 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
3. oriented the same direction as the first plate lock washer nut Tighten Bottom Plate The picture below shows the bottom plate Hardware 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 2004 C Saxton 1 1 3 2005 Open the Tamiya ball caster package and retrieve the following parts H3 ball holder triangular ball shafts H2 triangular HI spacers 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 _ WW WD WN 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 R o 9 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 15 Chassis Assembly Strip about 2 from one end of each 7 length of 18 AWG insulated wire Hardware for
4. Run at 8MHz a Default is 1MHz Enable Brown out Detection a Reset instead of random behavior when voltage drops Disable JTAG a We re using those pins for motor control Disable erasing EEPROM on program download a EEPROM can be used to store values that our program uses a We usually don t want to erase those values just because we have a new program 1 1 3 2005 Topics a Atmel ATmega16 has 32 pins that can be used for inputs and outputs a We re gonna learn how to use them a General overview not language specific a Flash green LED Read bumper state a Control motors Memory Types a Flash a Where the program is stored a Preserved when power is disconnected a SRAM a Memory used when the program is running a volatile data stored here is lost when power is disconnected EEPROM a Memory available for non volatile storage Input Output Overview a 32 1 0 pins in ATmega16 Divided into 4 registers A B C and D a Each 8 bit register corresponds to 8 input output pins a Chip connections are identified with PAO PA1 PAZ PBO PB7 PCO PC7 PDO PD7 a For example the green LED is connected to PB4 Each I O pin is controlled separately a Data Direction input or output is specified with a DDR register a Outputs use a PORT register a Inputs use a PIN register 19 ATmegal6 Programming Controlling the Green LED Connected to PB4 a Wired so that it is
5. 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 cc 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 O 5 z p 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 e 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 e Plug the left light sensor wires into the LF sockets using the same color order as above
6. e 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 e 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 1 1 3 2005 ATmegal6 Programming ATmega16 Programming Part 1 Atmel ATmegal6 Programming Part 1 Cathy Saxton Larry Barello Jim Wright Terms m Bit can have a value of 0 or 1 a I O pin for input output of data a Corresponds to one bit a 0 value corresponds to a low voltage a 1 value corresponds to a high voltage a Byte 8 bits Register how we communicate with the microprocessor each register is one byte Fuse Bits Fuse Bits are used to customize the microprocessor We will change the default value for four fuse bits
7. ADC Start Conversion ADSC signal in the ADC folder Control and Status Register A ADCSRA to 1 to start the conversion Wait until the ADC Interrupt Flag ADIF signal in ADCSRA is 1 indicating that the conversion is complete Read the value from ADCH and possibly ADCL Analog Input Electronics Analog Input Electronics le is current through LED Voltage level for ADC is determined by phototransistor and I 4 k resistor a Maximum 50 mA Phototransistor exhibits a resistance based on the amount of a Using a 180 Ohm resistor light it sees a Eyr a high resistance in darkness PAZ 7380 ohm a lower resistance in presence of light 28 mA good When phototransistor I I exhibits a low resistance ADC is pulled toward GND As phototransistor s resistance increases so does ADC s voltage level R of 4 7k would put ADC input at half of V Programs a See the Sample Programs section of the SRS Robot Level 1 Kit Manual a Program 4 HelloWorld a Program 5 InputChar InputText a Program 6 ADCPrint a RemoteControl 22 1 1 3 2005 ATmegal6 Programming Part 3 Atmel ATmegal6 Programming Part 3 Cathy Saxton Tom Saxton Larry Barello Jim Wright Terms a Interrupt a Action that puts normal processor operation on hold to handle an event then returns to the main process a Agood way to be notified of interesting events Reading from EEPROM Details a Wait until E
8. Key part number ATAVRISP ND for 29 e a USB port with a USB to serial converter and an AVR ISP programmer USB to serial converters are available from a variety of places including Fry s Electronics the AVR ISP can be purchased from Digi Key part number ATAVRISP ND for 29 To communicate with the robot you will need either e a DB 9 serial port or e a USB port with a USB to serial converter Recommended Equipment The robot is powered with 6 AA batteries which are not included in the kit We recommend rechargeable batteries NiMH or NiCd The following items will be necessary or useful for construction Please bring as many of these items as possible to the workshop sessions There will be a small quantity available to use during the workshop e Safety glasses e Scissors e Soldering iron e X acto knife e Solder e g 60 40 0 032 dia rosin core e Ruler solder Radio Shack 64 005 e Small file for smoothing circuitboard edges e Wire cutter stripper e Masking tape e Side cutters for trimming leads on soldered e Pen for writing on masking tape components e Multimeter e Needlenose pliers e Cardboard scrap is fine e Pliers e Magnifier may be useful e Small screwdrivers Phillips and slotted e Extension cord power strip may be helpful at e Small adjustable wrench the workshops 2 11 3 2005 Kit Contents 1 1 3 2005 Kit Contents Level 1 Kit Anti Static Bag Item Qty Vendor Part Fairchild QRB1134 light sens
9. S9002 ND shrink tubing 3 32 x 1 2 2 Digi Key FP332K R50 ND cable tie I Jameco 126543 velcro 1 2 x 2 loop adhesive back McMaster Carr 9273K173 mounting square double stick square 2 Make An Impression Hardware Bag Item Qty Vendor Part 6 32 x 1 5 standoff F F 1 4 OD 3 McMaster Carr 91780A337 4 40 x 1 standoff F F 1 4 OD 4 McMaster Carr 91780A167 4 40 x 1 2 standoff F F 3 16 OD 4 Digi Key 1893K 4 40 x 1 4 round standoff F F 1 4 OD 2 Digi Key 3478K 6 32 x 3 8 machine screw 6 McMaster Carr 90272A 146 4 40 x 1 machine screw I McMaster Carr 90272A115 4 40 x 1 2 machine screw 4 Digi Key H346 4 40 x 1 4 machine screw 18 McMaster Carr 90272A106 2 56 x 1 machine screw small wood screw in motor if not here 4 40 nut 2 56 nut 4 flat washer 4 lock washer 2 lock washer Loose Item 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 insulated copper wire 7 Kit Contents McMaster Carr McMaster Carr McMaster Carr McMaster Carr McMaster Carr McMaster Carr Go 2 Go Q L Qty Vendor Pololu Solarbotics Pololu Jameco McMaster Carr Jameco Jameco Barello net McMaster Carr NO NO RR BRN NR ARC Board Connection Kit This optional add on kit provides parts to terminate sensor wires and align them In housings for easy connectio
10. Z ONS gt s 989 d Zid 089 ra al dStSsseasly godc lt axa R 1331 IQdeOX 12 ZOdCBLNID a SOdCTLNID g badcat SOdrg0 90d dII gt 20d 230 83d Tad dd edd bd Gdd SIdcTasal gt 2ddIs0Ll gt aN ds gad Tad TL ZAdGNI IDT 8d ININ IT aN9 bad Ss ar o5 Gad ISOW 98d OSI 28dO138 gud 830u Ted 190 gt Zed ZIOY bed E004 Sa bud 00H z gud Gady ox sud G30Y a s a ONS 24d 2904 isa n ing NI not 0 gt ds oot Se t LLEBCWT Sar nSt AEE Ta Aa wwe ABO dg FORNT AZT O Elder 430d 11 3 2005 34
11. a ON when PB4 outputs a low voltage 0 a OFF when PB4 outputs a high voltage 1 a Set PB4 as output a Set bit 4 in DDRB Port B Data Direction Register a Value of bit 4 in PORTB controls LED a Clear this bit to 0 to turn on LED a Set this bit to 1 to turn off LED Controlling Motors a Library functions a Control left and right motors separately a is stop 255 is full speed forward 255 is full speed backward a H bridge chip controls motors a Direction a Left PC3 right PC4 Low 0 for forward high 1 for reverse a Speed Left PD4 OC1B right PD5 OC1A a Pulse Width Modulation PWM Resources 20 a Atmel s documentation for the ATmega 16 microprocessor a Free download from www atmel com BASCOM BASIC a Installed into BASCOM AVR DEMO Bascavr hip from Contents see BASCOM Developing Order Language Fundamentals and AVR Internal Hardware WinAVR C C a Installed into doc avr libc a avr libc user manualindex htm a avr libc user manual 1 0 4 pdf Reading Bumpers Connected to PAO and PA Touch sends low signal 0 a Touch connects the two wires connecting signal to ground a Input tied high with a pull up resistor indicating 1 when no touch Set PAO and PA as input a Clear bits 0 and 7 in DDRA Activate pull up resistor for PAO and PA a Set bits 0 and 7 in PORTA Value of bits 0 and 7 in PINA indicate touch a QO indicates a touch bump a 1
12. 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 1s 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 Ola 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 Ola 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 buildi
13. 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 ts 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 1s 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 What happens when you use 128 for the left motor PWM and 255 for the right motor PWM What happens
14. indicates normal no touch state Pulse Width Modulation Controls motor speed by pulsing power to motor a Doesn t sacrifice torque like reducing voltage would Speed is proportional to the width of each pulse half speed faster 80 of full speed slower 30 of full speed Programs a See the Sample Programs section of the SRS Robot Level 1 Kit Manual a Program 1 FlashLED FlashLEDAlias a Program 2 Whisker WhiskerAlias a Program 3 PWM a BumpNGo 1 1 3 2005 ATmegal6 Programming Part 2 Topics Atmel ATmegal6 Programming Part 2 Cathy Saxton Larry Barello Jim Wright Terms a Digital a Two possible values 0 and 1 a 0 value corresponds to a low voltage a 1 value corresponds to a high voltage a Analog a Range of values e g from 0 to 255 a Corresponds to a voltage level a Interpreted with an Analog to Digital converter Serial Communication Details See the Atmel doc for details on setting baud rate data bits parity etc Transmit and receive are enabled separately a Set TXEN and or RXEN in the USART Control and Status Register B UCSRB Transmit one character at a time a Wait until the USART Data Register Empty UDRE signal is 1 indicating that previous communication is complete a Set USART I O Data Register UDR to value to transmit Receive one character at a time a If USART Receive
15. 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 G 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
16. one side 1 4 40 x 1 4 round standoff 1 4 40 x 1 4 screw 2 4 40 x 1 2 screws 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 u 4 4 40 x 1 2 standoffs 4 4 40 x 1 4 screw
17. options or give feedback All pins are available from the expansion headers refer to the schematic for more details In addition one pin 1s 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 Pair label IO port 9 JA impu Pinb 6 MISO T a E Fin 756K r C Prog LED Input Output Pinb 4 Portb 4 Poff Output Portb 5 MOSD Options I O port assignments Program LED output The program LED output ts 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 1 1 3 2005 33 AVR Robot Controller 1 1 Schematic AVR Robot Controller 1 1 Schematic 1buoq Tet4es D 2 1 f Niza inozy O SLR Lalu We ind l NIZL Sar AnOtl NITL Y i 83 O SDePABIUT TETUSS Ac 1 G aNg u Az GND TONS Ea 3 g I g PTA 8190 Ras Won N32 1I Bs nGt ctac ee LLL AEE AE m m gl
18. 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 Sig V Gnd 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 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
19. 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 coml 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
20. to inputs of the H bridge on the ARC board a OC1A alternate function of PDS controls the speed for the right motor a OC1B alternate function of PD4 controls the speed for the left motor Line Following Algorithms a Simple Version a Watch for losing the line on either side a Turn to recover line a Results in noticeable wiggle Timer Counter Details Count from 0 255 using Fast PWM waveform generation mode frame width 256 units Example Run the right motor forward at 80 of full speed a Right motor is connected to OC1A a Set Output Compare Register OCRIA to 205 80 of 256 a Set the Compare Output Mode to set OC1A at the beginning of the frame when the counter wraps from 255 to 0 and clear OC1A when the counter matches OCRIA Line Following Algorithms Better Version a Read Larry Barello s paper a http Avww barello net Papers LineF ollowing index htm a Try to keep sensor readings balanced a Steering correction proportional to difference in sensor readings a Once it s tuned no more wiggling a Only one state Programs a See the Sample Programs section of the SRS Robot Level 1 Kit Manual a Program 7 EEPROM a Program 8 Timer a Program 9 LineFollow 1 1 3 2005 25 ATmegal6 Programming Part 4 State Machines Atmel ATmegal6 Programming Divide complex task into small pieces Each piece quickly handles a case or stat
21. 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 1s 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 QO DIP sockets and voltage regulator In this step you will install 40 pin DIP socket 2 16 pin DIP sockets 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
22. 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 1 1 3 2005 29 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 le
23. when you use 100 for the left motor PWM and 100 for the right motor PWM Flash the LED once a second for five or three seconds before starting Wait for a bumper touch instead of delay before starting the motors Make a bumper touch cause the robot to back up then stop Make the robot go forward 10 inches then turn left 90 degrees Make the robot do the previous extension 4 times O O O O O O O 28 11 3 2005 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 1s 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
24. 1 1 3 2005 SRS Robot Level 1 Kit Table of Contents Getting Started ccccecessessssssssseseseeesesseeeeeeeeeseeeeeeeeeeeeeeeeeeeeeesseeseeassasssgasssssaaassaaaaagaas 2 Computer Requirement cccccccessessssesssseseeeeeeeseeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeees 2 Recommended Equipment 2 Kit Contents a 3 AVR Robot Controller 1 1 Assembly Instructions 5 AVR Robot Controller 1 1 Software Tools 10 Chassis ASSCMDLY cccccccssssssssssssssessesseeseeseesseeseeeeeeeeeseeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeees 14 W lili NAS OIS ezespen inate st sesoe eae daa stseasoceeea ge ossemseeseaee aero ees 18 ATmegalo Profra se ere eee eee ne ee eee 19 Silili l Pi m a ee ee ee ee ee ee nee ee Renn ee ee eee eee eee er 27 AVR Robot Controller 1 1 Hardware Description 31 AVR Robot Controller 1 1 Schematic 34 AVR Robot Controller O 2002 2005 Larry Barello www barello net Chassis design 2004 2005 Cathy Saxton www idleloop com The content of this document is 2004 2005 Cathy Saxto
25. Complete RXC signal is 1 there is data in the receive buffer a UDR contains the next character 1 1 3 2005 a Serial communication a Sending data to PC a Getting commands from PC a Analog input a Reading light sensor values Serial Communication Helpful for debugging sending commands s ATmega16 provides support for Universal Synchronous and Asynchronous serial Receiver and Transmitter USART Uses the alternate functions of PDO and PD1 a RxD PDO for receive a TxD PD1 for transmit s RS232 driver on ARC board converts between TTL chip voltage level and RS232 voltage level used by PC s serial port Analog Input ATmega16 provides an Analog to Digital Converter ADC AO A7 have alternate functions as ADCO ADC7 for analog inputs The ADC can be used to read the value voltage level from any ADC input and convert to a value from 0 1023 Light sensors are connected to ADC1 left and ADC3 right 21 ATmegal6 Programming Analog Input Details Analog Input Electronics a The Analog to Digital Converter needs to be Fairchild QRB1134 light sensor initialized before conversions are done a Select the precision 8 bit or 10 bit a Infrared IR LED emitter a Select the reference voltage e g 2 56V 5V a See the Atmel doc for details a Phototransistor sensor Only one input can be converted at a time s ik tat ADCO 7 a QRB113x PhotoTransistor pdf in Datasheets Set the
26. EPROM Write Enable EEWE signal in EEPROM Control Register EECR becomes 0 can t read while write is in progress a Write address to EEPROM Address Register EEAR a Set EEPROM Read Enable EERE signal in EECR a Read data value from EEPROM Data Register EEDR 1 1 3 2005 Topics EEPROM memory access a Reading and writing the on chip EEPROM a Timer Counter use a Timing activities a Controlling PWM a Programming algorithms a Line following Writing to EEPROM Details Wait until EEPROM Write Enable EEWE signal in EEPROM Control Register EECR becomes 0 indicating ready to write Write address to EEPROM Address Register EEAR Write data value to EEPROM Data Register EEDR a Set EEPROM Master Write Enable EEMWE signal in EECR Set EEPROM Write Enable EEWE signal in EECR Some timing issues see Atmel documentation for details Using a Timer Counter for Timing a Timer Counter 0 is convenient as a timer a Value changes at a specific rate Delay loop isn t as good a Inaccurate because it can t compensate for interrupts that take processor time 23 ATmegal6 Programming Timer Counter Details Timer Counter Details Timer Counter 0 setup a Using Timer Counter 0 See the Atmel doc for details on making these settings a Increment variable when get compare match Clock source determines counting speed interrupt a Aprescaler that divides the controller s 8 MHz by 1024 w
27. 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 QO Switch and resonator In this step you will install switch 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 ATmegal6 has an internal 1 2 4 or 8 E Y MHz oscillator In addition 1t can operate with an external source of up to Tolkanje 22 16MHz which this resonator provides regulator NF 5 i 1 1 3 2005 7 AVR Robot Controller 1 1 Assembly Instructions Q 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 2x5 male header shorting jumper ATA wT sockets BEB SSS SSB SB SSB SBSBSESB BES SE 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 PAs shorter end of the pins inserted into the board Install the 1x3 pin headers in the locations marked JP5 serial communications 27 I Lx am i JP13 power and servo Install the 2x3 pin headers motors eT 2 MOANN M at the back of the boar
28. O Right distance sensor Level 2 PAT Left light sensor PAI Center light sensor not included with kit PA2 Right light sensor PA3 Left motor direction PC3 Left motor PWM PD4 Left motor channel A encoder Level 3 PD3 Left motor channel B encoder Level 3 PC2 Left servo not included with kit PC2 Right motor direction PC4 Right motor PWM PD5 Right motor channel A encoder Level 3 PD2 Right motor channel B encoder Level 3 PCS Right servo not included with kit PCS Serial input PDO Serial output PD1 Green program LED PB4 Option A PB6 Option B PB7 Option C PB4 1 1 3 2005 Functional Name PAO PA7 ADCO ADC7 ADC1 ADC2 ADC3 PC3 OCIB INTI PC2 PC2 PC4 OCIA INTO PCS PCS RXD TXD PB4 PB6 PB7 PB4 Input Output input input input input input input input output output input input output output output input input output input output output Header LEFT at front of board 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 JPS JP5 PROG green LED ISP JP9 A ISP JP9 B ISP JP9 C 31 AVR Robot Controller 1 1 Hardware Descr
29. 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 ATmegal6 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 ATmegal6 Functional Name indicates how each connection is used in the programs Input Output describes the communication direction as viewed from the ATmegal6 Header is the text identifying that connection on the board See the schematic for pin details Physical Connection Pin Left bump sensor PAO Right bump sensor PA7 Left distance sensor Level 2 PA
30. a Ku Ua Finished Serial Connector 11 3 2005 9 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 programming adapter PCB 3 330 ohm resistors orange orange brown 2x5 pin right angle header 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 th
31. at 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 e 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 1 1 3 2005 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 WorkshopRobo
32. at tt 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 e 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 th
33. ations so that you can find them later I 4 lt O OQ1O L 3 O gt N ay s Soldering Overview The ARC can be assembled using a fine tip 25 40wt w soldering iron thin 60 40 rosin core solder flush side cutters and a pair of small needle nose pliers Additional a items that are useful are a solder tip cleaner damp sponge s or cloth paste solder flux and a small gauge wire stripper dll cana EER EEKE 18 26 Because it is fairly small you need a well lighted Spo rsi A Let rx ikur area to work in A magnifying glass might be useful for Te 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 1 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 sec
34. 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 QO Resistors and diode The picture on the right shows the locations for 3 180 ohm resistors bro
35. botControl Technical support applications code fragments documentation design files http www mcselec com The BASCOM compiler and various application notes can be found here http www avrtreaks net Discussion groups sample code and projects avr gcc C compiler http sourceforge net projects winavr Download site for the WinAVR suite of development tools including GNU avr gec C C compiler and AVRDUDE downloader http winavr sourceforge net Home page for the WinAVR suite of tools http www eecs berkeley edu mseeman resources macmicro html 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 http savannah nongnu org projects avr libc Detailed info on the free AVR tools is located on the site for the AVR runtime library 1 1 3 2005 13 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 e Anti Static Bag QRB1134 light sensors e Electro Mechanical Bag velcro mounting squares shrink tubing and rubber bands e Hardware Bag everything except the four 1 standoffs and eight of the 4 40 x 1 4 machine screws e Loose items everything except the 4 conductor cable and ribbon cable Remove the paper from the twelve chassis pieces The Level kit contains the chassis parts needed for all
36. d in the locations marked LEFT and 1 RIGHT Install the 2x5 pin header programming in the location 265 KS e Wg marked JP9 header headers j P tr th 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 O 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 wi
37. d 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 lt Hardware 3 6 32 x 3 8 machine screws 2 small wood screws k 4 4 40 x 1 4 screws W 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 1 1 3 2005 17 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 lt
38. e Part 4 Control moves from one state to another Say Saxton Logic can be event driven Tom Saxton a Algorithm can be one piece of a program Larry Barello without knowledge of other pieces Jim Wright State Machine Advantages State Machine Examples a It s easier to read and maintain small well Sumo robot logic defined pieces than one huge spaghetti pile Mechanics of following lines in a maze Fast and interruptible Parsing incoming serial data possibly inside Works well with other simultaneous interrupt handler processes like data collection Data driven algorithms like dead reckoning Sumo Robot States Junction Detection a Start maneuver a Follow straight line Rotate and scan a Scan junction Have target robot in sight Pass result to maze navigation logic Have target robot centered Approaching target Push to the white ring a Back away from white ring 26 1 1 3 2005 Sample Programs Making a Turn a Drive forward to center wheels over junction m Turn fast a Slow down to catch line a Forward slow to get centered on line a Follow straight line Table Driven Algorithms a Data is smaller than code a Write a state machine to follow instructions a Then encode instructions a Example dead reckoning for FIRST 2004 Instructions forward n ticks turn n ticks a Independent from data collection code Dead Reckoning a Data stored in table a Speeds f
39. ers 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 serial adapter PCB the one with Gnd Tx Rx labeling DB9 solder cup 3 4 conductor cable 3 female crimp pins 1x3 connector housing cable tie Q 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 Ooo Q Insert the crimped pins into the connector housing The pins should snap into place when inserted correctly Q 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 Q Solder the DB9 connector to the board paying attention to the orientation so each solder cup covers a pad Q Solder the wires to the board referring to the socket connector to determine which color wire to use for each signal QO Fasten the cable to the board using the cable tie This provides strain relief s
40. ft 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 AVR Robot Controller 1 1 Hardware Description AVR Robot Controller 1 1 Hardware Description The Level 1 Robot Kit ships with an ATmegal6 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 www atmel com for a list and descriptions of available devices Power
41. ill result in a counter running at 8 kHz a This counts milliseconds CTC Clear Timer on Compare Match waveform i i imi generation mode a Wait function can use count for accurate timing OCRO specifies match value which resets counter to 0 a Remember current value then compare later for a An OCRO value of 8 causes a match every 1 millisecond elapsed time sepals Weta period of sll eka ik ap Lets other processing occur simultaneously with timing Set Timer Counter 0 Output Compare Match Interrupt Enable OCIEO in Timer Counter Interrupt Mask Register TIMSK Measure time required to perform a task Set the I bit Global Interrupt Enable in the Status Register a Watch for time limit e g for end of line maze run or to SREG to enable interrupts change behavior when looking for a sumo robot Motor Control Using an H bridge Pulse Width Modulation PWM Motor control is done through an H bridge Motor motion is determined by voltage applied at a The H bridge receives low power inputs from inputs the microcontroller Positive on one input and ground on the other will turn the i motor in one direction a Direction and speed PWM for each motor Swapping power and ground will turn the motor in the other a The H bridge sends high power outputs to direction drive the motors Applying the same voltage either power or ground to both a Each input to the H bridge controls one inputs will cause the motor to stop connect
42. ion to the motor Using PWM sends power and ground for the a Ahigh input will connect the motor to power duration of the pulse width then sets both inputs to a A low input will connect the motor to ground the same level until the next pulse starts Pulse Width Modulation PWM Pulse Width Modulation PWM Moving forward Moving backward a We send a low 0 value for the direction signal that results a We send a high 1 value for the direction signal that 24 in one input of the motor being connected to ground a The PWM signal controls the other motor input When the PWM signal is high the motor turns When the PWM signal is low the motor stops a So the PWM signal needs to be high for the width specified then low until the next pulse starts the image below shows an example that will run the motor at 80 of full speed results in one input of the motor being connected to power a The PWM signal controls the other motor input a When the PWM signal is low the motor turns a When the PWM signal is high the motor stops a So the PWM signal needs to be ow for the width specified then high until the next pulse starts the image below shows an example that will run the motor backward at 70 of full speed 1 1 3 2005 ATmegal6 Programming Using a Timer Counter for PWM Timer Counter 1 can be used to automatically create the appropriate waveforms on two Output Compare pins a These outputs are connected
43. iption 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 I 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 753 position feedback or variable input FBU GND 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 7
44. k resistors The resulting circuit is similar to the Left and Right analog inputs and allows 5v powered sensors to be connected to the board GND 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 Motor Motor Ch A 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 Right Motor DIR Porte3 Ported Portd 4 OC1B Portd 5 OCIA Pind 3 INT1 Pind 2 INTO CH B ChB V Gnd 32 1 1 3 2005 AVR Robot Controller 1 1 Hardware Description R C servo
45. ll need battery holder 2 female crimp pins 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 ee e 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 1 1 3 2005 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 head
46. n and Larry Barello Getting Started Getting Started Congratulations on your purchase of a Seattle Robotics Society Level 1 Robot Kit Here are suggested steps for getting your robot assembled and running Read through the Computer Requirements and Recommended Equipment sections to be sure you have the materials you need Compare your kit s parts with the lists in the Kit Contents section to verify that you can correctly identify each of the parts in the kit The sections after that work well as a tutorial with step by step instructions for assembling the controller board and chassis guidance for setting up the programming software on your computer explanations of the basics of programming the Atmel ATmegal6 microcontroller and an introduction the programs The programs themselves contain comments to explain the concepts in more detail The sections at the end AVR Robot Controller 1 1 Hardware Description and AVR Robot Controller 1 1 Schematic are included for reference Computer Requirements To program the robot you will need one of the following connections e a DB 25 parallel port this will work with the programming cable included n the kit 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 e a DB 9 serial port and an AVR ISP programmer the AVR ISP can be purchased from Digi
47. n to the board sockets The default kit has wires tinned and inserted directly into the sockets Item Qty Vendor Part 1x3 1 pin housing 2 Jameco 157382 1x4 1 pin housing 3 Jameco 100802 male crimp pin 20 Jameco 145357 Vendor Information Digi Key http www digikey com Jameco http www jameco com Barello net http www Barello net Commerce McMaster Carr http www mcmaster com Pololu http www pololu com Solarbotics http www solarbotics com Samtec http www samtec com Future Electronics http www future active com Mark III Robot Store http www junun org MarkITI Make An Impression http www makeanimpression net B G Micro http www bgmicro com All Electronics http www allelectronics com 4 91772A086 90480A005 90480A003 92141A005 91113A005 91113A003 Part GM amp 8PW 0066 216215 94905K33 31860 135538 8073K64 1 1 3 2005 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 e Anti Static Bag everything except the QRB1 134 light Sensors e Electro Mechanical Bag everything except the velcro E lt o mounting squares shrink tubing and rubber bands lt e Loose items the battery holder 4 conductor cable and ribbon cable It is recommended that you return unused items to their original loc
48. ng 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 1f 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 Levell 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 Ola FlashLED
49. onds 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 1 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 1 1 3 2005 5 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
50. or closed based on the state of the left bumper Challenges o Print text once a second until either bumper 1s 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 P 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
51. or 2 Digi Key QRB1134 ARC 1 1 PCB I Barello net ARC 01 ATMEGA16 16PC microcontroller I Digi Key ATMEGA16 16PC ND TI 754410 H bridge l Digi Key 296 9911 5 ND RS232 driver I Future Electronics SP232ACP LM2940CT 5 0 voltage regulator I Future Electronics LM2940CT 5 0 ZTT 16 0MX ceramic resonator I Digi Key X908 ND red LED I Digi Key 160 1708 green LED I Digi Key 160 1710 47 uf 16v electrolytic capacitor 3 Digi Key P11196 ND 1 uf ceramic Z7T 1 capacitor 8 Digi Key P4924 ND diode 1A I Digi Key 1N4001GCT ND 180 ohm 1 8 W resistor brown gray brown 3 Digi Key 180EBK ND 330 ohm 1 8 W resistor orange orange brown 3 Digi Key 330EBK ND 680 ohm 1 8 W resistor blue gray brown 2 Digi Key 680EBK ND Ik ohm 1 8 W resistor brown black red 2 Digi Key 1 OKEBK ND 4 7k ohm 1 8 W resistor yellow violet red 3 Digi Key 4 7KEBK ND Electro Mechanical Bag Item Qty Vendor Part 40 pin DIP socket I Jameco 112310 16 pin DIP socket 2 Jameco 112221 DB25 solder cup male I Jameco 15114 DB9 solder cup female I Jameco 15771 10 contact IDC socket connector 2 Jameco 32491 1x3 1 boardmount socket 2 Samtec SSW 103 01 T S 1x4 1 boardmount socket 3 Samtec SSW 104 01 T S 1x3 1 male header 3 Jameco 103341 2x3 1 male header 2 Jameco 115035 2x5 1 male header I Jameco 67820 2x5 1 right angle male header I Jameco 203932 1x3 1 connector housing 2 Jameco 157382 female crimp pin 7 Jameco 100765 switch SPDT PCB mount I Digi Key EG1903 ND 1 shorting Jumper I Digi Key
52. or motors a Time m Code uses data a One row in table at a time Program stores data in Flash memory a Saves SRAM space a Requires copying from Flash before use Programs a See the Sample Programs section of the SRS Robot Level 1 Kit Manual a Program 10 Junction a Program 11 Turn a Program 12 DeadReckon Sample Programs There are sample programs available from http www seattlerobotics org WorkshopRobot Levell 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 ATmegal6 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 1 1 3 2005 2 Sample Programs A good way
53. s Insert the screws through the highlighted holes from G 5 underneath sticking up through the plate O O O O 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 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 a You will mount this to what is T a the underside of the top plate which is now face up since you flipped it over Stick the two mounting squares O l onto the battery spacer Then I flip the spacer over and attach it o 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 towar
54. t Levell 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 OlaFlashLed 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 1s 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
55. t 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 0O 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 http www seattlerobotics org WorkshopRobot Level1 Home page for the SRS Robot Level 1 Kit with links for sample code data sheets etc http www barello net ARC AVR Robot Controller resource page user guide and sample code http www atmel com atmel products prod23 htm Assembler Simulator Application notes software http groups yahoo com group A VRRo
56. 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 e Launch a Command Prompt from the Programs menu choose Accessories then Command Prompt e At the prompt type cd c WinAVR bin and hit Enter e Then type install giveio and hit Enter e 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 Levell or the Workshop CD s Samples folder to a convenient place on your hard drive 1 1 3 2005 11 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
57. wn gray brown 3 4 7k ohm resistors yellow violet red 2 Ik ohm resistors brown black red 2 680 ohm resistors blue gray brown 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 680 Ieo 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 1 1 3 2005 AVR Robot Controller 1 1 Assembly Instructions Q Small capacitors and LEDs The picture on the right shows the locations for 8 0 luF capacitors red LED green LED Orientation of the small capacitors is not important Note that one of the capacitors second from the top will be

Download Pdf Manuals

image

Related Search

Related Contents

dati tecnici  For more information on any of these tools, visit www.otctools.com 3  

Copyright © All rights reserved.
Failed to retrieve file