02 - Why, or why not, choose stepper motors

Submitted by Webbot on June 10, 2008 - 10:26pm.


So you may currently have experience of the following kinds of drive motors:-

1. DC Motors

Apply some kind of voltage and they spin in one direction or another at some kind of speed.

2. Servos

Apply a pulse between about 1ms and 2ms (or thereabouts) and the motor will spin one way or the other at some kind of speed.


Notice how these last two statements were rather vague? That’s because each motor is different from the next (i.e. the manufacturing process is not perfect), and the response may vary depending on your battery voltage, how much current your battery can provide, even temperature! So the way the motor behaves can change with time and environment.


The classic ‘tell tale sign’ is – connect either 2 servos to the same pulse, or 2 DC motors to the same battery, put the robot on the floor, and see if it goes in an exact straight line….’no it doesn’t’ and a $100 fine to anybody who says that it does!


Lets forget extra problems like slightly different wheel circumferences, wheel slip on a smooth surface etc – basically any 2 motors never, quite, perform in the same way. Fact. And these errors get worse with time – i.e. after 10 seconds your robot may have moved 4 inches ‘off the straight and narrow’ – imagine where it might be after 60 minutes!!! So this kind of control is called ‘open loop’ – as there is no feedback from the output back to the input that changes behaviour.


The traditional method to fix this issue is to add Encoders. These allows you to work out how fast the motors are actually rotating so that you can change the value sent to your motor so that they can be used for a more reliable sense of position or direction. This introduces other topics such as PID. These are ‘closed loop’ systems since something about the output (from the encoders) is being feed back to the input to change future outputs and achieve a desired result. This feedback ‘closes the loop’.


Why all this complexity in a non-stepper environment? Well its basically because:-

1. You know what you want your motors to do

2. You tell the motors what to do

3. As all good teenage motors do - they don’t quite do what you ask them to

4. So you use encoders to find out what they actually did do

5. So that you can go back to step 2 and give them a good telling off to make sure they do what you want


“Yeah – I know all that – I came here to find out about stepper motors.”


If you apply a voltage to DC motors they spin, apply a pulse to a modified servo then they spin – apply either to a stepper motor then it doesn’t spin at all!! The principals will be discussed in the next section – but, in basic terms, you need to supply pulses to different parts of a stepper motor in a given sequence. Each of these pulses will make the motor step a given number of degrees – no more and no less. So if your motor has a 10-degree step then 36 ‘steps’ or ‘clicks’ will make it move through one revolution (ignoring gearing – see later).


So why is this different? For a DC motor we gave it a voltage and used an encoder to find out how fast it was running. For a 10-degree stepper motor we can issue 36 steps and know that it has done one revolution, say.


So in basic terms: with a DC motor use an encoder to find out what the motor did. With a stepper motor then it only does what you asked it to do so you don’t need the encoder (maybe?).


Of course – all motors and encoders lie – ie if your robot is going full steam ahead and you immediately ask it to go full steam in reverse then a DC motor encoder may lie (as it doesn’t realise you’ve just made a 6ft skid mark whilst the motor was changing) and the stepper motor may also have been rotated against its will due to momentum and since you never asked it to do this then you are also unaware.


Depending on the speed, acceleration, weight (ie momentum) of your robot then a stepper motor may do a much better job in an ‘open loop’ system than a DC or servo motor.



Why not use a stepper motor?

Stepper motors are ‘slower’ than DC motors and servos. As we will see in the next section each ‘step’ creates a physical movement. This movement has to finish before you can generate another step. So there is a maximum frequency at which you can generate steps. If you exceed this frequency then it will probably mean that the motor just fails to turn. So before you buy a stepper motor then make sure you know its ‘frequency’ as this will dictate the maximum speed (in revolutions per minute) that you can run the motor– see my practical example later.


You may, by now, think that a stepper motor means you can do without an encoder – but you still need to consider errors caused by skidding, or momentum, etc as mentioned earlier.