How to build a robot - did you have problems?



Why another $50 Robot related tutorial?


Well I’ve built a good number of the standard $50 Robot card and every one has worked and done ‘what it claims’. But I guess my main ‘issues’ with the original design are (apologies in advance to ‘Admin the creator’):-


  1. Not all of the I/O pins are implemented. OK so it’s easy enough to just add some extra header pins.
  2. You probably have two power supplies: a TTL supply that drives the controller, sensors etc at 5v (via the regulator from a 9v battery) and a separate battery pack to feed the servos and/or DC motors.  When building the $50 robot you have to decide which of these two power supplies you are going to use. So long as you know beforehand exactly what your board is going to do then that’s fine but, if you are like me, you may want to add or change stuff later. So I wanted a board where each I/O pin had two headers: one for sensors and one for motors/servos.
  3. Fabrication. I’ve used the board suggested by Admin (which I found kind a fiddly), I’ve also tried Tri-Pad strip board (less fiddly but you end up with a much bigger board). So I thought I should try to make my own PCB.
  4. There are lots and lots of Forum posts from newbies who have attempted the $50 Robot as their first electronic experiment and have become very frustrated when things haven’t worked. So, in this tutorial, I want to cover some basics of building a circuit (no matter what it is). So even if you don’t intend making my board then I hope you will find these general comments worthwhile and instructive.

This tutorial is broken down into the following sections:-




1 - My PCB design for the $50 Robot

So having decided to create a new board layout I fired up Eagle and produced a logical schematic and then a physical board layout. This isn’t an Eagle tutorial so I wont give any more info on how I did that.


The attached ZIP file contains the Eagle Shematic, Eagle Board and a standalone PDF I used to manufacture the board.



I also produced an Eagle 3D picture of the board so for all of you non-Eagle users out there then you can see what we are making:-



But note that the blue capacitor has now moved - and there is now a second one!


So lets break the image down:-

  1. The micro-controller is either an ATMega8 or ATMega168 – as per the $50 Tutorial. In fact the only difference between this and the $50 Robot is the number of header pins, the header pins dedicated to the UART, and an optional power switch. Otherwise the $50 Robot Tutorial will tell you what all the other components are and where to get them.
  2. You will see that there are two parallel rows of 3 x header pins on the left of the controller and on the bottom right of the controller. There is some duplication here but it makes the layout easy to understand. Each 3 pin header is connected to one micro-processor I/O pin. The pin closest to the micro-controller is the ‘signal’ from the controller. The pin furthest away from the controller is ‘Ground’, ‘0V’, or ‘Earth’ – depending on your favoured terminology – I will call it ‘Ground’. The middle pin is the ‘power. For the group of header pins closest to the controller the middle pin is connected to the +5v TTL supply and is intended for connection to sensors and anything else that doesn’t require lots of power. For the outer set of 3 pins the middle pin is connected to the motor supply and so is meant to control servos, motors etc. So if you have a lead from a sensor then connect it to the inner set of headers but connect your servo/motors to the outer set of headers. Needless to say:- you can only choose one – ie you cannot use the inner and outer headers for the same pin to do different things!
  3. The set of pins on the top right of the micro-controller are for ADC inputs. There is only an inner set of pins (ie +5v).
  4. See those white plugs at the top of the board – they are the power connectors. One for the TTL supply (a 9v battery that goes into the regulator and supplies +5v to all the chips), and the other for the motor/servo supply. I’ve used connectors that prevent you from connecting a battery the wrong way around.
  5. Top right of the board – that’s the voltage regulator and supply capacitor.
  6. Top left – you will see the red LED and a small resistor. These are connected to the same I/O pin as in the $50 Robot. Make sure you solder the LED the correct way round.
  7. Top left – just below the red LED you will see a 4 pin header. Well that’s for the UART or ‘serial interface’.  In common with the other headers the pin furthest from the controller is the ground. The next pins are +5v, transmit and then receive (closest to the controller). More often than not we use a serial interface to transmit data to a PC (via a MAX232 interface say) or to a serial LCD display. In which case a standard 3-way cable (as used by sensors) can be used to connect the left three pins to the output device.
  8. See that big ‘hole’ at the top middle of the board? Well that’s for an on/off power switch. I’ve used a two-pole switch so that we turn on/off BOTH of the power supplies. But a word of warning. Since the switch controls the motor/servo supply then make sure that the switch is capable of handling the total power (watts) that your motor will need – that’s why I don’t show a picture of what the switch looks like.  If in doubt then you can get rid of the switch by shorting out the top row of 3 holes, and then separately shorting out the bottom row of 3 holes. Doing this will mean that there is no switch on the board.
  9. The bottom middle of the board has 2 rows of 3 pins which are the ISP header for connecting to your computer to program ‘the chip’.
  10. Half way down the right hand side of the micro-controller you will see a small red thing – this is the ceramic capacitor used to reduce noise on the ADC inputs.




2 - Making the PCB

Trying to make your own PCBs is expensive!! If you choose to use a standard matrix board as per Admins tutorial then skip through this section if you want.


Although I don’t want to do a tutorial on this subject then here are some thoughts.


You can either do this using ‘ultra-violet light’ or by ‘copper etching’.

The first method involves printing your (Eagle) board layout onto a transparent film, then laying it onto some photosensitive copper board and then ‘cooking’ it in an ultra-violet light oven. The expense comes from having to buy ‘photosensitive copper board’ for each PCB as well as the one off cost of the ultra violet box (which has to be enclosed as U.V. light can give you an instant tan/melanoma).


The second method involves transferring your (Eagle) board layout onto the surface of a copper board and then putting it into an acid bath to ‘eat away’ all the exposed copper. This tends to be cheaper but means playing with harmful/dangerous chemicals. Wear gloves – and don’t splash your clothes – (the voice of experience!).


Lots of web sites sell ‘beginner’ kits of both sorts – but both methods tend to require the use of a Laser printer NOT an Inkjet. Google for making PCBs and you may find alternatives.


I opted for the second option as its cheaper to get going. I used a system called Press’n’Peel. Google for it. The basic idea is you Laser print your PCB design onto the Press’n’Peel and then iron it onto your circuit board. You then place the board into acid/oxidant that eats away all the un-wanted copper. There’s a great video on You tube with perhaps the worlds most ‘I am not interested voice over’! Also – check out his hands to see what acid can do to your skin!


One word of warning:- having spent £50 on a Brother Laser Printer I experienced some problems. Looking at the Press’n’Peel home website it transpired they say there are problems with Brother printers (must be the ink I guess?). So eBay for a cheap ‘non-Brother’ Laser printer.


Here are a few other tips:

  1. I prefer to drill the holes in the board before etching. If you do it afterwards then some of the copper pads may come off the board.
  2. If you haven’t got a drill press then a cheap alternative is to use a small hand drill like this one available from Games Workshop. But it takes quite a while.




3 - Construction

At the end of the day it doesn’t really matter if you make a PCB or not. You could use stripboard, matrix board, tri-pad board etc etc. At the end of the day it’s just a bunch of holes connected by copper or wires.


I’ve got a board and a whole bunch of components so ‘lets solder them all now’? Wrong.


‘But – I’ve got a meter, oscilloscope etc so I can check out the voltages later to find out what isn’t working – right?’  Wrong


Unplug that soldering iron right now – you don’t need it yet.


If you search the forum you will be surprised by the number of posts along these lines:-

  1. ‘Problem with $50 Robot’
  2. ‘Problem with ISP Programmer’
  3. ‘My servos don’t work’
  4. Any number of combinations of the above.


At the end of the day – the $50 Robot design (both the original and this variant) DO WORK - so long as they are built correctly. If yours doesn’t work then you have done something wrong. Perhaps the hardest question on the forum to answer is “I’ve built the $50 Robot and it doesn’t work – please help”. This is something akin to “I’ve built a jumbo jet airplane and it doesn’t fly”.


So lets look at that last question and break it down.


Do you imagine that the aircraft manufacturers build a complete airplane, stuff it with passengers, and then just launch it down the runway and hope it all works? “Of course not” I hear you say – “they must test each of the bits before hand”. So why is your board any different? OK – you may not be in control of 100s of passengers but if you crash your board then you will have to throw it away and start all over again.


A frequent response on the forum is “I’ve checked all the voltages on the chips/pins and everything seems ok – but I’m still having a problem - please help”.

This is way way way too late. It’s like re-wiring your house, turning the power back on, and then running around with a meter to check stuff out. Whilst you’re busy with your meter in the kitchen – your bedroom is going up in flames. The difference is that ‘chips’ tend to die quietly – they don’t go ‘bang’, “melt in front of your eyes” etc – but like a fuse in a plug they sometimes just quietly go to heaven without you knowing.


So now that your soldering iron has cooled down – you can put it away.


Whilst you are at it – you can change your meter from ‘Volts’ to ‘Resistance’ or ‘Ohms’. Or if you don’t have a meter then check if you’ve got a ‘Continuity Tester’ – often used to test if fuses are ok or blown. Using your meter or continuity tester you can check if a circuit is open (ie there is a gap) or closed (ie there is a link between the two ends of your probes). Since you are building something that someone else has created, tested, got working etc then this ability to test if a circuit is open or closed is actually all you need. If you use it properly then your circuit will be correct and hence all the voltages will be correct so you will never need to test voltages!



Like most things in life it’s the preparation before, and during, making something that ends up making life easier. It may take longer to get there – but if you get there and ‘it works’ then you are on the winning side. Remember the ‘Tortoise and the Hare’?


If you made your own PCB then use your tester to:

  1. Check each PCB copper strip to make sure that it is a ‘closed’ circuit. The copper may look ok to you but there may be a hairline break somewhere. If the two ends of a strip are unexpectedly open then check progressively smaller sections until you find out where the break is. You can then normally place some solder over the break to make it ok.
  2. For each copper strip – check that the connection to any neighbouring strip is open – ie that you don’t have any short circuits with neighbouring strips. Once again these can be invisible to the naked eye – so use your meter and trust what it says.


So now we have a bare board – and we know that all of its connections are good:- there are no short circuits and no broken links.



Ok – now you can plug in that soldering iron.



Making up the board


“So I can start soldering everything onto the board now?” – NO, NO, NO.


Most boards are made up from the following sorts of components:-

  1. Header pins
  2. IC sockets
  3. Power / board connectors
  4. Wires on top of the board to connect other copper tracks together or ‘jumper wires’
  5. Switches
  6. Resistors / capacitors / transistors / integrated circuits (chips)/voltage regulators


All of the above, except the last line, are fancy “wires” and are just an extension to the copper on your board. More importantly: they can be tested with your continuity tester. So lets start soldering them on first.


When soldering its easiest to start with the items that are shortest moving up to the things that are tallest. This is because you place items on the board, turn the board upside down, and then solder. So if you do the tallest items first then you will have problems with the shorter components – turn over the board and they all fall out.


So lets start by soldering on any wires that lie on top of, or underneath, the board. Having soldered both ends of each wire then use your meter to check that the two ends have made a good ‘closed’ connection and re-check that you haven’t accidentally created a short circuit with anything nearby. I found the original $50 Robot board quite difficult when running the supply rails along the header rows. In the end I did it by taking some insulated wire, stripping enough insulation for the wiring run you want to do, and then soldering the wire at both ends (making sure it is flat against the board). Then you can solder all the intermediate points along the wire.


Next lets solder in the IC socket for the microcontroller. Why do I need one? Well if you solder the chip straight onto the board then you may overcook the chip by leaving the soldering iron on for too long. Or the chip may blow at a later date or for another reason. Or you may want to change your ATMega8 for an ATMega168. Imagine what a nightmare it would be to unsolder all those 28 pins to get the chip out unharmed!!! Always use sockets for any chips.


Got the socket soldered in? Great. Get out that tester and check each pair of adjacent pins ie 1 and 2, then 2 and 3, then 3 and 4 etc until you’ve gone right around the socket – making sure that each pair is open or closed according to the circuit diagram.


Now solder in any toggle or slider switches. Once done: use your tester to make sure that the switch is opening and closing the connections correctly. Again: make sure you haven't accidentally created a short circuit to other items nearby where you have just soldered.


Now solder in any header pins and power connectors. The header pins can be slightly tricky. Given that they are normally placed in rows of three:  the ground connections and the power connections run next to each other. So it is imperative that you use your tester frequently to make sure that you have created circuits where you intended and haven’t introduced any short circuits. Its also imperative that you check the connection between each header and wherever it is meant to connect to the microcontroller. Double check that you haven’t created short circuits between the micro controller pins as this can cause a real problem later. For example: if two I/O pins are shorted together and you turn your board on then everything will look ok as the I/O pins probably both float high or low by default. However: once you load a program and you set one pin high and the other pin low then it will silently go ‘bang’.


So now you have something that looks like this:-



Now all we have left to do is to solder the ‘active’ components and insert the chip. But wait lets do it in a logical order. The problem with ‘active’ components is that they all, by and large, exhibit some form of resistance. So once we start to solder them on then it becomes much more difficult to use a ‘continuity tester’ for open/closed circuits. However: if you’ve done all of your continuity testing properly and thoroughly then at least you shouldn’t have any of the dreaded short circuits that make things bang. So we should be confident that we will see the correct voltages on the correct pins.  This continuity testing preparation should take 90% of the whole time you spend building the board – with the remainder split between soldering and voltage testing. Its far easier to spend all this extra time than it is to have to wait whilst your re-order for new parts comes through!


Next we will attach the motor supply connector (the right way round). Since this supply only goes to the motors and servos then the only place where this voltage is visible is on the header pins used to drive motors/sensors. Check that the power switch (if you have used one) turns the voltage on and off correctly at these pins. If the voltage is visible on other pins then you’ve got a short somewhere.



So let’s make a start with the 5v regulator. Make sure you solder it in the correct way round!!  Use your ohm meter to check that you haven’t shorted out any of its pins. NB the regulator may exhibit some resistance and the value may change with time. So when measuring – wait till the value has stabilised. Obviously if you have a short then it will stay at zero ohms. Any other value should be ok.


Now you can plug in the 9v battery that feeds the regulator. Make sure you connect it to the correct power plug and that you have placed the leads into the plug the correct way round. Switch your meter to the 10 volt range and connect the two leads with the black one to ground and the red one to a position that requires the 5v output from the regulator. Make sure the power switch (if you have used one) turns the voltage on and off. Try to check this works properly as quickly as you can – as you don’t want to blow up the regulator if you have made a mistake. If things aren’t working then make sure you are reading 9v on the input pin of the regulator. If the regulator gets hot then you definitely have a problem. If all appears ok then leave the power switched on for about 10 minutes – frequently checking that the regulator doesn’t get hot (if it does then switch off immediately and track the wiring fault). The regulator shouldn’t get hot as there is nothing else on the board yet that takes any power. Whilst you’re waiting for the 10 minutes to pass then you can spend the time checking that you get a 5v reading at all the places on the board where you expect to see it. Be careful when testing the header pins as the 5v pin is next door to the ground pin so don’t short the two together with your test lead. If everything is still functioning and not boiling hot after the 10 minutes has passed then we can move on.


Solder in the LED and small resistor – making sure that the LED is the correct way around otherwise it won’t work. You can check out the LED by taking a small piece of wire with the insulation stripped off at each end. With the power turned off: insert one end of the wire into pin 6 of the IC socket (this is port D4 which is used to drive the LED). Leave the other end in the air making sure it doesn’t accidentally touch a connection and cause a short. Turn on the 9v battery power. Now take the flying end of your wire and put it in pin 8 of the IC socket (ground) and the LED should light up. Take one end out of pin 8 and put it in pin 7 (5v) instead – the LED should not light up. If this doesn’t work then test there is 5V between pins 7 and 8 on the IC socket. If there is then you either have a wiring problem with the resistor and the LED or the LED is the wrong way around. Turn off the power again.


All we have left are the small disc capacitor and the larger capacitor. The small capacitor can be soldered in any way around whereas the larger capacitor must be soldered the correct way around (otherwise it can actually blow up). Turn on the power again and make sure that your LED test still works. If not then check the soldering you have just done. 



Turn off the power and carefully insert the micro-controller the correct way around. Be very careful that none of the pins get bent underneath the body of the chip – otherwise it looks like they are in properly when they aren’t. If you need to take the chip out again then I use a small flat screwdriver. Insert it at one end of the chip (in between the chip and the socket) and twist it very slightly to lift that end up a millimetre or two. Do the same thing at the other end of the chip. Repeat the process until the chip comes free. A general word of caution:- chips don’t like static electricity which is why they come in those bags or tubes. So never place the chip on something like a carpet. Try to handle the chip by holding both ends and keeping your fingers away from the pins as much as possible. It’s a good idea to do another quick continuity check on each pin of the IC. Place one probe on the visible part of the pin above the IC socket and the other probe on the header pin, ground, +5v (ie whatever it’s meant to connect to). This will check that the leg of the chip is sitting correctly in the IC socket.


Now, with heart thumping, it’s time to turn the power on. Of course – nothing will happen as there is no program on the chip. Even the LED will not come on (it’s not there to be a power indicator). Leave the power on for another 10 minutes whilst frequently checking that nothing is getting hot.


Hurrah – board complete.