There are currently 0 users and 1 guest online.
How to build a robot - did you have problems?
3 - Construction
Submitted by Webbot on August 29, 2008 - 4:25pm.
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:-
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:
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:-
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.