IAN LANG ELECTRONICS

Where you have a robot you need to have a means of making it move, because if it's stuffed full of electronics but it doesn't move it's not a robot. It might be a computer, a calculator, a digital television box or any other thing that's got a bunch of resistors, capacitors and assorted semiconductors in it but if it stays where it is it's not a robot. Even a robot arm moves it's claw or other end effector to a point somewhere within its reach and so it moves. Movement requires a force. Robots use batteries or mains power, and that's electricity. The inesacapable conclusion is that somewhere around the robot there's got to be at least one and probably more motors. If you want to see a really intense study of the robot arm technology using DC motors look here:

Introduction Introduction Steering a Robot Philosophies

Robots-Driving Motors

Go Back arduinoideas.webeden.co.uk/#/robot-arm-hack-1/4573972835

The chances are that in your constructions you are going to meet three kinds of electric motor. The first two are the brushed and brushless DC motor of which the first kind will be far more common, and the third kind is the servo. Servos are used for positioning and so we'll look at those in steering, but another kind of servo is the continually rotating servo which is used for driving and so we'll look at that here too. Let's start with the most common driving force of all, the brushed DC motor.

motorsmall

There's a small one on the right, it's for a low-voltage device such as a mini-fan or perhaps a child's toy or you might find one in a battery operated kitchen utensil such as the Aerofoil whisk my wife uses to froth up her coffee. Don't ask me why all the women like coffee made with gallons of milk and a really strong boiled-up load of crushed beans whipped up into a frenzy of foam but they do. Me, I just shovel a spoonful of Kenco in a cup with some milk and sugar and tip boiling water on it.  The point is that the whisk they use has a motor just like the one on the right in it to turn the whisk very rapidly, and it's  supplied by two AA batteries making 3V.

And that's the first thing about motors. They all have a design voltage. Motors come bigger than the 3V one shown above, you can get 72V motors and they use these giant beasts in fork-lift trucks. The current through a motor is of course dependent on the voltage, and whilst the voltage gives a motor speed, the current gives it torque. Hence the more voltage you shovel in, the greater the speed and the more power you get out. Most small motors are designed to run between 6 and 9V but very small ones can be as low as 1.3V. Generally speaking they are used for pocket applications or for running solar-powered devices. Here's caveat number 1:  Don't run a motor over the design voltage. If you do, you'll get lots of heat. If you go a long way over the design voltage you'll get an interesting display of pyrotechnics.

 

So, what's in a motor that makes it work? Let's take one to bits.

motorexplode

In the broadest sense the motor consists of the rotor and the stator. The rotor is everything that spins round and the stator is everything that doesn't. In our example on the left the stator consists of the case and the magnets. The magnets are there with their poles arranged oppositely to provide, not unreasonably, a magnetic field through which the rotor cuts. There are three windings of copper wire through which a voltage is passed, causing a current which in turn causes a magnetic field. This reacts with the magnetic field of the permanent magnets and the field of the magnets and the windings attract and repel causing the windings to move, and as they are tethered to the shaft

it too rotates, the direction being dependent on where the current enters the motor. Here's the clever bit. Because the current enters the motor in the same direction all the time fairly soon the fields would stabilise and the motor would stop. So, to keep it going, the direction of current to the rotor is changed as it spins by the commutator and brushes. The brushes conduct the voltage/current to the windings via one plate or other and the magnetic field flips in the coil but not the magnets. This keeps the rotation going. There's three windings (or poles) normally and the reason for that is that with just two the motor may not be able to overcome its own inertia and may get stuck where it is. I've shown a larger motor here that has a carbon brush held in place by a spring doing the conducting. The carbon brush is the most effective way of conducting but they have the disadvantage of wearing down as anybody who has had to mend a Hornby locomitive will know. In larger motors it's a dirty business too. In smaller motors the usual arrangement is to have a pair of springy metal strips making contact with the commutator. This is not as effective but it does have the advantage of being long-lasting and maintenance free.

In larger motors it is also possible that there are no permanent magnets and the field is supplied by stationary coils. You will not find this in battery-operated devices, since the power requirement is far too great for batteries to supply for very long.

 

A motor is no good if it can't spin in two directions. All motors are able to do so, providing the circuitry feeding them is able to reverse the direction of current. For robots, reversing the direction of a motor allows both forward and backward movement.  So it is essential that we are able to change the direction of current when the robot requires to change direction. What we need to construct is an H-bridge. There are a number of ways we can do this. The first and simplest is to use a relay and transistor.

relayoomlout

I get mine from Oomlout for the simple reason that for £2:50 they give you a relay, the snubber diode, the driving transistor and a resistor for the base of the transistor of 2k2 (2200 ohms) which is not bad. The relay can serve up to 30V DC and should be able to do 2A as well. Click on the picture to take you to Oomlout's web page for this relay.

 

So how do we fix this kit up to control a motor? Like the below:

DPDTH

Now I admit that when you first see this, it does not look simple at all. But what it in fact is is five basic components. In there you will see a diode, a transistor, a resistor, a relay and a motor.

 

Now, I'm aware that many people getting into robotics don't have the grounding in electronics that some of us do. Therefore I'm going to take a ground-up approach and explain the basics as we go. If you do have a good grasp of the fundamentals, I'll warn you when we come to a paragraph that you'll find too easy. Like the next one.

 

If you aren't familiar with schematics, you need to read this paragraph. If you are, skip to the next one, because I'm about to explain the symbols here. Starting at the top of the drawing there's a big circle with an M in it. That is the electric motor, and the terminals of the motor are shown in the black lines on the left and right of the circle. Underneath the motor there is a little triangle thing with a line at the sharp end pointing left. This is the diode.  If you look along left from the diode following the grey line, you'll see 5V and that's  coil supply to the relay.  The big square bit is the relay. Looking left from where it says Nc, you'll see a node. The node is the motor's power supply.Looking right from the middle of the relay, you'll see a circle with what looks like a backwards K inside it. That is the transistor. Look right from the transistor and you will see a zig-zag, that's the resistor. Look right from the resistor and there's another node; this one is the coil control. Lastly, at the bottom right, there's a triangle thing made out of three lines going downwards. That's the symbol for ground, and here it means negative terminal of the battery or other power supply.

 

Here's how the H-Bridge works. When the coil of the relay is not energised, the current flows in through Nc (the normally closed switch) through com (the common terminal) through the motor, and back to com on the other side. From com it flows to the other Nc terminal and there to ground, completing a pathway and allowing the motor to spin. When the coil is energised, the current flows in through No (normally open) through com, through the motor, through com on the other side and back through No on the other side to ground, thus completing a circuit that goes the other way. Here's a couple of diagrams:

DPDTH DPDTH

Coil not energised                                                                                          Coil energised

Current flow to a motor in energised and unenergised states of the relay.

All relays have a pull-in current needed to switch the coil from de-energised to energised. Once energised, the coil becomes a magnet and attracts the metal switch to a new position closing the No (normally open) contacts and opening the Nc (normally closed) contacts. The transistor is there as a switch. If the base of the transistor receives sufficient current, it will conduct and thus open a path to ground for the coil, which will energise. Once the signal has gone from the base of the transistor, the coil has no path to ground and it will de-energise, causing the switch to go back to the original position. You need an NPN transistor for this, and since the pull-in current on the coil is not very much I use either a 2N2222 or a 2N3904. The diode is there to ensure that the transistor does not get damaged. When the coil de-energises, it drops a back EMF going the other way. If it shoots through the transistor the transistor can easily get damaged. The back EMF goes through the diode and back into the coil where eventually it is dissipated by the resistance of the coil. This process takes milliseconds. If you use an LED you can see it briefly flicker as the coil de-energises if you look carefully enough.

 

A H-bridge like this will give you a simple and cheap way to control one motor's direction but it does nothing for the speed. The easiest way is to supply the motor voltage from the emitter of a Darlington Pair, which is a set of two transistors in one package. The base of the second is fed from the emitter of the first and the two share a collector. Output is taken from the emitter of the second, and is fed to the motor supply of the relay:

darlington

If you use a microcontroller to drive your speed and direction controller you'll need two pins to feed this system. One is a digital and switches the transistor and thus the relay, and the other needs to be a PWM pin to feed the base of the Darlington.

 

This method is ultra-reliable and is the best for high-power loads. If you are making very small robots where space is limited though, you may find it very bulky as you'll need at least a square inch to fit the components. An alternative is to use a motor controller chip. Such a chip is the L293D which has two H-bridges encapsulated in a very small space. Over the page we look at this.

l293d More> Page 2 CCOG/Wheelbase Powering a Robot Battery Concerns Scrapbots Brains Practical 1 ROV Controlling