Stepper Motors


Intro

Stepper motors enable precise positioning without needing sensors to measure motor position. Each pulse to a stepper motor turns its shaft one step which for many steppers is 3.6 degrees. One hundered pulses will turn a 3.6 degree stepper exactly one revolution. Other common step sizes are 1.8 (200 steps/rev), 3.75 (96 steps/rev) and 7.5 (48 steps/rev) degrees. The disadvantage of steppers is that they are more complex to control and consume precious battery current when not moving if the coils are on. This tech note will guide you through selecting and obtaining stepper motors, interfacing them to a computer board, and writing control code.

Finding a stepper motor

Stepper motors are available new, from surplus houses, or can be pulled from old electronic equipment such as floppy drives. Jameco has a nice selection, also Ax-Man typically has a variety. Parallax sells a stepper (PN # 27964), a little pricey, but comes with excellent application notes.

Look for "unipolar" or "4-coil" or "4-phase" motor (they all mean the same thing) with 5 or 6 or 8 wires. Avoid "bipolar" motors because they require an entirely different control scheme.

Key specs are operating voltage (12V is convenient for robotics projects), and either coil current or coil resistance (given one spec you can get the other from V=IR). Look for motors with a coil current of 250 mA or less (coil resistance of 48 ohms or more for a 12V motor). Higher currents do give higher torque, but will also drain your battery faster. Another key spec is the holding torque which is how much torque the motor can resist when energized.

If you are pulling a motor from an old floppy drive, look for a flat motor with five or six leads.

Identifying stepper motors

If you are staring at a pile of stepper motors in a surplus shop, or have pulled one out of used equipment, here's how you can determine what you have.

First, check for the number of wires coming out. If 5 or 6 or 8, that's good because you have a unipolar stepper. If 4, that's bad because you have a bipolar stepper and should put it back. If 2, you have a regular DC motor. Confirm you have a stepper motor by turning the shaft. You should feel the little detents indicating each step.

Next, read the label on the side. If you are lucky, it will have the voltage and step size printed, or will be in a bin with the voltage marked. Look for 12V steppers. If you have a 5V stepper, and it is large, the currents will probably be too large for easy control. Small 5V steppers are OK. If you have no way of telling the voltage, it is probably best to look for another stepper.

Next, get out your digital ohmmeter and start reading resistances between the leads. You will get different values depending on which pair of leads you measure. The lowest resistance you find is the coil resistance. Use I=V/R to compute the coil current. If 250 mA or less, you are in good shape.

Look at the output shaft and determine if it is something you can handle. Common steppers have plain shafts with 0.125, 0.196 or 0.250 diameter. Gears press fit onto the shaft may be useful to you or can be removed.

Consider the size and weight of the stepper. Very large or very heavy steppers will most likely require more current than you can control. Many steppers come in standard NEMA (National Electrical Manufacturer's Assocation) sizes. NEMA size 14, 15, or 16 are typically cubic in shape with the front mounting flange 1.38 to 1.65 inches on a size, and are great for robotics. NEMA size 23 are cylindrical with a square mounting flange 2.22 inches on a side. Size 23 motors may require too much current so check the specs carefully. Another common shape are stacked cans with a diamond-shaped mounting flange. Smaller sizes are also good for robotics.

Here are some schematics of stepper coil configurations.

Here is some data for common steppers, including pictures.

Identifying the leads of unipolar steppers

If you can find identifying marks on the stepper, you might get lucky and find the data sheet on the web, which will have the lead wire colors. Or if you are lucky, your stepper is listed in our data for common steppers section. If not, you'll need to do dectective work described next.

Unipolar stepper motors have four coils and either five, six or eight wires. No matter how many wires, unipolar stepper motors are interfaced in the same way. Five wires will go to the controller circuit. To identify wires, you need a resistance meter.

First, identify the common lead. For the six and eight wire versions, some wires are twisted together to form the common lead and reduce the lead count to five. The common lead is connected to the positive of your battery or power supply.

Now identify individual coils in order of sequence.

Interfacing circuits

The simplest way of interfacing a unipolar stepper to a computer control board is to use a ULN2003A transistor array chip. The ULN2003A contains seven darlington transistor drivers and is somewhat like having seven TIP120 transistors all in one package. The ULN2003A can pass up to 500 mA per channel and has an internal voltage drop of about 1V when on. It also contains internal clamp diodes to dissipate voltage spikes when driving inductive loads. Here is a data sheet. The ULN2003A is available from Jameco.com and from the ME2011 robot store.

For higher current torque motors, or if you don't have a ULN2003A, you can control the coils with four TIP120 darlington transistors. The advantage is that the TIP120's can pass more current (especially if you add a heat sink). The disadvantages are that more wiring is required, the TIP120 has a larger voltage drop leaving less for the motor, and the four TIP120's take up more room.

Here are schematics showing how to interface a unipolar stepper motor to four controller pins using a ULN2003A, and showing how to interface using four TIP120's.

Software

Software for controlling a stepper motor with the Arduino.

Stepper motor resource links

Additional information on stepper motors is available at these links:

Experiment #26: Stepper Motor Control (From the Parallax Stampworks manual)

Application Note #6: A Serial Stepper Controller (From the Parallax BASIC Stamp I Application Notes)

Control of stepping motors, a tutorial (Douglas Jones, Univ Iowa)

Motors (Tom Igoe)

Pulling and using stepper motors from floppy drives

Interfacing a 4-wire bipolar stepper to the Basic STAMP (Jason Babcock)

Software for controlling a stepper motor with the Parallax Basic STAMP. (Before 2009, ME2011 used the STAMP.)