IAN LANG ELECTRONICS
There's currently a book out there produced by Magbook and which I have had a good leaf through whilst prancing around WH Smith in my usual stomping about as though I own the place fashion.( It's great when you wear a nice suit and put on a posh voice because people seldom dare to question what you're doing and you can get away with loads of stuff that would not usually be considered socially acceptable.) That's the book under there, published by Magbook.
Now it says that you can build a robot for £18 on the front cover and sure enough you can but not the one pictured on aforementioned cover; a quick tot-up of the bits you need for that came in (when I checked) at £70 + and that was just a cursory glance. Robotbits.co.uk do a bundle which still doesn't contain all the bits and comes in at £63.49 plus your postage costs.
Still, if you are new to motors and microcontrollers it is a worthwhile book if a bit on the pricey side. I'd recommend the Magbot book to build the project if you've got a spare £100 or so hanging about or if you want to give the budding cyberneticist in your life a nice Christmas present.
It uses the Magician Robot Chassis from Dagu which retails (depending on where you get it) for about £20 and I got mine from Robotbits.co.uk but if you don't live in the UK they're sold everywhere. On the left there's three pictures. In the top one you can see it assembled, in the middle it's upside down and you can see the good quality Dagu motors and gearboxes (two independent ones) and the trailing castor. You might get a ball castor with it, and some people maintain there's a difference but
to be honest with you if there is I've never seen it. Castors align themselves to the line of the greatest force and so a trailer does the job does fine.
When you get the Magician chassis it comes as a kit in bits. You get two quad encoders that fit on the insides of the gearbox and if you take my advice you'll put those in a big box of bits because I doubt they'll be any use to you given the position they're in and indeed I found they'd just get in the way so in the bucket o' bits they went. In addition it tells you to mount the battery box between the top and bottom plates. Don't, because every time you want to change the batteries you'll end up taking the whole thing apart. Put them on the top as in the top picture above and life will be much easier.
The very next thing to worry about is how to wire in the motors because if there's one thing we are going to need above all else it's a motor driving board. It's never a good idea to solder your motors in directly to the board because if the board fails you're left with the messy and time consuming job of desoldering them and soldering to a new board. I've taken the quick and dirty approach of soldering eyes on to the end of the motor leads and then crimping them on to reduce the mechanical strain. To keep the leads tidy, I've wrapped them round in tie wraps, one in the middle securing the leads to the board and one at the end to tie them together in a bundle.
They are terminated in their pairs, left-left and right-right by four M3 bolts and nuts which secures the eye to the chassis. Up above in the second picture down you can see how they've been wrapped around the motors (more tie wraps) to stop them trailing on the floor and the practical upshot is that there's very little chance of the wires getting snagged on something and ripping out.
At the front I've fitted an Uno and since the power supply and the USB connection is what we're most likely to want to get to I've left them protruding from the front. This gives us a nice big space to get the motor driving board in. The Uno is secured at the front by two M2.5 bolts and nuts with a length down the shaft of 19 mm, since this gives me somewhere to hook other bits on to the front if I need to.
Next thing then is to make a template for the shape of the motor driving board and find out where we can stick things. At this stage I need the space for two relays, four transistors and an optocoupler, plus a resistor or two and possibly some capacitors. Better get a bit of foamboard and my steel ruler and scalpel out then.
That foamboard template on the left there suggests that I have a rectangular area some 70mm by 50mm to get my components in, plus if I need to there are 2 20mm protrusions at the side there that I can get stuff on but I may need to create an extra hole.
It also shows up a problem heretofore not considered- if I space it as I want to I may not have enough space vertically to fit my relays on the board.
The easiest way to check is to screw the top back on and see if I can shove the relay carefully in to check for size. Happily It looks as though the ones I'm using will fit. Phew.
You can get a shield for driving motors that fits on your Uno. It costs £24.95 and though it makes driving two motors very easy I'm not a big fan of it simply because it's hard to hack it about when you want to do something out of the ordinary and it doesn't teach you much about the nuts and bolts of electric motors. It can also be a bit bulky when you've got a limited space to work in and so I much prefer to build a board that we can control and more importantly easily repair if things go wrong.
So then, the wheels are driven by electric motors. We need to know how these things work in that case, and so for the rest of the page comes a bit of an essay, and if you think this is a bit lengthy you just wait until we get to optocouplers. Chin up, because if you know about motors already you can skip this part.
What we are seeing above is a DC motor, DC standing for Direct Current which is the kind of electricity you get from batteries and which is working your drives on the Magician. You can get AC (Alternating Current) motors but they are more expensive and fiddly to work since they need complex controls. At the broadest breakdown of the motor you have the rotor, which is everything that goes round, and the stator, which is everything that doesn't.
On the rotor we have a shaft, on which sits the parts that make the motor work. These are the commutator and the winding assembly and let's start with the latter. The winding assembly consists of three coils of copper wire wound around a former. As Faraday discovered if you pass current through such a device it acts as a magnet, developing north and south poles just as a normal magnet would. Remember that. It's going to be important. The commutator causes a change in polarity of the current reaching the windings as it goes round. So, each winding in turn can be a north-south magnet or a south-north magnet, or in other words the polarity of the electro-magnets changes. That's going to be important too.
The current gets to the commutator via a brush mechanism. Up above I've shown a carbon brush and a spring. The carbon brush is attached via the spring to a strip of metal running to the terminal to which you apply current. On the other side there's another one to provide a continuous circuit which attaches to the other terminal. The carbon brushes are part of the stator, they do not go round with the rotor.
In fact in your Dagu motors there is no carbon brush, but there is a springy metal strip. It works exactly the same way as the carbon brush, the advantage being it's cheaper, cleaner and requires no maintenance. The disadvantage is a poorer contact and when it wears down it's next door to impossible to replace it and you're better off replacing the whole motor unit.
The point is that depending on which direction the current is coming from and how it hits the commutator the windings will take on one polarity or the other and switch it back and forth. As the magnetic field from the coils encounters the magnetic field from the permanent magnets, it causes an attraction and repulsion that causes the coils to move towards or away from the magnetic field of the permanent magnets and the movement is all in the same direction. As the coils are wound on the formers, and the formers are anchored to the shaft, it causes the linear movement of the coils to be translated into a rotary one round the shaft (which takes the commutator with it keeping the reaction going).
You can do this with just two coils but you'll never see one outside the laboratory because a two coil motor can get stuck in one position. Three means there's enough kick at any point, even at start up, to allow the motor to overcome inertia.
So, let's consider what we've just learnt here. The rotation of the motor depends on the current direction both at the terminals and the commutator. We can't change the commutator. Can we change the terminals? You know we can.
Up above you can see the same motor wired in to a battery so that current flows firstly in one direction and then the other. In the first instance the motor turns clockwise and in the second anti-clockwise.
So, reversing the flow of current reverses the direction of spin. It isn't terribly practical to switch terminals whilst the motor is running, so we need something that can cross the current over on demand to make the robot capable of forwards and backwards movement. That something is the relay I was on about earlier. So over the page we go to see how this works.
Some of you may have trawled through this site and seen some of my postulations before and if so you will know that
when that cup of tea and packet of cigarettes
appears it is in fact a recurring leitmotiv.
In this case the recurring leitmotiv is that
this is going to be a big delve into theoretical
concerns and so make your cuppa now and
put your tobacco near your hand because
it's going to be a long one. This time the tea
and tobacco is joined by a drawing of an
exploded motor. That is exploded in the sense
that the drawing shows the motor in a state of partial dissembly, not as in
I've shoved too much juice through it and blown it up.