Step 4: Adding the electrical brain.

OK, so you're done with the mechanical part of this project, time to give franken-robot its brains! You'll see in step one I referred you to this step for the circuit shield. The Arduino by itself can do nothing for this robot besides process and output data in a high (1) or low (0) 0-5volt signal. Furthermore, microcontrollers can't supply things like motors and relays the high current they require. If you try to power a motor with the Atmega168, most likely all you will get is smoke and a free fireworks show. So then how will we control out gear-head motors you might ask? Surveyyyyy says- H-Bridge! I am not going to spend the time here to explain exactly what an H-Bridge is, if you would like to learn more about them go here. For now all you need to know is that an H-Bridge will take a high or low signal from a mircocontroller, and power our motors from the AA batteries supply voltage source we give it. The circuit shield as the Arduino community calls them, will be a PCB (printed circuit board) that will rest on top of the Arduino and plug into it with header pins. To this shield we will add components like the L298 H-Bridge, some LED's, and Ultrasonic sensor wires.
Once again I have done most of the work for you, by spending hours making a PCB of our circuit shield in a PCB CAD program called Eagle. To get your very own professionally made circuit shield go to BatchPCB. BatchPCB is a shoot off of Spark Fun Electronics, and they specialize in taking small orders from people like you and me at a very reasonable price. Next make yourself an account there so you can order my shield, then get the http://www.instructables.com/files/orig/FSY/LZNL/GE056Z5B/FSYLZNLGE056Z5B.zip Gerber Zip File (also at the bottom of this picture set) which contains the golden 7 files they need: GTL, GTO, GTS, GBL, GBO, GBS, and TXT drilling guide. Look at the two pictures below as a reference, but basically click "Upload New Design" in the top task pane on the site, and from there you just find and upload the entire Zip file, and then check the picture to make sure all the layers are in the place they need to be, click submit then select the Eagle PCB bubble and then submit again. It will send you and email that says it passed the DRC bot and it will have a link that you can click to add it to your shopping cart, then just order it. It costs like $30 and takes about 1-2 weeks depending upon when you send it to them and what shipping you get.
Now if you are good with electronics already, and think you can make your own on a prototyping board ( I did this temporarily), or if you like to etch your own PCB's, then go ahead but I'm not discussing how to do that here as it will waste time and space. If you choose to make your own then you can get just the schematic here, its a little crowded and messy so be ware. Oh, and an extra note on the PCB it does have some of my silkscreen graffiti on there, so don't think that the guys at the PCB factory were writing Chuck Norris facts on your circuit board! So lets fast forward about a week and assume your holding the circuit board right now...

Step 1: Make sure the holes for the Arduino headers line up with the holes for the header pins on the shield. Now as a result of my error, you will have to bend some of the pins on the L298 H-Bridge back so they will fin in the holes on the shield. Sorry about that. Warm up your soldering iron and get ready for some major soldering! If you don't know or are rusty on how to solder check out this page by Spark Fun.

Step 2: Solder the male header pins to the board. To make sure they fit well, I suggest that you stick the male headers into the Arduino first, then fit the shield over them; and solder them on.

Step 3: Now solder the L298 H-Bridge to the shield and the rest of the components (LED's, polarized connector pins, resistors, and diodes). The PCB should be pretty self explanatory as to where everything goes, because of the silkscreen layer on top. All the diodes are 1N5818, and be sure to match up the stripe on the diode to the stripe on the silkscreen. R1 and R2 are the 2.2K resistors, R3 and R4 are the 47K resistors, and R5 is the 10K resistor. LED's 1 and 3 are green to indicate the motors are going forwards, and LED's 2 and 4 are red to indicate the motors are going in reverse. LED 5 is the obstacle indicator and shows when the sonar picks up an obstacle in its programmed limit. The extra jumper places are there to leave us the option to update Walbot with different sensors in the future.

Step 4: If you are soldering the wires directly to the board then skip step 5. If you are using the polarized connector pins then skip THIS step. Soldering the wires directly to the shield is not as neat but much faster and cheaper. You should now have 4 wires for both the motors, 4 wires coming from your AA battery packs, and 4 wires coming out of the sonar. Lets do the Battery packs first. See the second picture for a diagram of where to solder the wires. Now that thats done, solder the LEFT motor wires to the MOT_LEFT labeled holes on the PCB, and the RIGHT motor wires to the MOT_RIGHT holes (order does not matter, we can fix that with software later). For the sonar, there should be small labels in front of the SONAR holes on the PCB. Match up your GND wire to the GND hole, the 5V wire to the VCC hole, the RX wire to the Enab hole and the AN wire to the Ana1 hole. You should then be done with the wires!

Step 5: If you are using the polarized connector pins for the wires on the board and don't know how to use them, then read up on them here. Now solder in all of male polarized connectors to their corresponding number of holes. Look at the diagram below to see where to stick the crimp pins in the housing slots, so that they line up as shown. Next do the polarized connector housing for the left and right motor wires, it does not matter which order the wires go in just as long as left goes to MOT_LEFT, and right to MOT_RIGHT (we can fix which way the robot goes in the software). Finally do the Sonar wires making sure to line up / orient the wires so that your GND wire does to the GND hole, the 5V wire to the VCC hole, the RX wire to the Enab hole and the AN wire to the Ana1 hole. Once you crimp, wire, and connect those together, you should be done with the wires!

Step 6: Now you need to be able to power the Arduino using your 9Volt (its really 7.2 volts) battery. Using the 9Volt clip connector, open the power jack and solder the POSITIVE RED WIRE TO THE CENTER TAB and solder the black gorund wire to the tab which goes to the outer metal part. This is critical to make sure that the center / inner hole is positive, if you reverse this the Microcontroller will most likely do nothing except heat up, smoke or explode. If by accident you fry your Atmega168 you can get a new one here but you will have to burn the boot loader back on. To find out how to do this check the Arduino forum.

All the electronics should be finished with for now! Only easy stuff left now!
paulc23 years ago
Can't access the site to get an electrical schematic of the motors shield. Nor the PCB manufacturer.

Is the schematic still available and where can I get it

First of all great instructable. This is a really cool idea and I'm excited to build it. I have two questions, though. I am making the pcb myself. What do the red arrows (like the one connected to pin 9 of the H-bridge) mean? And what do the JP(number) stand for? Thanks to anybody to take the time to answer my noobish question.
The only picture with red arrows is the 4th pic and the H Bridge is not a part of that. Not sure what you mean by JP, can you give me a more specific quote?
Sorry about not being more specific. When I referred to the red arrow, I meant in the schematic. The schematic also has JP1, JP2, etc., and I didn't know what that meant. Thank you very much.
thats Jumper 1 and Jumper 2, kinda like auxiliary ports should you ever want to add more sensors...
kennyvs6 years ago
hi brandon, i just start on making the PCB myself cause i dont have that much money to spend on, i have a problem on the schematic that you have posted. The line that connect to pin 9 of hte H-Bridge, i see it as an arrow that does that mean? does it mean the same as Pin 4 of the H-bridge too (the one that connect to the +), which i assume to with +8v right? And your 2 battleries, it in series right? I just want to make sure of these before i solder on the H-bridge. Thank in advance.
hey bredon were is the switch of the robot the on and off how to connect it