DSP Control of Stepper Motor
DSP Control of Stepper Motor
= =
(1)
( ) sin( )
a r m
e N N
r
= (2)
Where N
r
is the number of rotor teeth and
m
is
the motor maximum magnetic flux.
Note that at the reference position 0 = , the north
pole on the rotor is fully aligned with A-axis pole so
that the A-phase back EMF is then zero.
For phase B, the back EMF becomes
(3) ( ) sin( / 2)
b r m r
e N N =
The voltage equations of a two-phase hybrid
stepper motors, can be obtained as,
sin( )
a
a s a s r m r
di
V r i l N N
dt
= +
(4)
sin( / 2)
b
b s b s r m r
di
V r i l N N
dt
= +
(5)
From the Eqns (2-3)
sin( )
a s r m
a r
a
s s s
di r N V
i N
dt l l l
= + +
(6)
sin( / 2)
b s r m
b r
b
s s s
di r N V
i N
dt l l l
= + +
(7)
The electromagnetic torque produced by a two-
phase hybrid stepper motor is equal to the sum of the
torque resulting from the interaction of the phase
currents and magnetic fluxes created by the magnets
and the detent torque, which results from the saliency
of the rotor:
The torque produced by a current in winding A
is given by
a
i
sin( )
a r m a r
N i N = (7)
e
a
()
R
a
L
a
V
a
i
a
Similarly, the torque developed by current is
given by.
b
i
(8) sin( / 2)
b r m a r
N i N =
The detent torque
sin(2 )
d dm r
T N = (9)
The total torque equal
Fig. 1. Equivalent circuit of hybrid stepping motor.
s i n ( )
s i n ( / 2 ) s i n ( 2 )
e r m a r r m a
r d m
T N i N N i
N T
r
N
=
(10)
The mechanical equation
2
e m L
2
d
T B T J
dt
=
(11)
That is, the following differential equations for the
rotor angular velocity and displacement result
e m L
d 1
(T B T )
dt J
=
(12)
d
dt
=
(13)
3. HYSTERESIS CURRENT CONTROL
The current control, which consists of two
hysteresis controllers, is built with Simulink blocks.
The motor currents are provided by measurement and
compared to the reference currents. The current error is
passed through hysteresis controller represented by
Volume 51, Number 2, 2010 111
relay block with band H to produce the inverter gate
pulses as shown in Fig. 2.
Square-wave current references are generated
using the current amplitude and the step frequency
parameters.
The gate pulses are produced based on the
following concepts taking phase a as an example,
In the positive half cycle,
If then Na = 0;
*
a a
i i H > +
If then Na = 1;
*
a a
i i H <
In the negative half cycle,
If then Na = 1;
*
a a
i i H > +
If then Na = 0;
*
a a
i i H <
4. SYSTEM IMPLEMENTATION
The proposed current control algorithms have
been realized and tested for feasibility in a motor drive
containing a hybrid stepping motor with a power
supply, inverter and gate circuit, and current controller.
The motor phases are fed by H-bridge MOSFET
PWM converters connected to a 28 V DC voltage
source. The motor phase currents are independently
controlled by two hysteresis-based controllers which
generate the MOSFET drive signals by comparing the
measured currents with their references. The output
switching commands of the DSP control board are
obtained via its digital ports and interfaced with the
converter through opto-isolated gate drive circuits.
+
-
Pulses
a
i
a
i
+
- b
i
b
i
Fig. 2. Hysteresis current controllers for producing gate pulses.
The Matlab/Simulink models can be implemented
and tested in real time. The Real-Time Interface (RTI)
contains a library of Blocks which connects the
Simulink models to the real system. The Real-Time
workshop (RTW) converts the model to C code. The C
code is then automatically compiled to the assembly
language of the target processors and downloaded to
the controller board. Finally, ControlDesk, and
Experimentation tools, are used to control, tune and
monitor the running process. In real time it is available
to capture the signals of the model and change
parameters of the controller.
5. EXPERIMENTAL RESULTS
The experimental system of Fig. 3 is built in the
laboratory to test the performance of the hybrid
stepping motor drive system under different operation
The basic configuration of the experimental
system is shown in Fig. 3. It consists of a hybrid
stepping motor interfaced with a digital control board
DS1102 based on a Texas Instruments TMS320C31
Digital Signal Processor for real-time control. Rating
and parameters of the hybrid stepping motor are given
in the appendix. Stator currents are measured and
filtered using analogue circuitry. Hall-effect sensors are
used for this purpose. The measured current signals are
acquired by the A/D input ports of the DSP control
board. This board is hosted by a personal computer on
which mathematical algorithms are programmed and
downloaded to the board for real-time control.
Fig. 3. Block diagram of the experimental system using DSP
control board.
Vdc
2-Phase
Bridege
Inverter
HS
Motor
b
a
ia ib
Drive
Control
Step
DIR
iaref ibref
DSP-DS1102 Control Board
Hysteresis
Current
Controller
A/D
Current
Sensor
Digital I/O Ports
Computer
ISA
Bus
T1 T
2
T3 T4
S1
S4
S3
S
2
D/A
Oscillo
scope
Time [sec]
S
p
e
e
d
s
[
r
p
m
]
Reference
Measured
(a) reference and actual speeds
Time [sec]
R
o
t
o
r
p
o
s
i
t
i
o
n
[
d
e
g
.
]
(b) Rotor position signal
Time [sec]
A
b
s
o
l
u
t
e
r
o
t
o
r
p
o
s
i
t
i
o
n
[
d
e
g
.
]
(c) Absolute rotor position
Fig. 4. Experimental results at step change of speed reference at
314 rpm.
ACTA ELECTROTEHNICA 112
conditions. This includes step change of reference
speed at different reference values 314, 125, and 65
rpm, respectively. Figs. 4 to 6 show the reference and
actual speeds, rotor position signal and absolute rotor
position under step speed change. It is obvious that the
actual speed and consequently the rotor position
reaches the steady state value smoothly without
overshoot or undershoot. Moreover, the drive system
has a fast dynamic response and takes a minimum rise
time to reach the steady state value. However, the
actual speed contains ripples which increase at low
speeds.
Experimental results are presented also during
speed reversal, Fig.7. It is clear that the actual speed
follows the reference speed smoothly. Moreover,
experimental results are presented with repetitive
operation to test the precise operation of the drive
system and fast dynamic response, Fig.8. It is observed
that the drive system preserves its stability and
synchronization with fast start and stop operations. This
proves the supremacy of the proposed closed loop
control of hybrid stepping motor drive system.
6. CONCLUSION
This paper has presented a mathematical model
with which the dynamic behavior of a hybrid stepping
motor could be successfully predicted. This model has
been used to illustrate the dynamic operation as well as
steady state operation of hybrid stepping motor with
hysteresis current control. The experimental results
using DSP-DS1102 control board for a hybrid stepping
motor under different operating conditions has been
presented. Experimental results have been presented
during step change of speed reference, speed reversal
and repetitive operation. It has been obvious that the
actual speed and consequently the rotor position
reaches the steady state value smoothly without
overshoot or undershoot. Moreover, the drive system is
fast dynamic response and takes a minimum rise time to
reach the steady state value. In addition, it has been
observed that the drive system can not lose its stability
or synchronization with speed reversal and fast start
and stop operations. This proves the supremacy of the
proposed closed loop control of hybrid stepping motor
drive system. With the high performance DSP and
advanced control techniques, attempts are done to
overcome speed ripples.
Time [sec]
S
p
e
e
d
s
[
r
p
m
]
Reference
Measured
(a) reference and actual speeds
Time [sec]
R
o
t
o
r
p
o
s
i
t
i
o
n
[
d
e
g
.
]
(b) Rotor position signal
Time [sec]
A
b
s
o
l
u
t
e
r
o
t
o
r
p
o
s
i
t
i
o
n
[
d
e
g
.
]
(c) Absolute rotor position
Fig. 5. Experimental results at step change of speed reference at
125 rpm.
Time [sec]
S
p
e
e
d
s
[
r
p
m
]
Reference
Measured
(a) Reference and actual speeds
Time [sec]
R
o
t
o
r
p
o
s
i
t
i
o
n
[
d
e
g
.
]
(b) Rotor position signal
Time [sec]
A
b
s
o
l
u
t
e
r
o
t
o
r
p
o
s
i
t
i
o
n
[
d
e
g
.
]
(c) Absolute rotor position
Fig. 6. Experimental results at step change of speed reference at
65 rpm.
Volume 51, Number 2, 2010
113
Reference
Measured
Time [sec]
S
p
e
e
d
s
[
r
p
m
]
Time [sec]
S
p
e
e
d
s
[
r
p
m
]
Reference Measured
(a) Reference and actual speeds
Time [sec]
(a) Reference and actual speeds
R
o
t
o
r
p
o
s
i
t
i
o
n
Time [sec]
R
o
t
o
r
p
o
s
i
t
i
o
n
[
d
e
g
.
]
(b) Rotor position signal
[
d
e
g
.
]
(b) Rotor position signal
Time [sec]
p
o
s
i
t
i
o
n
[
d
e
g
.
]
(c) Absolute rotor position
Fig. 7. Experimental results during speed reversal.
A
b
s
o
l
u
t
e
r
o
t
o
r
Time [sec]
A
b
s
o
l
u
t
e
r
o
t
o
r
p
o
s
i
t
i
o
n
[
d
e
g
.
]
(c) Absolute rotor position
Fig. 8. Experimental results during repetitive operation.
5. T. Kenjo, A. Sugawara, "Stepping Motors and Their
Microprocessor Controls", 2
nd
Edition, Oxford University Press,
Oxford, 2003.
APPENDIX
6. P. Acarnley, "Stepping motors-A guide to theory and Practice,"
4
th
Edition, the Institution of Electrical Engineering, London,
2002.
Table I. Hybrid Stepping Motor Parameters.
Number of Phases 2 Detent torque 0.002 N.m
Winding inductance 0.0014 H The total inertia 1.2e
-7
Winding resistance 0.7 The total friction 0.0001
The step angle 1.8 Initial Speed(rad/sec)
0
Maximum flux
linkage
0.005 Initial Position (degree)
0
7. T. Kenjo and Takshi, "Speed Ripple Characteristic of Hybrid
Stepping Motor Driven in the Mini Step Mode," International
conference on stepping motor system.
8. C. Rusu, I. Birou and E. Szoke, "Model Based Design Controller
for the Stepper Motor," IEEE International Conference on
Automation, Quality and Testing, Robotics (AQTR), vol. 2, pp.
175179, May 22-25, 2008.
9. M. Bodson, J.N. Chiasson, R.T. Novotnak, and R.B. Rekowski,
"High Performance NonLinear feedback control of permanent-
magnet stepper motor", IEEE Transactions on Control Systems
Technology, vol. 1, Issue 1, pp. 514, March 1993.
REFERENCES
1. T.R. Fredriksen, "Application of the Closed-Loop Stepping
Motor," IEEE Trans. on Automatic Control, vol. AC-13, pp.
464474, Oct. 1968.
Mohamed S. ZAKY
2. B.C. Kuo, "Closed-Loop and Speed Control of Step Motors," The
3
rd
Annual Symposium Incremental Motion Control Systems and
Devices, Urbana-Champaign, IL, May 68, 1974.
Ehab M. ISMAEIL
Mahmoud M. KHATER
3. F. Betin, M. Deloizy, and C. Goeldel, "Closed Loop Control Of
Stepping Motor Drive: Comparison Between PID Control, Self
Tuning Regulation and Fuzzy Logic Control," European Power
Electronics Journal, vol. 8, no. 12, pp. 3339, June 1999.
Electrical Engineering Department
Faculty of Engineering
Shebin El-Kom (32511)
Minoufiya University, Egypt.
4. Du Xu, Yongping Jiang, "A Method and Implementation of Fully
Digitized Continuous Microstep for Step Motor", IEEE
IEMDC97, pp. TC2/9.1- TC2/9.3, May 18-21, 1997.