This page is divided into several sections. Choose a section to jump
to from the list, or scroll down to view the entire document.
I am by no means an expert on stepper motors. I have not completed my education, so I do not know all of the mathematics or mechanics that go into the design and operation of stepper motors. What I do know is what I have learned from my experience with these electro-mechanical wonders. This document will outline sources that carry stepper motors and how to control them manually (with discrete logic), with a microcontroller, and with computer control.
WHERE TO FIND STEPPER MOTORS
Stepper motors can be found in almost any piece of electro-mechanical equipment. From my personal experiences, good sources for stepper motors include:
Surplus dot-matrix printers
If you find one of these at a swap meet, surplus store, or garage sale for a good price, buy it! They usually contain at least 2 motors, sometimes with optical shaft encoders attached to the motors! Also a good source for matching gears and toothed belts. As a general rule, larger printers will have larger, more powerful stepper motors in them.
Old floppy disk drives
These usually contain at least 1 stepper motor, and if you're fortunate, possibly a driver IC that can be salvaged and re-used in your own projects. Along with the motor you will get some optical interrupter units used by the drive to sense the state of the write-protect tabs and to index the disk.
These places buy surplus from others and sell it to the public, often at great prices. The average price for a small to medium stepper motor is usually around $5.00.
Mail Order Companies
You can find surplus motors or even new, packaged units. Naturally the new units are going to cost more, but this may save time and money if you're building equipment with the motors that will be used at more than a "hobby" level. For general tinkering and small scale robotics, used motors will work just fine.
HOW STEPPER MOTORS WORK
We've all experimented with small "hobby motors", or free-spinning DC
motors. Have you ever tried to position something accurately with one? It
can be pretty difficult. Even if you get the timing just right for starting
and stopping the motor, the armature does not stop immediately. DC motors
have a very gradual acceleration and deceleration curves; stabilization is
slow. Adding gearing to the motor will help to reduce this problem, but
overshoot is still present and will throw off the anticipated stop position.
The only way to effectively use a DC motor for precise positioning is to use
a servo. Servos usually implement a small DC motor, a feedback
mechanism (usually a potentiometer with attached to the shaft by gearing or
other means), and a control circuit which compares the position of the motor
with the desired position, and moves the motor accordingly. This can get
fairly complex and expensive for most hobby applications.
Stepper motors, however, behave differently than standard DC motors. First of all, they cannot run freely by themselves. Stepper motors do as their name suggests -- they "step" a little bit at a time. Stepper motors also differ from DC motors in their torque-speed relationship. DC motors generally are not very good at producing high torque at low speeds, without the aid of a gearing mechanism. Stepper motors, on the other hand, work in the opposite manner. They produce the highest torque at low speeds. Stepper motors also have another characteristic, holding torque, which is not present in DC motors. Holding torque allows a stepper motor to hold its position firmly when not turning. This can be useful for applications where the motor may be starting and stopping, while the force acting against the motor remains present. This eliminates the need for a mechanical brake mechanism. Steppers don't simply respond to a clock signal, they have several windings which need to be energized in the correct sequence before the motor's shaft will rotate. Reversing the order of the sequence will cause the motor to rotate the other way. If the control signals are not sent in the correct order, the motor will not turn properly. It may simply buzz and not move, or it may actually turn, but in a rough or jerky manner. A circuit which is responsible for converting step and direction signals into winding energization patterns is called a translator. Most stepper motor control systems include a driver in addition to the translator, to handle the current drawn by the motor's windings.
Figure 1.1 - A typical translator / driver connection
|A basic example of the "translator + driver" type of configuration. Notice the separate voltages for logic and for the stepper motor. Usually the motor will require a different voltage than the logic portion of the system. Typically logic voltage is +5 Vdc and the stepper motor voltage can range from +5 Vdc up to about +48 Vdc. The driver is also an "open collector" driver, wherein it takes its outputs to GND to activate the motor's windings. Most semiconductor circuits are more capable of sinking (providing a GND or negative voltage) than sourcing (outputting a positive voltage).|
COMMON CHARACTERISTICS OF STEPPER MOTORS:
Stepper motors are not just rated by voltage. The following elements
characterize a given stepper motor:
Stepper motors usually have a voltage rating. This is either printed directly on the unit, or is specified in the motor's datasheet. Exceeding the rated voltage is sometimes necessary to obtain the desired torque from a given motor, but doing so may produce excessive heat and/or shorten the life of the motor.
Resistance-per-winding is another characteristic of a stepper motor. This resistance will determine current draw of the motor, as well as affect the motor's torque curve and maximum operating speed.
Degrees per step
This is often the most important factor in choosing a stepper motor for a given application. This factor specifies the number of degrees the shaft will rotate for each full step. Half step operation of the motor will double the number of steps/revolution, and cut the degrees-per-step in half. For unmarked motors, it is often possible to carefully count, by hand, the number of steps per revolution of the motor. The degrees per step can be calculated by dividing 360 by the number of steps in 1 complete revolution Common degree/step numbers include: 0.72, 1.8, 3.6, 7.5, 15, and even 90. Degrees per step is often referred to as the resolution of the motor. As in the case of an unmarked motor, if a motor has only the number of steps/revolution printed on it, dividing 360 by this number will yield the degree/step value.
TYPES OF STEPPER MOTORS
Stepper motors fall into two basic categories: Permanent magnet and variable
reluctance. The type of motor determines the type of drivers, and the type
of translator used. Of the permanent magnet stepper motors, there are
several "subflavors" available. These include the Unipolar, Bipolar, and
Permanent Magnet Stepper Motors
Unipolar Stepper Motors
Unipolar motors are relatively easy to control. A simple 1-of-'n' counter circuit can generate the proper stepping sequence, and drivers as simple as 1 transistor per winding are possible with unipolar motors. Unipolar stepper motors are characterized by their center-tapped windings. A common wiring scheme is to take all the taps of the center-tapped windings and feed them +MV (Motor voltage). The driver circuit would then ground each winding to energize it.
Figure 2.1 - A typical unipolar stepper motor driver circuit. Note the 4 back EMF protection diodes.
Unipolar stepper motors are recognized by their center-tapped windings. The number of phases is twice the number of coils, since each coil is divided in two. So the diagram below (Figure 3.1), which has two center-tapped coils, represents the connection of a 4-phase unipolar stepper motor.
Figure 3.1 - Unipolar stepper motor coil setup (left) and 1-phase drive pattern (right).
In addition to the standard drive sequence, high-torque and half-step drive sequences are also possible. In the high-torque sequence, two windings are active at a time for each motor step. This two-winding combination yields around 1.5 times more torque than the standard sequence, but it draws twice the current. Half-stepping is achieved by combining the two sequences. First, one of the windings is activated, then two, then one, etc. This effectively doubles the number of steps the motor will advance for each revolution of the shaft, and it cuts the number of degrees per step in half.
Full-stepping animation Half-stepping animation
Figure 4.1 - Two-phase stepping sequence (left) and half-step
Click on the links above the figure to see animated demonstrations.
Bipolar Stepper Motors
Unlike unipolar stepper motors, Bipolar units require more complex driver circuitry. Bipolar motors are known for their excellent size/torque ratio, and provide more torque for their size than unipolar motors. Bipolar motors are designed with separate coils that need to be driven in either direction (the polarity needs to be reversed during operation) for proper stepping to occur. This presents a driver challenge. Bipolar stepper motors use the same binary drive pattern as a unipolar motor, only the '0' and '1' signals correspond to the polarity of the voltage applied to the coils, not simply 'on-off' signals. Figure 5.1 shows a basic 4-phase bipolar motor's coil setup and drive sequence.
Figure 5.1 - Bipolar stepper motor coil setup (left) and drive pattern (right).
A circuit known as an "H-bridge" (shown below) is used to drive Bipolar stepper motors. Each coil of the stepper motor needs its own H-bridge driver circuit. Typical bipolar steppers have 4 leads, connected to two isolated coils in the motor. ICs specifically designed to drive bipolar steppers (or DC motors) are available (Popular are the L297/298 series from ST Microelectronics, and the LMD18T245 from National Semiconductor). Usually these IC modules only contain a single H-bridge circuit inside of them, so two of them are required for driving a single bipolar motor. One problem with the basic (transistor) H-bridge circuit is that with a certain combination of input values (both '1's) the result is that the power supply feeding the motor becomes shorted by the transistors. This could cause a situation where the transistors and/or power supply may be destroyed. A small XOR logic circuit was added in figure 6.1 to keep both inputs from being seen as '1's by the transistors.
Another characteristic of H-bridge circuits is that they have electrical "brakes" that can be applied to slow or even stop the motor from spinning freely when not moving under control by the driver circuit. This is accomplished by essentially shorting the coil(s) of the motor together, causing any voltage produced in the coils by during rotation to "fold back" on itself and make the shaft difficult to turn. The faster the shaft is made to turn, the more the electrical "brakes" tighten.
Figure 6.1 - A typical H-Bridge circuit. The 4 diodes clamp inductive kickback.
Variable Reluctance Stepper Motors
Sometimes referred to as Hybrid motors, variable reluctance stepper motors are the simplest to control over other types of stepper motors. Their drive sequence is simply to energize each of the windings in order, one after the other (see drive pattern table below) This type of stepper motor will often have only one lead, which is the common lead for all the other leads. This type of motor feels like a DC motor when the shaft is spun by hand; it turns freely and you cannot feel the steps. This type of stepper motor is not permanently magnetized like its unipolar and bipolar counterparts.
Figure 7.1 - Variable reluctance stepper motor coil setup (left) and drive pattern (right).
EXAMPLE TRANSLATOR CIRCUITS
In this section, I will show examples of basic stepper motor translation
circuits. Not all of these examples have been tested, so be sure to
prototype the circuit before soldering anything.
Figure 8.1 illustrates the simplest solution to generating a one-phase drive sequence. For unipolar stepper motors, the circuit in Figure 2.1, or for bipolar stepper motors, the circuit in Figure 6.1 can be connected to the 4 outputs of this circuit to provide a complete translator + driver solution. This circuit is limited in that it cannot reverse the direction of the motor. This circuit would be most useful in applications where the motor does not need to change directions.
|Figure 8.1 - A simple, single direction, single phase drive translator.|
Figure 9.1 is an translator for two-phase operation. I have seen this
circuit many places, but I believe it originated from The Robot Builders'
Bonanza book, by Gordon McComb. I have used this circuit in the past and
seem to recall that it had a problem. This may not be the case but I think
when you reverse direction and continue stepping, the motor will advance 1
more step in the previous direction it was going before responding. As
always, prototype this circuit to be sure it will work for your application
before you build anything with it.
|Figure 9.1 - A simple, bidirectional, two-phase drive stepper motor translator circuit.|
There are several standard stepper motor translation circuits which use
discrete logic ICs. Below you will find yet another one of these. The
circuit in Figure 10.1 has not been tested but theoretically should work
|Figure 10.1 - Another example of a two-phase drive translator circuit, this time using a multiplexer.|
Below you will find some small pieces of code, mostly in C/C++, some in
Assembly language for various processors and microcontrollers. This code is
by no means complete, but is provided only to give a basic understanding of
the software involved in controlling stepper motors both with and without
the use of a hardware translator circuit.
When making connections to either a PC parallel port, or I/O pins of a
microcontroller, be sure to isolate the motor well. High voltage spikes of
several hundred volts are possible as back EMF from stepper motor coils.
Always use clamping diodes to short these spikes back to the motor's power
bus. The use of optical isolation devices (optoisolators) will add yet
another layer or protection between the delicate control logic and the
high-voltage potentials which may be present in the power output stage.
Whenever possible, use separate power supplies for the motor and the
translator / microcontroller. This further reduces the chance of destructive
voltages reaching the controller, and reduces or eliminates power supply
noise that may be introduced by the motor.
If you're using a computer that has a parallel port as part of its onboard I/O, you may want to consider purchasing a parallel port card to use instead. I've seen them for as little as $9.99 at Fry's Electronics and other computer stores. Not only does this reduce the risk of permanently damaging or destroying your motherboard (it happened to a friend of mine!), but it will also allow you to experiment without the need for swapping cables or flipping a switchbox when you want to use your parallel printer, since your experiments won't be sharing its port. It is much cheaper to throw out a $10.00 parallel port card than it is to replace your motherboard!
Under complete software control, there is no translator circuit external to
the Parallel port or microcontroller. This scheme reduces parts count,
component cost, and makes for simpler board design. On the other hand, it
places the responsibility of generating all of the sequencing signals on the
software. If the PC or microcontroller is not fast enough (due to code
inefficiency or slow processor speed), or too many motors are driven
simultaneously, things can begin to slow down. Interrupts and other system
events can plague the control software more in this case. Despite the
downfalls of addressing a stepper motor directly in this manner, it is
definitely the easiest and most straightforward approach to controlling a
stepper motor. This method of controlling a motor can also be useful where
the hardware is not critical at first and a simple interface is needed to
allow more time to be spent on the development of the software before the
hardware is refined.
Unless otherwise indicated, all
material on this site is the original work of Jason Johnson.
© 1998 Jason Johnson
This page was stolen from:
It credits the article to Jason Johnson whom I was unable to contact for permission to use this material. I make every attempt to give credit where it is due and to preserve any links or identifiable credits. If you are Jason Johnson, someone from EIO.com or object to my re-posting of this material and want me to take it down, please contact me and I will immediately comply. My desire was not to profit or benefit from this material, rather I just wanted to share this information with others and preserve it for my reference.