ESSENTIAL INFORMATION BUILD INSTRUCTIONS AN OVERVIEW OF HOW THE KIT WORKS BUILD AND PROGRAM YOUR OWN BUGGY WITH THIS Line Following Buggy Kit for the BBC micro:bit Version 1.0 Line Following Buggy Kit for the BBC micro:bit www.kitronik.co.uk/5604 Build Instructions Tools required: A small flat head screwdriver. A wire stripper. A soldering iron and some solder. A pair of pliers. A Phillips screwdriver. 1 SOLDER THE WIRES ON TO THE TWO MOTORS Using the four pieces of wire (red, green, blue and black) supplied with the chassis, strip and solder one end of each wire to each motor terminal (a small copper contact protruding from the end of the motor). This is done by putting the exposed wire through the hole on the contact and soldering into place. The colours should be as shown in the picture which are: Wire 1 on Motor 1 = White. Wire 2 on Motor 1 = Green. Wire 1 on Motor 2 = Blue. Wire 2 on Motor 2 = Black. 2 SECURING THE MOTORS Take two of the ‘T’ shape acrylic pieces, push one through the bottom of the board (start with the position shown in the image for Motor 1) and align the other one up the notch in the edge of the body of the buggy. Place the Motor 1 (green and white wires) between the two pieces with the motor terminals pointing toward the rounded corners of the buggy and the axle pointing outwards. Ensure that the motor is placed on the top side of the board. Push a M3 30mm Pozi Pan Machine Screw through the holes in the 'T' pieces and motor to secure it in place, and then fasten it with the M3 Full Width nut. Repeat this for Motor 2 (blue and black) on the opposite side of the buggy, then push the wheels onto the motor axles. Line Following Buggy Kit for the BBC micro:bit www.kitronik.co.uk/5604 CONNECTING THE MOTORS TO THE MOTOR DRIVER BOARD 3 Attach the Motor Driver Board to the top of the chassis using the M3 20mm Plastic Spacers and M3 6mm Machine Screws. Make sure the terminal blocks are facing the centre of the board. Take the wires from the motors and connect them to the terminal blocks on the motor driver board in the following configuration: Wire 1 on Motor 1 (White) goes into the 'P12' terminal. Wire 2 on Motor 1 (Green) goes into the 'P8' terminal. Wire 1 on Motor 2 (Blue) goes into the 'P0' terminal. Wire 2 on Motor 2 (Black) goes into the 'P16' terminal. The next task is to build the line following PCB. 4 PLACE RESISTORS Start with the six resistors: The text on the PCB shows where R1, R2 etc go. Ensure that you put the resistors in the right place. PCB Ref R1, R2, R8 & R9 R3, R4 5 Value 470Ω 2.2kΩ Colour Bands Yellow, Purple, Brown Red, Red, Red SOLDER THE IC HOLDER Solder the Integrated Circuit (IC) holder in to U1. When putting this into the board, be sure to get it the right way around. The notch on the top of the IC holder should line up with the notch on the lines marked on the PCB. 6 SOLDER THE POTENTIOMETER Solder R7, the variable potentiometer, in to the PCB where it is labelled R7. Line Following Buggy Kit for the BBC micro:bit www.kitronik.co.uk/5604 7 SOLDER THE LDR’S Solder the two Light Dependant Resistors (or LDR's for short) into the board where it is marked R5 & R6. 8 SOLDER THE RED LED’s The two red LEDs are designed to point out of the back of the board so you can see them when the board is attached to the buggy. The leads of the red LED's need to be bent 90° before they are soldered in to the board where it is labelled LED3 and LED4. The flat edge of the LED matches up with the LED outline on the PCB. Make sure the LEDs are soldered in the right way around. 9 SOLDER THE CLEAR LED’s Solder in the two clear LEDs (LED1 and LED2) directly into the board. These LEDs don't need to be bent but again make sure the flat edge of the LED matches up with the LED outline on the PCB. 10 INSERT THE IC Put the LM358 op amp IC into the holder labelled U1 ensuring the notch on the chip lines up with the notch on the PCB outline. Line Following Buggy Kit for the BBC micro:bit www.kitronik.co.uk/5604 11 LINE FOLLOWING CONNECTING WIRES Strip both ends of the blue, red, yellow and black wires and then solder one end of each the directly to the PCB as follows: Out 1 = Blue Out 2 = Yellow +v = Red 0v = Black Note: The terminal block supplied should not be used. 12 ATTACH THE LINE FOLLOWING BOARD TO THE BUGGY Placing the 4 x plastic Hex M-F Standoff’s between the chassis and the line following board, attach the line following board to the bottom of the chassis with the red LEDs pointing out from under the front of the buggy. Use 4 x M3 screws to fix the line following board to the Standoffs and 4 x M3 Full Width Nuts to secure the chassis to the Standoff's. Feed through the four wires from the Line Following Board through the hole in the middle of the chassis of the buggy. 13 CONNECT THE WIRES TO THE MOTOR DRIVER BOARD Connect the wires from the Line Following Board into the terminals on the Motor Driver Board for the BBC micro:bit as follows: 'Out 1' (Blue) goes into 'INPUT2 - P2' terminal. 'Out 2' (Yellow) goes into 'INPUT1 - P1' terminal. '+v' (Red) goes into 'INPUT1 - 3V' terminal. '0v' (Black) goes into 'GND' terminal. Line Following Buggy Kit for the BBC micro:bit www.kitronik.co.uk/5604 14 ATTACH THE BATTERY BOX Using the sticky pad, attach the battery pack to the top of the buggy chassis with the switch poking through the rectangular cut-out. Attach the red and black wires into the terminal on the Motor Driver Board for the BBC micro:bit labelled 'POWER'. Put the black wire in the left hand side of the terminal labelled 'BLACK' and the red wire in the right hand side of the terminal labelled 'RED'. 15 ATTACH THE CASTER Attach the caster to the rear of the buggy using 2 x 6mm M3 Machine Screws. Note: If the caster is supplied with any additional spacers these are not required. Line Following Buggy Kit for the BBC micro:bit www.kitronik.co.uk/5604 16 TEST CODE Download the code here: https://www.microbit.co.uk/lapexp. Now, let’s try the code out! Click on the red button labelled Edit and you will be taken to the code. Press compile and after a few moments the code should appear as a download in your browser. If you plug your BBC micro:bit into a USB port it will show up as a storage device. Simply drag and drop the .hex file you just downloaded onto the BBC micro:bit. The file might not show up on the BBC micro:bit in the file explorer but it is there! Once the file has been transferred (the light on the BBC micro:bit will stop blinking rapidly) remove the BBC micro:bit from your computer. 17 TEST SETUP On a white board or surface mark out an oval or similar shape using black insulation tape. Make sure the track is quite thick (roughly 2cms). Or alternatively draw the line on a large piece of paper using a black marker pen. 18 TRY IT OUT! Insert your coded BBC micro:bit into the connector on the Motor Driver Board for the BBC micro:bit (it can be inserted either way around) and switch on the buggy (with batteries in) using the on/off switch on the bottom. Your buggy should now be working. When one of the sensors on the Line Following Board passes over the black line it will cause the buggy to turn back towards the line. The red LED’s on the Line Following Board light up when the corresponding sensor passes over the black line and can be used for visual feedback when developing and testing your own code. Note: R7 on the Line Following board is used to adjust the sensitivity of the LDR sensors. It is adjusted by turning the trimmer dial with a small flat head screwdriver. Try starting with R7 in the central position and then adjust it if needed. Line Following Buggy Kit for the BBC micro:bit www.kitronik.co.uk/5604 Fault Finding If the buggy doesn’t work as expected then check the following: Check that the motor wires have been connected to the Motor Driver board as specified. Check that the batteries are not flat. Check the two power wires are connected the correct way around. Check the wiring between the Motor Driver board and the Line Following board has been made as specified. Check the bottom of the Line Following board to ensure that: All holes except the 4 large 3 mm mounting holes in corners are filled with the lead of a component. All these leads are soldered. Pins next to each other are not soldered together. Check the top of the Line Following board to ensure that: The notch on the IC holder / IC matches the outline on the PCB. The colour bands on R3 and R4 are red, red, red. The flat edge on all four LED’s matches the corresponding outline on the PCB. Finding Line Following Buggy Kit for the BBC micro:bit www.kitronik.co.uk/5604 How the Buggy Works - Overview Line Following Sensors Two Buggy Motors Motor Driver Board BBC micro:bit The outputs of the two line following sensors are fed, via the Motor Driver board, directly through to the BBC micro:bit. The Motor Driver board does not alter these signal in any way, but simply acts as a simple way of connecting the two parts together. The BBC micro:bit then decides what action should be taken depending on the state of the two LDR readings. Options could be choices such as, carry on forward, turn left, turn right or brake. To control the buggy the BBC micro:bit alters the state of four control lines connected to the Motor Driver board. There are two for each motor as follows (forward and reverse directions can vary depending on how the motors are connected): Line Following Buggy Kit for the BBC micro:bit www.kitronik.co.uk/5604 How the Line Following Board Works 5V R1 470Ω R2 470Ω R3 22k R4 22k + U1 L M358 L E D1 L E D2 R5 + - R6 R7 47k R8 470Ω R9 470Ω L E D3 L E D4 0V The two white LEDs (LED1 & LED2) on the left of the circuit are present to make sure that the light level remains consistent next to each LDR. The resistors (R1 & R2) are included to limit the current in to the LED and control the brightness. Both LDRs (R5 & R6) work in the same way, in that the LDR with an additional resistor (R3 / R4) make up a potential divider. As the light on the LDR changes, its resistance changes and in turn the voltage at the centre of the potential divider changes. This voltage which changes with light level is then fed in to the op amp. The op amp is set up as a comparator, which means that the voltage from the LDR is compared to the voltage set by the trimmer potentiometer (R7). If the LDR voltage is bigger than the pre-set voltage then the output of the op amp goes high, when the LDR voltage is lower than the pre-set voltage the output goes low. When the output is high the LED (LED3 / LED4) is on and this is signaled back to the main board that controls the Buggy. Once again a current limit resistor (R8 / R9) is present to control the brightness of the LED. When a black line is being followed, normally the LDR will be light and the output will be off. When the LDR is over the line it will be dark and the output will be on. How the Motor Driver Board Works Detailed information on how the Motor Driver board works can be found under the resource section of its product page which can be found at www.kitronik.co.uk/5602 Online Information This guide can be downloaded from the product page where the kit can also be reordered from: www.kitronik.co.uk/5604 This kit is designed and manufactured in the UK by Kitronik Telephone: +44 (0) 845 8380781 www.kitronik.co.uk/twitter Sales email: www.kitronik.co.uk/facebook Tech support email: Web: www.kitronik.co.uk www.kitronik.co.uk/youtube www.kitronik.co.uk/google Every effort has been made to ensure that these notes are correct, however Kitronik accept no responsibility for issues arising from errors / omissions in the notes. Kitronik Ltd - Any unauthorised copying / duplication of this booklet or part thereof for purposes except for use with Kitronik project kits is not allowed without Kitronik’s prior consent.
* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project