Stepper Motor Control Circuits
I have finally reached a point that I think I understand the different types of stepper motors, variable reluctance, permanent magnet unipolar and bipolar motors and have even have an idea about some of the hybrid stepper motors out there. But how do you make them run? What kind of electronics are used to make the whirr into life? This section will describe some methods to the madness as well as point you to some areas of the Internet that I have found some control circuits.
One thing I want to make clear before I start is that I am focussing on permanent magnet unipolar stepper motors. This is not because I prefer them over all the other types, but rather because those are the type that I have most easily got my hands on when scrapping old printers.
Stepper Motor Control Circuits
I will be focusing on unipolar motors in this section, but I will also try to place links to controllers and circuits for bipolar motors as well.
Stepping a Stepper Motor
As you may recall from the STEPPER MOTOR research section, a stepper motor is run by sending a sequence of pulses to each coil in the motor causing it to jog or step in one direction or another. The direction is dependant on the order that you energise the coils. The are three basic ways you can send these pulses to the coils these are Full Stepping with one coil, full stepping with two coils, and half stepping. (I need to make a distinction here. There is a term used when full stepping with one or two coils but I cannot remember them off the top of my head. When I find them or if I recall them I will update this part of the page. Suffice it to say though that when you full step the motor with two coils, that you get much more torque from the motor because you have the magnetic field of the coils to hold the rotor in place.)
Full Stepping With One Coil - In the table below you will notice each coil in the motor. These are labeled as Θ1, Θ2, etc. The values listed below these are either a 0 or a 1. 0 means that no power is applied to the coil and a 1 means that power is applied to the coil. Each row of the table represents time. If you look at the table you see that on the first row (time period) that the first coil is energized and the other three coils are off. During the next time period you see the first coil has been shut off while the second has been turned on. This causes the rotor to move one position. If each time period we de-energize the coil and energize the next coil we can make the motor turn. When we reach line five we simply start the pattern over again. This process will full step a motor using one coil.
Θ1 | Θ2 | Θ3 | Θ4 |
---|---|---|---|
1 | 0 | 0 | 0 |
0 | 1 | 0 | 0 |
0 | 0 | 1 | 0 |
0 | 0 | 0 | 1 |
1 | 0 | 0 | 0 |
This type of control can be set up a number of ways from using stepper motor control ICs to using simple logic. One that comes to mind is a 2 bit binary counter made from JK Flip Flops and some decode logic for each phase. This can be done like below:
(Image of single step circuit here.)
Full Stepping With Two Coils - The table below describes how a motor is stepped using two coils. The table set up is the same as above with the coils listed at the top and each row representing time. The only difference is that two adjacent coils are energized.
Θ1 | Θ2 | Θ3 | Θ4 |
---|---|---|---|
1 | 1 | 0 | 0 |
0 | 1 | 1 | 0 |
0 | 0 | 1 | 1 |
1 | 0 | 0 | 1 |
1 | 1 | 0 | 0 |
The above circuit can be implemented with XOR gates and JK Flip Flops. The circuit shown below was the first discreet component circuit I found on the internet and I have prototyped it on some protoboards. I used this circuit to drive some 2N2222 transistors to run a floppy drive motor, and it works.
(Pic of xor jk circuit here)
A couple of things should be noted about single stepping a stepper motor. When single stepping you limit that maximum speed at which a motor can run. It will reach a point that it will miss steps and not perform. I understand this to be cause from two things, one has to do with the motor and the frequency it is running at. (I do not pretend to understand this) The other is that the faster you cycle the coils the less time each coil has to build up a magnetic charge or stated another way, the coil does not rise to its full current value before it is switched off. Because of this the faster the motor runs the more torque it will lose, to the point that there is not enough magnetic force to move the rotor to the next position. (This can be overcome by driving the motor at a higher than rated voltage, but more on this later.) And the second problem you encounter with full stepping the motor is that it is subject to jerky starts and stops. (This is caused as I see it from the number of steps the motor has per revolution. Obviously, the fewer the steps the more jerky the motor will be.) This can be overcome by half stepping, 1/4 stepping, 1/8 stepping, etc.
Half Stepping a Stepper Motor - When you full step with a single coil the rotor moves to point to the coil that is energized. When you switch to the next coil, the rotor moves to face that coil. When you full step with two coils the rotor move to point between the two coils that are energized. Again, when you de-energize the first coil and energize the third coil the rotor moves to point between coils two and three. If you were to conceptually overlay these two methods you end up with the table you see below. To help visualize this, you will notice that the 1st, 3rd, 5th, 7th and 9th rows look just like the first table above and the 2nd, 4th, 6th and 8th rows look just like the second table listed above. So to expand on the rotor movement description above we find the when coil one is energised the rotor points to coil one, then in the next time cycle (row 2) we leave coil one on and turn on coil two, this causes the rotor to move and point between coils one and two, then the next time cycle (row three) we turn off coil one and leave coil two on. This causes the rotor to point to coil two. You can work your way down the table like this. The end result is that the rotor points to twice as many locations as it makes one revolution. So if I had a stepper motor that would make 200 step per revolution while single stepping, I would expect it to make 400 steps (double) by making it half step.
Θ1 | Θ2 | Θ3 | Θ4 |
---|---|---|---|
1 | 0 | 0 | 0 |
1 | 1 | 0 | 0 |
0 | 1 | 0 | 0 |
0 | 1 | 1 | 0 |
0 | 0 | 1 | 0 |
0 | 0 | 1 | 1 |
0 | 0 | 0 | 1 |
1 | 0 | 0 | 1 |
1 | 0 | 0 | 0 |
There are gains to be had by running your motor this way. Because a coil is energised a little longer it has time to build up a larger magnetic field and allow you to run it at higher speeds before you lose torque and start missing steps. The second advantage is that you can get smoother starts and stops because we double the resolution (steps per revolution) of the motor.
There are many ICs available to perform this function. These ICs usually have two inputs. One for a stepping pulse and another line for the direction. These ICs can be emulated with basic counters and decoders if one was inclined to do so. The second circuit I built was like this. I used a 74x193 four bit counter with a 74x138 decoder and coupled it with some basic logic to create the sequence above. You can see the schematic below:
(Counter Decoder driver circuit here)
Stay Tuned - More to come!