Electronic Control of a Stepper Motor

The schematic (below) shows the electronics required to drive a stepper motor. Three commonly available chips and four power transistors are pretty much all that is needed for complete control of a stepper motor.

[Image of Electronic Schematic]


The clock is the ubiquitous 555 timer chip. It produces an unending stream of pulses at the rate defined by the variable resistor, or speed control.


The two counters on this chip each divide the clock pulses by two. The result is a steady, two-bit binary code:

    00, 01, 10, 11


[Image of XOR Schematic] The four XOR gates on this chip do several things. The binary code is turned into Gray code:

    00, 01, 11, 10

The Gray code is made to count backwards if the direction switch is closed:

    10, 11, 01, 00

[Animation of stepping sequence] Finally, the Gray code is expanded into stepping sequences for each coil:

    1100, 0110, 0011, 1001


Four PNP power transistors boost the weak electronic signals into current powerful enough to drive the motor coils. The diodes next to each transistor short out the nasty backlash that is generated each time a coil switches off. As a coil's magnetic field collapses, the reverse induction can generate a momentary hundred volt spike that can fry electronics (I learned that one the hard way). The reason for using PNP transistors instead of the more common NPN variety is that TTL chips are better at sinking current than sourcing it.

Power Regulator

Some types of chips are particularly sensitive to voltage fluctuations. The 7805 power regulator will take any voltage between 6v and 12v DC and turn it into a smooth 5v to power the chips.

All the parts needed to build this circuit are available at Radio Shack, but be aware that Radio Shack's prices for components are literally quadruple that of other electronics stores.

Part Type Qty. R.S. #
Astable Timer 555 1 276-1723
Dual D flip-flop 74HCT741 276-2816
Quad XOR 74HCT861 276-2819
PNP pwr. transistor10W 4 4 x 276-2027
Diode 1A 4 2 x 276-1102
Resistor 1k 5 271-1321
Potentiometer 100k 1 271-092
Capacitor 1uF 2 2 x 272-996
Capacitor 100uF 1 272-1016
5 volt regulator 7805 1 276-1770

The easiest method of building the circuit is on an electronic breadboard. They are available at all electronics stores.

[Photo of completed project] The completed circuit has two controls; the speed potentiometer, and the direction switch. The higher the resistance of the potentiometer, the slower the motor will turn. At low resistance settings the motor will turn at several revolutions per second, but beyond a certain limit the motor will be unable to keep up and will start to skip steps and vibrate. At the other extreme one can easily achieve speeds lower than 1 RPM. Disconnecting the potentiometer (which is equivalent to an infinite resistance) will stop the motor, but leave it powered so that the shaft won't free-wheel. Unlike regular motors, stepper motors are designed to handle continuous current in their coils. One cannot burn out a stepper motor. The best way to completely turn off the motor (to let it free-wheel) is to disconnect the motor's power.

Last modified: 18 July 1999