Contents: Section 1 Section 2 Section 3 Section 4 Section 5 Section 6 Section 7 Section 8 Section 9 Section 10 Section 11 Appendix A Appendix B Appendix C General Information Competition Aim Soldering the PCB PCB Assembly Adding the Motor/Gearbox Power Supply Serial Cable and Software Inputs Additional Outputs Motor Outputs Sample Program Circuit Diagram Using Microswitch Bumpers Using the SRF05 Ultrasonic Range Finder 1: General Information This datasheet provides technical information on how to use the PICAXE vehicle chassis/control PCB as provided within the Toyota STEM Challenge pack. This datasheet should be used beside the main Toyota STEM Challenge Handbook. This datasheet presumes basic knowledge of the PICAXE system. If you have never used the PICAXE system before, please read the PICAXE manuals, available online from the manuals section of www.picaxe.co.uk. The tutorial provides an introduction on how to use the PICAXE chips and the free Programming Editor software. The control PCB for the challenge pack is supplied in self assembly kit form (see section 4 for assembly instructions). The control PCB contains the PICAXE-18M2 microcontroller, which acts as the brain of the vehicle. The PICAXE-18M2 microcontroller can be programmed on-board by simply connecting the download cable (provided) into the socket. The user can then develop their own simple BASIC or flowchart control program using the free PICAXE Programming Editor software, available free from www.picaxe.co.uk. 2: Competition Aim The aim of the competition is to build a vehicle that can move around a track in the shortest time possible. As there will be a number of obstacles on the track, the vehicle must be able to detect obstacles in it s path and adjust it s movement accordingly. See the separate competition handbook for the full competition rules. This datasheet provides general information about the PICAXE board used as the chassis and brain of the vehicle. It does not provide complete programs or solutions, as that is the responsibility of the competition entries. Selecting different hardware (e.g. motors and gearboxes), testing different sensors and writing the PICAXE control programs are all part of the design challenge. For further information on how to use the PICAXE system please refer to the extensive documentation at www.picaxe.co.uk. Rapid Electronics Ltd
2 TOYOTA STEM Challenge 3: Soldering the PCB The printed circuit board (PCB) is specially manufactured with a solder resist layer to make it simpler to solder. This is the black lacquer layer that covers the tracks so that the solder does not stick to these tracks. However for successful assembly the PCB must be carefully assembled and soldered. When soldering always make sure the solder iron tip is hot and clean. To test if it is hot enough try to melt a piece of solder on the tip. The solder should melt almost instantly. Then clean off the melted solder by wiping the tip on a damp sponge. Remember that solder will only stick to hot surfaces. Therefore never melt the solder on the soldering iron tip and then try to drop it onto the joint this won t work as the joint will be cold and so the solder won t stick. To successfully solder you must hold the soldering iron in one hand and the solder in the other. Therefore make sure the board is held on the table so it won t move (e.g. use a bulldog clip or get someone else to hold it for you). Steps to soldering: 1: Clean the soldering iron tip on the damp sponge. 2: Press the soldering iron tip against the pad on the PCB AND the leg of the component. Count to 3 to give the joint time to warm up. 3: Keep the soldering iron in position and touch the solder against the joint. Allow enough solder to melt to cover the joint. 4: Take the solder away first, then the soldering iron. 5: Allow the solder to cool for about 5 seconds before trying to move the board. After each joint is made make sure it does not accidentally bridge across to other joints. However be aware that some solder joints (e.g. on the two sides of the PICAXE download socket) have two wires very close together that are already connected by a track (line) on the PCB. In this case it does not matter if the solder joins together. Tips! 1: Always start with the smallest components like the resistors. Then move onto larger components like the IC socket and then finish with the tall components like capacitors and transistors. Do not try to put all the components in position at once, only do two or three at a time. 2: Always make sure that the components lie flat on the board before they are soldered. When using components with long legs like resistors and LEDs, bend the legs so that the component is held firmly in position before soldering. 3: Make sure the PICAXE stereo download socket snaps into position flat on the board before it is soldered. 4: Make sure that the components that only work one way around (LEDs, diodes, transistors and capacitors) are correctly aligned before soldering (see the marks on the PCB). 5: Piezo sounder wires are very thin. Make sure you do not overheat them or they may melt. 6: Always thread the battery snap wires down and up through the two thread holes before soldering. This helps make a much stronger joint which is less likely to snap off.
3 4: PCB Assembly 1: Place the six wire links ( resistors marked with a single black band) in the positions marked LK. Bend the legs to hold the resistors in position and then solder. 2: Place the six 10k (brown black orange gold) resistors in position and then solder. 3: Place the 22k (red red orange gold), 330 (orange orange brown gold) and 4k7 (yellow violet red gold) resistors in position and then solder. 4: Push the PICAXE stereo download socket CT1 onto the PCB and make sure it clicks into position (so that it lies flat on the board). Solder the five metal contacts (the five round plastic support post holes do not have to be soldered). Do not worry if the solder joins on the two metal contacts either side of the socket as they are supposed to be joined anyway. 5: Push the two IC sockets into position. Make sure the notch at one end of the socket is aligned correctly for each socket. Fold the legs over to hold the socket in position and then solder. 6: Solder the LED into position. Make sure the flat on one side of the LED aligns with the flat marked on the PCB. 7: Solder the push switch S1 in position (note that it only fits one way around). Solder the slide switch S2 in position (either way around). 8: Solder the 100nF (marked 104) capacitor C1 in position (either way around). 9: Solder the 220uF electrolytic capacitor C2 in position, ensuring the long positive leg is correctly aligned. 10: Solder the diode D1 is position, ensuring the silver bar end is correctly aligned. 11: Thread the battery clip down through one of the large holes by the letters 6V-POWER. Thread it back up through the other hole. Then solder the black wire in the hole marked BLK- and the red wire in the hole marked RED+. 12: Carefully check all the joints for faulty soldering or solder bridges. 13: Insert the two ICs into their sockets, ensuring they are correctly aligned. For detail on how to test the PCB see the sample program in section 11. Details on how to use the PICAXE Programming Editor software is available in the tutorials from www.picaxe.co.uk.
4 TOYOTA STEM Challenge 5: Adding the Motor/Gearbox Worm Drive Gearboxes When using worm drive gearboxes it may be necessary to cut down the output shaft before fitting to the chassis. Remember to cut a left and right hand version! 2-in-1 gearboxes When using 2-in-1 gearboxes these must be pre-assembled following the instructions supplied in the gearbox box (1:60 ratio). IMPORTANT NOTE: The motors have a small circle embossed in the plastic next to one of the two motor contacts. Ensure these dots both face towards the centre of the car PCB to ensure the motors turn as expected in the sample programs. Solar Motor Gearbox If desired, a more efficient solar motor gearbox pair may be purchased as an optional upgrade (part 70-2220). Careful choice of motor and gearbox can make significant performance increases to the vehicle. Wheel assembly Careful alignment in the construction of the gearbox is essential for success. Make sure the gears are all correctly aligned and lubricated well (e.g. with Vaseline). The small plastic wheels should be carefully pushed onto the gearbox output shaft, making sure the wheels are evenly aligned. Use the small rubber band as a tyre on each wheel. Connecting the gearbox to the PCB: 1 Solder the green motor suppression 220nF capacitors directly across the motor terminals. 2 Secure the gearboxes in position using M2.5 or M3 nuts/bolts as appropriate. 3 The gearboxes are connected to the PCB via wire links to the pairs of holes marked MA and MB. Note there are two sets of motor connection pads, either set can be used - use the set nearest to the contacts for the type of gearbox selected. 6: Power Supply The vehicle is designed to run from 6V via 4x AA alkaline cells (4 x 1.5V = 6V with alkaline cells, Rapid part 18-1452). Insert the cells into the plastic holder and then connect to the battery snap. DO NOT use a 9V PP3 battery with the vehicle). If using rechargeable cells, only 4.8V will be supplied to the vehicle, which will reduce the speed slightly (4 x 1.2V = 4.8V). 7: Serial Cable and Software For programming the vehicle, the PICAXE download cable connects into the socket provided on the control PCB. If your laptop computer does not have a 9 way serial port for the AXE026 download cable, a USB download cable (13-0849) is available separately. The Programming Editor software is used to program the PICAXE microcontroller on the control PCB to control the vehicle. This software is free and can be downloaded from www.picaxe.co.uk. Please see the Getting Started help file if you are unfamiliar with using this software.
5 8: Inputs The vehicle has 5 inputs. A 10k pull-down resistor is provided for each input on the PCB. Therefore the input switch can be simply connected between the two pads provided in each of the input positions. No other electronic components are required. Do not use input2 if you are also using the SRF05 Ultrasonic range finder as the range finder uses this input. 9: Additional Outputs The vehicle motors are controlled by outputs 4 to 7 (see motor control section). Output 3 is used by the optional SRF05 ultrasonic range finder. Outputs 0, 1 and 2 are available for general use, via the sets of pads at the rear of the vehicle. Each output set has two pads [0V ( ) and the output pin (+)]. Additional V+ and 0V connection pads (if required) are also provided beside the output connector pads. Adding an LED Solder a 330R (orange orange brown gold) resistor and LED between the pads. Switch the LED on and off by using high and low commands. Adding a piezo sounder (Rapid 35-0046) Solder the piezo positive (red) wire in the top hole and the black wire in the bottom hole. Use the sound command to generate beep sounds. Adding a radio control servo Solder a 330R (orange orange brown gold) resistor from the + pad to the servo yellow/white wire. Connect the servo black wire in position marked (the bottom hole). Connect the servo red wire to the separate V+ pad.
6 TOYOTA STEM Challenge 10: Motor Outputs The vehicle motor/gearboxes can be controlled to make the vehicle turn, and move back and forth. The motors are controlled by PICAXE output 4 to 7. The table shows how to control the direction of the robot. To move forwards use the command let pins = %01010000 To move backwards use the command let pins = %10100000 11: Sample Program This sample program starts vehicle going. If input2 or input6 is activated, the vehicle then reverses for 3 seconds, turns and then starts going fowards again. main: loop1: stopit: let dirsb = %11111111 set port B as outputs let pins = %01010000 buggy forward if input6 is on or input2 is on then stopit goto loop1 loop around let pins = %00000000 stop let pins = %10100000 reverse pause 3000 wait 3 seconds let pins = %10010000 turn pause 2000 wait 2 seconds goto main loop
7 Appendix A: Circuit Diagram
8 TOYOTA STEM Challenge Appendix B: Using Microswitch Bumpers The simplest way to detect obstacles is to use long-arm microswitches as bumper switches. Up to 5 inputs can be used (0, 2 at front of PCB, 1, 6, 7 at rear of PCB), but do not use input 2 if you are also using the Ultrasonic range finder SRF05. Required: long arm microswitch (Rapid 78-2408) 2 core connecting wire Assembly: 1: Remove control PCB from the vehicle. 2: Solder the 2 core connecting wire to the NO and C contacts of the microswitch (do not use the NC contact on the microswitch). 3: Solder the other end of the 2 core connecting wire to the appropriate input connector pads on the PCB. 4: Replace control PCB on top of vehicle. Sample program: This sample program stops the vehicle if input2 or input 6 is activated. main: loop1: stopit: let dirsb =%11111111 set port B as output let pins = %01010000 vehicle forward if input6 is on or input2 is on then stopit goto loop1 loop around let pins = %00000000 stop goto stop
9 Appendix C: Using the SRF05 Ultrasonic Range Finder The optional ultrasonic range finder (SRF05, Rapid 78-1085) allows the vehicle to detect obstacles in front of it. The ultrasonic range sensor detects objects in it s path and can be used to calculate the range to the object. It is sensitive enough to detect a 3cm diameter broom handle at a distance of over 2m. In use, the PICAXE sends a trigger pulse to the SRF05 unit (output 3), and then times how long the ultrasonic echo takes (input 2). This gives the distance to the nearest object. Connections for 2-pin Trigger/Echo Mode (SRF05 compatible) See the SRF05 datasheet for further information on how the module operates, www.rapidonline.com/toyota/downloads.htm Required: SRF05 module (Rapid 78-1085) 5-pin straight socket (Rapid 22-1754) 5-pin r/a header (Rapid 22-0710) Assembly: 1: Remove control PCB from the vehicle. 2: Solder the 5-pin socket in the position marked SRF05 on the control PCB. 3: Solder the 5-pin right-angle header to the SRF05 module, taking care not to overheat the small pads whilst soldering. 4: Replace control PCB on top of vehicle. 5: Push the SRF05 module into the socket. Sample program: This sample program stops the vehicle if an object is detected within 30cm. let dirsb = %11111111 set port B as outputs symbol trig = 3 Define output pin for Trigger pulse symbol echo = 2 Define input pin for Echo pulse symbol range = w1 16 bit word variable for range main: let pins = %01010000 vehicle forward loop1: pulsout trig,2 produce 20uS trigger pulse pulsin echo,1,range measures the range in 10uS steps pause 10 SRF05 mandatory recharge period now convert range to cm (divide by 6.2) and stop if there is an object closer than 30 cm let range = range * 10 / 62 multiply by 10 then divide by 62 if range < 30 then stopit stop if range is < 30 goto loop1 loop around if range is > or = 30 stopit: let pins = %00000000 stop