AN155
S
TEPPER
M
OTOR
R
EFERENCE
D
ESIGN
Introduction
Stepper motors are used in a wide variety of
applications. They are prevalent in consumer office
equipment such as printers, plotters, copiers, and
scanners. Stepper motors are also used in automotive
applications for electronic throttle control, dashboard
indicators, and climate control systems. Stepper motors
are also found in industrial equipment such as robotics,
electronic component handlers, testers, dispensers, and
other manufacturing equipment.
Stepper motors are often controlled using special
function ICs that provide limited control functionality.
Such ICs often employ a rudimentary step forward and
back interface to the microprocessor that limits system
performance. Other stepper motor systems are PC card
based and use a host PC to provide high performance
control.
In embedded systems it is much better to use a small
microcontroller to directly control the stepper motor. A
very small microcontroller such as the C8051F300 is
capable of providing a high performance motion control
solution. The microcontroller implements a linear-
velocity profile, generates the precise timing required,
and outputs the stepping pattern used to drive the
motor. The microcontroller directly drives the power
MOSFETs and no addition gate drive circuitry is
required.
The
microcontroller
also
provides
serial
communications for remote control and distributed
systems. This reference design uses a RS232 port
operating at 57600 bps. This demonstrates the
feasibility of using serial control. It is equally feasible to
use SMBus, I2C, RS485, or some more advanced
UART based network protocol. The C8051F300 is
housed in a very small form factor MLP11 package,
measuring only 3 mm square. The entire stepper motor
drive can easily be integrated onto the back of a small
stepper motor. A system with multiple motors may use a
single small microcontroller for each motor.
The C8051F300 is ideally suited for driving a stepper
motor. The small form factor lends itself to integrated
motor solutions. The on chip UART and SMBus provide
serial communication and control. The calibrated
internal oscillator eliminates the cost and pin-count of
using an external crystal, while providing an accurate
time base for high speed UART and precise motor
Rev. 1.0 1/04
timing. The low-pin count package has enough pins to
drive the stepper motor and RS232 transceiver, with two
additional I/O pins left over for special functions.
This reference design demonstrates a high
performance stepper motor system using the
C8051F300. The reference design provides for both
stand-alone demo operation and UART control. The
reference design may also be used as a platform for
stepper motor code development using the C2D two-
wire on-chip debug and Flash programming interface.
The reference design is complete with schematic, bill of
materials, printed circuit board artwork, code flowcharts,
and source code. The software is also available for
download from the Silicon Laboratories web site.
Using the Stepper Motor Reference
Design
Quick Start
The recommended stepper motor listed in the Bill of
Materials is the GBM model number 42BYG205,
available from Jameco Electronics
®
. Connect the GBM
42BYG205 stepper motor to the stepper motor
reference design using the color code shown in Table 1.
Table 1. GBM 42BYG205 Color Code
Color
red
yellow
blue
green
orange
brown
A+
Acommon
A-
B+
Bcommon
B-
Name
Connect the 9 V DC power supply to the 2.1 mm power
connection on the stepper motor reference design. Plug
the power supply into 120 VAC power source. The LED
labeled “PWR” should illuminate.
Copyright © 2004 by Silicon Laboratories
AN155-DS10
Silicon Laboratories Confidential. Information contained herein is covered under non-disclosure agreement (NDA).
AN155
Press the function switch labeled “FUNC”. The stepper
motor should turn four turns. The green status LED
labeled “STAT” should illuminate while the motor is
turning. Press the function switch again. The motor will
rotate four turns the other direction.
It the LED does not illuminate, check the power
connection. If the motor does not turn, check the motor
wiring.
If using a stepper motor other than the GBM
42BYG205, follow the color code provided with that
particular stepper motor. Note that there is no standard
color code for stepper motor wiring. It is best to double-
check the wiring with a digital multi-meter. A 30
Ω
stepper motor should measure 60
Ω
from A+ to A- and
30
Ω
from A+ or A- to Acommon. Phase B should
measure similarly. A high impedance should be
obtained when measuring from any phase A wire to any
phase B wire.
Type
s
and
the stepper motor will display the current
position and acceleration parameter. The text following
the prompt sign is always user input.
>s
Position:
0
Acceleration:
80
>
The stepper motor will turn one complete rotation in 400
steps. Type
p4000
and then hit enter. The stepper
motor will turn 10 rotations and then stop, While moving,
the terminal will display the message
Moving...
and
the current position of the motor. The display is updated
periodically while moving. When the move is complete
the number will stop at the final position and the
terminal will display the message
done!
and a
command prompt sign
>.
>p4000
Moving...
Position:
4000
done!
>
Now type
a120
and hit enter. The terminal will display
the new acceleration to verify the parameter change.
>a120
Acceleration:
120
>
Now type
p0
and hit return. The stepper motor will
rotate ten turns the other direction at a slower rate.
A smaller number results in a faster acceleration and a
faster top speed. If you set the acceleration factor far
too small the motor will stall at the maximum slewing
speed. If the acceleration parameter marginally too
small, the motor will have very low torque in the slewing
region.
The parser will ignore any non-numeric characters
between the command letter and the first number. For
example
p1000, p 1000, position 1000,
and
pig
1000
will all be interpreted as a position 1000
command. The parser does not understand capital
letters.
The number parsing is terminated by the first non-
numeric character. So it doesn’t really matter what you
type after the number. It could be a carriage return,
space, period, or any non-numeric character.
Setting up HyperTerminal
Connect a DB9 serial modem cable to the stepper
motor reference design RS232 connector. Connect the
other end to a serial port on the back of a Windows PC.
Note which COM port is connected to the Stepper Motor
Reference Design.
Open
HyperTerminal
from
the
start
menu.
Start>Programs>Accessories>Communication>HyperT
erminal.
When prompted for a new connection name,
type in
StepperMotor
or some other descriptive name.
In the next dialog box, click on the
connect using
pull-
down menu and select the appropriate COM port (e.g.
COM4). Click on OK to exit the new connection dialog
box. In the next dialog box choose 57600 bits per
second, 8 data bits, no parity, 1 stop bit, and no flow
control.
Now hit return a few times. A prompt sign and a new
line should be displayed each time the return key is
depressed. If prompt is not displayed, double-check the
connections and the serial port settings. Make sure the
stepper motor board is plugged in and powered up. To
assist in debugging, test points are conveniently
provided for the TX and RX connections on the stepper
motor reference design.
Command Line Operation
The command line parser understands three
commands. The commands are
p
for position,
a
for
acceleration, and
s
for status. Each command must
start with a lowercase letter. The position and
acceleration commands are followed by a number
string.
2
Rev. 1.0
AN155
The number parser for the position expects an unsigned
16-bit integer. You can enter any position from 0 to
65535. If you enter 65536, it will be interpreted as a
zero. The acceleration parser expects an unsigned 8-bit
integer. The range is 0 to 255. If you enter 256 it will be
interpreted as a zero. The number 257 will be
interpreted as a one. Entering a zero or a very small
integer may produce unpredictable results.
The most common type of stepper motor construction
used for industrial motion control is the hybrid
permanent magnet motor. The rotor is constructed
using a cylindrical permanent magnet oriented with the
north-south polarity along the rotor axis. Two laminated
end caps are used with many teeth around the
periphery. The north and south teeth are staggered to
provide many effective poles using a single permanent
magnet. The stator laminates typically have four large
forks. Each fork has many teeth. The teeth for the two
windings are also staggered to line up with the
appropriate teeth on the rotor. Using this clever
arrangement, a 200-pole motor can be constructed
using a single permanent magnet and only four stator
windings.
Theory of Operation
Motor Basics
The primary distinguishing feature of stepper motors is
the manner in which they are driven. Stepper motors are
moved in discrete steps. This is in contrast to other
types of motors such as d.c. and brushless d.c. motors
which are typically controlled using continuous mode
analog control methodologies. The position of a stepper
motor may be expressed using an integer. The stepping
rate in steps per second is typically used to describe the
angular velocity.
Because stepper motors are driven in discrete steps,
they excel at absolute positioning applications. The
most commonly available stepper motors move in
precise increments of 1.8° or 0.9° per step.
Stepper motors are controlled directly. The primary
command and control variable is the step position. This
is in contrast to d.c. motors where the control variable is
the motor voltage and the command variable may be
either position or velocity. A d.c. motor requires a
feedback control system and controls the position
indirectly. A stepper motor system is normally operated
“open loop”.
Drive Types
The two common drive topologies for stepper motors
are unipolar and bipolar. A unipolar drive uses four
transistors to drive the two phases of the stepper motor.
The motor has two center-tapped windings with six
wires emanating from the motor as shown in Figure 1.
This type of motor is sometimes rather confusingly
called a
four-phase
motor. This is not an accurate
representation as the motor really has only two phases.
A more accurate description would be a two-phase, six-
wire stepper motor. A six-wire stepper motor is also
often called a
unipolar
stepper motor. However, a six-
wire stepper motor could be used with either a unipolar
or bipolar drive.
+12V
A+
Stepper Motor Construction
Stepper motors may be classified by their motor
construction, drive topology, and stepping pattern.
There are several different types of stepper motor
construction. These include variable reluctance,
permanent magnet, and hybrid permanent magnet. This
reference design is applicable to the permanent magnet
and hybrid two or four phase stepper motors.
Permanent magnet stepper motors are very
inexpensive and have a large stepping angle of 7.5° to
18°. Permanent magnet stepper motors are often used
in inexpensive consumer products. Hybrid stepper
motors are a bit more expensive and have stepping
angles of 1.8° or 0.9°. Hybrid stepper motors are
predominant in industrial motion control applications.
Variable reluctance motors typically have three or five
phases and require a different drive topology. Variable
reluctance stepper motors are not addressed in this
reference design.
A-
B+
B-
Q1
Q2
Q3
Q4
Figure 1. Unipolar Stepper Motor Drive
Rev. 1.0
3
AN155
The center tap of the motor winding is connected to the
positive voltage supply. Each coil can be energized in
either direction by turning on the appropriate transistor.
The center-tapped winding acts as a transformer. So the
voltage on the unused switch will be twice the supply
voltage.
A clamped unipolar drive circuit is shown in Figure 2.
When Q1 is turned on, current will flow from the +12V
supply, through the A winding, through Q1 to ground.
When Q1 is turned off, the current will tend to continue
to flow through the winding inductance. The drain
voltage of Q1 will rise above the supply voltage. The
center-tapped winding acts as a transformer. Thus,
when the voltage on A+ reaches 24 V, the voltage on
the A- terminal will go below ground and be clamped by
the internal diode of Q2. There is also a considerable
amount of uncoupled inductance in each winding. This
will cause an additional overshoot voltage when the
transistor is turned off. The four diodes D1-D4 and the
clamp zener D5 form an effective clamp circuit to limit
the overshoot voltage. The zener voltage should be
slightly higher than twice the maximum supply voltage.
A bipolar stepper motor drive uses eight transistors to
drive the two phases as shown in Figure 3. A stepper
motor with four wires or six wires may be used with a
bipolar drive. A four-wire motor can only be used with a
bipolar drive. The four-wire motor might be marginally
less expensive in high volume applications. The bipolar
stepper motor drive uses twice as many transistors as
the unipolar stepper motor drive. The four lower
transistors can be usually be driven directly from the
microcontroller. The upper transistors require a more
expensive high-side drive. The bipolar drive transistors
only need to withstand the motor supply voltage. The
bipolar drive does not require a clamp circuit like the
unipolar drive.
D1
D2
D3
D4
D5
+12V
A+
A-
B+
B-
Q1
Q2
Q3
Q4
Figure 2. Unipolar Stepper Motor Drive with Zener Clamp
4
Rev. 1.0
AN155
+V
M
Q1
Q2
Q3
Q4
Q5
Q6
Q7
Q8
Figure 3. Bipolar Stepper Motor Drive
The performance differences between unipolar and
bipolar drives are subtle. The unipolar drive only uses
half of the actual motor windings at any one time. Thus,
the bipolar stepper motor should theoretically have
much better performance for a given motor volume. In
practice, this is not always the case. Often the six-wire
stepper motors have a lower phase resistance and
consequently a higher holding torque for a particular
motor size. The trade-offs of unipolar versus unipolar
are summarized in Table 2.
7.2° for the full pattern. A full step pattern is shown in
Table 3. In the full-step pattern, two transistors are
always on. The first two columns indicate whether the A
and B phase voltages are positive
+,
negative
-,
or high
impedance
z.
The next four columns indicate the state
of the four transistors for the unipolar stepper motor
shown in Figure . The last column is the state of all four
transistors expressed in hexadecimal for use with
microcontrollers.
Table 3. Unipolar Full-Step Pattern
Table 2. Bipolar vs. Unipolar Trade-offs
A
Bipolar
number of transistors
number if high-side drivers
number of clamps
transistor voltage
winding usage
motor wires
8
4
0
1 x Vs
100%
4
Uni-polar
4
0
4
2.5 x Vs
50%
6
Note that the transistor order in Table 3 has been
rearranged listing Q3 before Q2 to yield a clear pattern.
The polarity of the A and B windings is only important in
determining if the rotation of the motor is clockwise or
counter clockwise. Swapping the polarity of either
phase will change the direction of the motor. Swapping
A and B windings will result in no change of rotation.
-
-
+
+
-
+
+
-
B
Q1
0
0
1
1
Q3
0
1
1
0
Q2
1
1
0
0
Q4
1
0
0
1
Hex
0x03
0x06
0x0C
0x09
Stepping Patterns
The two possible stepping patterns for stepper motors
are full-step and half-step. A full-step pattern has four
states and moves the motor one full step for each state.
A 1.8° stepper motor will move 1.8° for each state and
Rev. 1.0
5