Download as pdf or txt
Download as pdf or txt
You are on page 1of 15

electronics

Article
Simple Torque Control Method for Hybrid Stepper
Motors Implemented in FPGA
Stefano Ricci * and Valentino Meacci
Information Engineering Department (DINFO), University of Florence, 50139 Florence, Italy;
valentino.meacci@unifi.it
* Correspondence: stefano.ricci@unifi.it; Tel.: +39-0552758585

Received: 12 September 2018; Accepted: 4 October 2018; Published: 7 October 2018 

Abstract: Stepper motors are employed in a wide range of consumer and industrial applications.
Their use is simple: a digital device generates pulse-bursts and a direction bit towards a power driver
that produces the 2-phase currents feeding the motor windings. Despite its simplicity, this open-loop
approach fails if the torque load exceeds the motor capacity, so the motor and driver should be
oversized at the expense of efficiency and cost. Field-Oriented closed-loop Control (FOC) solves the
problem, and the recent availability of low cost electronics devices like Digital Signal Processors,
Field Programmable Gate Arrays (FPGA), or even Microcontrollers with dedicated peripherals,
fostered the investigation and implementation of several variants of the FOC method. In this
paper, a simple and economic FOC torque control method for hybrid stepper motors is presented.
The load angle is corrected accordingly to the actual shaft position through pulse-bursts and direction
commands issued towards a commercial stepper driver, which manages the 2-phase winding currents.
Thanks to the FPGA implementation, the control loop updates the electrical position every 50 µs only,
thus allowing a load angle accuracy of −1/100 rad for a rotor velocity up to 750 rev/min, as shown
in the reported experiments.

Keywords: stepper motor; torque control; closed-loop control; Field Programmable Gate
Array (FPGA)

1. Introduction
The stepper motor [1] is widely used nowadays in a large range of applications such as 3D printers,
industrial manufacturing tools, robotic arms, etc. Part of its success is certainly due to its capability
of moving in a sequence of accurate and discreet locations (steps). A microcontroller connected to
one of the several power drivers available on the market through a “step” clock and a “direction”
command is often sufficient for the motor control [2]: For every “step” pulse, the driver modifies the
2-phase currents that feed the motor so that the shaft rotates by a “step” (typically 1.8◦ ) or a fraction of
it (µ-step) [3].
Unfortunately, the performance of the stepper motor heavily depends on the load condition.
Therefore, if the load accidentally increases over the motor capacity, the control misses the actual
shaft position and the application fails. To prevent this catastrophic event, stepper motors (and
their drivers) are typically selected with a torque capacity that abundantly exceeds the nominal
requirement. This results in oversized motors, and waste of power and heat [4]. Closed-loop
motor control with the Field Oriented Control (FOC) method [5,6] solves this problem. The typical
FOC implementation is based on Direct-Quadrature (DQ) coordinate transformations [6,7] that,
in the past, required a considerable calculation effort and correspondingly complex hardware,
which was not compatible with economic consumer applications. In recent years, however,
the availability of microcontrollers with dedicated peripherals and/or economic Field Programmable

Electronics 2018, 7, 242; doi:10.3390/electronics7100242 www.mdpi.com/journal/electronics


Electronics 2018, 7, 242 2 of 15

Gate Arrays (FPGAs) has supported the development and implementation of new closed-loop
approaches. In particular, FPGA represents a standard device for industrial applications [8,9],
including motor control. For example, a Proportional-Integral-Derivative (PID) controller [10] with
velocity feed-forward was proposed in [11]; in [12] a closed-loop control system based on motor
parameter identification was presented; in [13] and [14], motor controllers based on Neural Networks
are proposed.
In this paper a closed-loop torque control method for hybrid stepper motors is presented with
its FPGA implementation. The method is based on a simple control loop that, thanks to the FPGA’s
performance, executes every few 10 s of µs. Every loop iteration, the motor shaft position is monitored
through an incremental encoder, and the stator magnetic field position is updated so that the relative
phase between the positions of the stator and the rotor generates the desired load angle. While this
quick loop maintains accurate control of the load angle, the magnitude of the phase currents is adjusted
to obtain the programmed torque.
The output of the control loop consists of the number of µ-steps and the direction bit the rotor
should move to maintain the desired load angle. These data perfectly fit with the “step/direction”
interface present in several commercial power devices which are typically employed for open-loop
µ-step motor control. In other words, this method does not need custom power electronics for the
generation and control of the motor phase currents, which can be delivered by one of the monolithic
devices already available in the market.
The proposed control is implemented in a FPGA from the MAX10 family (Intel/Altera, San Jose,
CA, USA), connected to the PowerStep01 stepper driver (STMicroelectronics, Geneva, Switzerland).
The paper presents the basics of the applied method in the next section; the employed electronics
system and the FPGA implementation are described in Section 3; finally, several experiments are
reported in Section 4.

2. Methods

2.1. Torque Generation and Step Movement


In a hybrid 2-phase stepper motor, the torque is generated by the interaction of the field produced
by the rotor fixed magnet, and the field dynamically generated by the stator windings. The torque is
composed by 3 components: the cogging, the reluctance, and the electrodynamic component [15,16];
however, in this work, the electrodynamic component, being predominant, is the only one considered.
With reference to Figure 1, if Ia and Iqb are the currents flowing in the 2 windings, the magnitude and
 
2 2 − 1 Ib
angle of the resulting current is I = Ia + Ib and θ I = tan Ia . The motor torque ΓE is generated
by I combined to the load angle θ L , i.e., the phase angle between the rotor position θ R and the current
position θ I [15]:
ΓE = Kt · I · sin(θ L ) = Kt · I · sin(θ R − θ I ) (1)

where Kt is the torque constant. The torque is null when θ L = 0 independently from the current
magnitude, and it is maximum when θ L = π/2. A sinusoidal current excitation produces a continuous
rotation of the current vector of amplitude I and a corresponding movement of the equilibrium
position of the rotor. However, the typical commercial stepper driver produces only a limited set
of quantized values of the phase currents. If NM is the number of the different current levels the
driver produces, 4NM equilibrium positions are generated around the electrical circle of Figure 1 in
2π 3π (4NM −1)π
θ R = 0, 2NπM , 2N M
, 2N M
, . . . 2N M
[3].
Electronics2018,
Electronics 2018,7,7,242
x FOR PEER REVIEW 33 of
of 15
16

It ib 𝜃𝐼 I

𝜃𝐿𝑡
𝜃𝐿
𝜃𝐼
𝜃𝑅

ia

ia
ib

Figure1.1.InIna astepper
stepper motor
motor thethe torque
torque is related
is related to thetoload
the angle
load θangle 𝜃𝐿 , present
betweenbetween
the rotorthe rotor
Figure L , present magnet,
θmagnet, 𝜃 , and the current field, 𝜃𝐼 . The
R , and the𝑅 current field, θ I . The target
target
load load
angle θ Ltangle 𝜃𝐿𝑡 is obtained
is obtained by advancing
by advancing 𝜃𝐼𝑛 the
of current
of θ In the
current
field θi . field 𝜃 𝑖 .

2.2.
2.2. Torque
TorqueModulation
Modulation
According
According to to (1),
(1), the
the torque
torque can canbebemodulated
modulatedby bycontrolling
controllingthe theload
loadangle,
angle,θ L𝜃,𝐿 ,and/or
and/or thethe
current,I.𝐼.The
current, Thetypical
typical FOC FOC application
application regulates
regulates the the
motor motorwindings
windingscurrents to generate
currents a loadaangle
to generate load
of
angle ±π/2,
θ L = of 𝜃𝐿 = and
±π/2,theandcurrent magnitude
the current I modulates
magnitude the torque.
𝐼 modulates theThis is theThis
torque. most is efficient
the most approach,
efficient
since the minimum
approach, since thecurrent
minimum is used for a is
current given
usedtorque.
for a givenHowever, in some
torque. situations,
However, in some maintaining
situations, I
fixed and modulating the torque through can be convenient.
maintaining 𝐼 fixed and modulating the torque through 𝜃𝐿 can be convenient. Let’s consider, for
θ L Let’s consider, for example, a 10 A
motor
example, driver that,motor
a 10A at a particular
driver that, moment, is requiredmoment,
at a particular to produce a low torque
is required of 1/100aoflow
to produce thetorque
nominal of
value. Bythe controlling ◦
1/100 of nominal the load
value. Byangle to 90 , the
controlling the windings’
load anglecurrent to 90°, magnitude
the windings’ should
currentbe reduced
magnitude to
10/100
should =be0.1 A. It isto
reduced feasible
10/100that the driver,
= 0.1A. whichthat
It is feasible typically
the driver,employswhich chopper
typicallyamplifiers
employsdesigned
chopper
for high currents, suffers reduced accuracy in this low current
amplifiers designed for high currents, suffers reduced accuracy in this low current range [17]. range [17]. Thus, imposing a current
Thus,
magnitude
imposing aof, for example,
current magnitude I = 1 of,A, and reducing the
for example, 𝐼 = load
1A, and anglereducing ) = load
at sin(θ Lthe 1/10,anglecan help to make
at sin(𝜃 𝐿) =
the driver produce the desired torque while working in its preferred
1/10, can help to make the driver produce the desired torque while working in its preferred current current range.
range. In order to show that the proposed method is able to modulate the torque by changing both
I andInθ Lorder
, in thetoproposed
show thatimplementation
the proposed method we chose a double
is able controlthe
to modulate approach,
torque by as changing
summarized bothin𝐼
Table 1. Which of the 2 control approaches is applied depends
and 𝜃𝐿 , in the proposed implementation we chose a double control approach, as summarized in on the instantaneous required torque
ratio
TableΓE1./Γ M , where
Which of theΓM2 = Kt · I M approaches
control is the nominal torque depends
is applied of the motor, on the produced at the nominal
instantaneous requiredcurrent
torque
Iratio
M with the maximum load angle. For high torque
𝛤𝐸 ⁄𝛤𝑀 , where 𝛤𝑀 = 𝐾𝑡 ∙ 𝐼𝑀 is the nominal torque of the motor, values, i.e., ΓE /Γ M > 10% (see first row
produced at the nominal currentof Table 1),
the
𝐼𝑀 same
with the approach
maximum as inload
the FOCangle. is used:
For highthe torque
load angle
values, is fixed
i.e., to ±𝑀π/2,
𝛤𝐸 ⁄𝛤 >10%and,(seefrom
first(1),
rowtheoftorque
Table 1), is
Γthe ±Kt I,
E =same which is as
approach modulated
in the FOC by is used: the Iload
controlling (the angle
sign depends
is fixed on the direction
to ±π/2, and, from of rotation). On theis
(1), the torque
other
𝛤𝐸 = ± hand,
𝐾𝑡 𝐼, when
whichaistorque lower by
modulated than ΓE /ΓM = 10%
controlling 𝐼 (theis required
sign depends (bottom rowdirection
on the in the table), the current
of rotation). On
IM
isthe
fixed
other = 0.1· Iwhen
to Ihand, M . From (1), thelower
a torque is ΓE𝛤𝐸=⁄𝛤𝑀
torquethan K=10%
t 10 sinis L ), which (bottom
(θrequired is modulated row in by the
changing .
table),θ Lthe
𝐼𝑀
current is fixed to 𝐼 =0.1·𝐼𝑀 . From (1), the torque is 𝛤𝐸 = 𝐾𝑡 sin(𝜃𝐿 ), which is modulated by
10 (1/2).
Table 1. Torque modulation control strategy
changing 𝜃𝐿 .
Condition Control Strategy Angle Current Torque
ΓE
Table
Angle 1. Γ
fixed, Torque
E
modulationπcontrol strategy (1/2).
> 0.1 θL = ± 2 I ΓE = ±Kt I (2a)
ΓM modulated by I
Condition Control
Current strategy
fixed ΓE Angle Current Torque
IM
ΓE
< 0.1
𝛤𝐸 θL
𝜋 I= ΓE = Kt I10
M
sin(θ L ) (2b)
ΓM Angle fixed,
controlled by θ L 10
> 0.1 𝜃𝐿 = ± 𝐼 𝛤𝐸 = ± 𝐾𝑡 𝐼 (2a)
𝛤𝑀 𝛤𝐸 modulated by 𝐼 2
Electronics 2018, 7, 242 4 of 15

The Torque column of Table 1 describes the achieved torque when the current magnitude and
the load angle are known. To control the motor we need the opposite, i.e., given a desired torque ΓE ,
we need to know the load angle, θ L , and the current, I, which produce such a torque. This result is
obtained by solving the torque equations present in the Torque column of Table 1 with respect to the
current I and the angle θ L (first row and second row of Table 2):

Table 2. Torque modulation control strategy (2/2).

Condition Control Strategy Angle Current Torque


ΓE Angle fixed, ΓE ΓE ΓE
> 0.1 θ L = ± π2 I= Kt = ΓM I M ΓE (3a)
ΓM modulated by I
Current fixed ΓE  
ΓE
< 0.1 θ L = sin−1 10Γ·MΓE I= IM
10
ΓE (3b)
ΓM controlled by θ L

Table 2 should be read as follow: given the desired torque ΓE , the load angle and current to be
used with the the motor to generate such a torque are those reported in Angle and Current columns,
at the row selected by the Condition column.
It is now convenient to distinguish the actual current I and load angle θ L , from the target current It
and load angle θ Lt , respectively. With reference to Figure 1, the first are the values currently present
in the motor, while the others are the values that the motor control should achieve for generating
the imposed torque. According to the aforementioned strategy, the electronics control, during the
rotor movement, should drive the 2-phase currents so that I has the desired amplitude (I = It ) and is
dynamically positioned to maintain the target load angle (θ L = θ Lt ). Thus, if θ R and θ I are the actual
rotor and current positions, (see Figure 1), the current position should be incremented/decremented
by an angle of:
θ In = θ Lt − θ L = θ Lt + θ R − θ I . (4)

For practical reasons, since we are going to use a µ-step driver where the current position can be
incremented/decremented in discrete steps of amplitude 2π/4/NM rad, it is convenient to rewrite
(4) as:
STi = LA T + RP − CP (5)

where STi , LA T , RP, CP, correspond to θ In , θ Lt , θ R , θ I , respectively, now expressed in µ-step unit.
For a better understanding of the proposed method, Figure 2 summarizes the control procedure.
The instantaneous desired torque, expressed as torque ratio ΓΓME , the present current position, CP, and
rotor position, RP, are inputs to the procedure. The calculation is divided into 2 steps. In the first step
(Figure 2, top), the torque ratio is compared to the 0.1 threshold. If higher (Y-branch of the graph in
Figure 2), the load angle is fixed to the maximum, i.e., θ Lt = π2 , corresponding to LA T = NM µ-steps,
and the current magnitude is calculated according to (3a). On the other hand, if the torque ratio is
lower than the threshold (N-branch of the graph in Figure 2), the current module is set to its minimum
It = 0.1· I M , and the torque is modulated through the load angle, as calculated by (3b).
Electronics 2018, 7, 242 5 of 15
Electronics 2018, 7, x FOR PEER REVIEW 5 of 16

𝛤𝐸
𝑅𝑃 C𝑃 ⁄𝛤
𝑀 inputs

N Y
>10%

10
1st step
LAT = sin-1 LAT = Nm
𝑀 𝛤𝐸
𝐼 = 𝐼𝑀 /10 𝐼 = 𝐼𝑀
𝛤𝑀
LAT Torque blk 𝐼

𝐿𝐴𝑇 LoadAngle blk


𝑆𝑇𝑖 = 𝐿𝐴𝑇 + 𝑅𝑃 − 𝐶𝑃
2nd step
𝑆𝑇𝑖

𝑆𝑇𝑖 𝐼 outputs

Figure 2. Procedure
Figure 2. Procedure of
of the
the proposed
proposed control
control method.
method.

In
In the
the second
second stepstep (Figure
(Figure 2, 2, bottom),
bottom), the the target
target load angle LA
load angle 𝐿𝐴T𝑇 andand thethe actual
actual current
current andand rotor
rotor
positions used in (5) to obtain the number of µ-steps ST
positions are used in (5) to obtain the number of μ-steps 𝑆𝑇𝑖 necessary to update the 𝐶𝑃 positionso
are i necessary to update the CP position so
that
thatthe
theload
loadangle
anglechanges
changesfromfrom θ L 𝜃to the
to target
the loadload
target angle θ Lt . The
angle 𝜃 . output
The values
output It and𝐼STand
values i are𝑆𝑇finally
are
𝐿 𝐿𝑡 𝑡 𝑖
sent to sent
finally the motor
to the drive.
motor Please note that
drive. Please notewhen the border
that when valuevalue
the border of ΓE of =𝛤 0.1= · ΓM is used
0.1∙𝛤 in both the
𝐸 𝑀 is used in both
branches
the branchesof the ofprocedure,
the procedure,it produces
it producesthe same current
the same module
current It = 0.1
module 𝐼𝑡 ·=I M0.1and
∙ 𝐼𝑀target load angle
and target load
LA T
angle= N . This confirms that the decision above the threshold
𝐿𝐴M𝑇 = 𝑁𝑀 . This confirms that the decision above the threshold does not produce does not produce discontinuities in
the generated currents
discontinuities and targetcurrents
in the generated angles. and target angles.
The 2nd step of the descripted
The 2nd step of the descripted procedure
procedurerepresents the quick
represents theand simple
quick andcontrol
simple loop mentioned
control loop
in Section 1. It should loop at a high rate, so that CP tracks RP accurately
mentioned in Sec. I. It should loop at a high rate, so that CP tracks RP accurately with the correct with the correct phase
during the motion
phase during of theof
the motion shaft, whichwhich
the shaft, can rotate at several
can rotate rev/s.
at several rev/s.OnOn thethe other
other hand,
hand,the the1st
1st step
step
is
is more relaxed, since the torque changes are affected by the relatively slow dynamics of the motor
more relaxed, since the torque changes are affected by the relatively slow dynamics of the motor
mechanics.
mechanics.For Forexample,
example,letletususconsider
consider a motor
a motorrunning
runningat a constant velocity
at a constant of 1000ofrpm
velocity 1000and rpmloaded
and
by
loaded by a constant resistant torque. In case of a 200-step/turn motor controlled with 16 μ-stepstep,
a constant resistant torque. In case of a 200-step/turn motor controlled with 16 µ-step per per
the shaft
step, the runs
shaftaruns
µ-step every 20
a μ-step µs. 20
every To μs.
maintain the load
To maintain theangle,
load theangle,control loop should
the control correct the
loop should CP
correct
position with comparable
the CP position timing, while
with comparable timing,nowhile change no is made is
change It andtoθ Lt𝐼 . and 𝜃 .
tomade
𝑡 𝐿𝑡

3. Method Implementation
3. Method Implementation
3.1. The Electronics
3.1. The Electronics
The proposed method was implemented in an electronics system based on 3 boards (see Figure 3).
The proposed method was implemented in an electronics system based on 3 boards (see Figure
The DECA MAX10 (Arrow Electronics, Centennial, CO) includes an FPGA from the low-cost MAX10
3). The DECA MAX10 (Arrow Electronics, Centennial, CO) includes an FPGA from the low-cost
family produced by Altera (San Jose, CA). It is connected to a homemade interface board that includes
MAX10 family produced by Altera (San Jose, CA). It is connected to a homemade interface board
the basic electronics to read the quadrature signals from incremental encoders, and to connect to
that includes the basic electronics to read the quadrature signals from incremental encoders, and to
the evaluation boards of the PowerSTEP01 motor control device. The board and the device are both
connect to the evaluation boards of the PowerSTEP01 motor control device. The board and the
produced by STMicroelectronics (Geneva, Switzerland). PowerSTEP01 is able to drive a stepper
device are both produced by STMicroelectronics (Geneva, Switzerland). PowerSTEP01 is able to
motor with up to 80 V and 10 A currents in an open loop. In this work, the device was set for
drive a stepper motor with up to 80V and 10A currents in an open loop. In this work, the device was
NM = 16 (1/16 µ-step mode), and used in “Step-clock” mode, where it rotates the current position, CP,
set for 𝑁 =16 (1/16 μ-step mode), and used in “Step-clock” mode, where it rotates the current
by a single𝑀 µ-step every rise-edge generated on the step-clock signal. The direction of the rotation and
position, 𝐶𝑃, by a single µ -step every rise-edge generated on the step-clock signal. The direction of
the current are set by specific commands sent through a SPI channel.
the rotation and the current are set by specific commands sent through a SPI channel.
Electronics 2018, 7, 242 6 of 15
Electronics 2018, 7, x FOR PEER REVIEW 6 of 16

Figure 3. The electronics system is composed of the DECA Max10 and the EVLPOWERStep01
Figure 3. The electronics system is composed of the DECA Max10 and the EVLPOWERStep01
developing boards connected through a homemade interface board. A second drive board can be
developing boards connected through a homemade interface board. A second drive board can be
connected to simultaneously drive 2 motors.
connected to simultaneously drive 2 motors.
3.2. FPGA Implementation
3.2. FPGA Implementation
The proposed method is implemented in the FPGA of the DECA MAX10 board, and is sketched
The proposed
in Figure method is implemented
4. This implementation refers to a in the FPGA
stepper driver of set
theforDECANM = MAX10
16 andboard,
a 10 k and is sketched
pulse-per-turn
in Figurehowever,
encoder; 4. This implementation
it can easily be adapted refers totoa different
stepper driver settings. setThe 𝑁𝑀 =16 and acalculations,
for time-critical 10k pulse-per-turn
like the
encoder; however, it can easily be adapted to different settings.
control loop (5), are implemented in the FPGA fabric and coded directly in VHDL, while parts The time-critical calculations, like the
of
control loop (5), are implemented in the FPGA fabric and coded directly
the remaining tasks are coded in the C language and run in a NiosII®soft processor included in the in VHDL, while parts of the
remaining
FPGA. Thistasks
approachare coded
allowed in low
the execution
C language timeand forrunthein a NiosII®
control loop (5)softand
processor included
a faster and easierincodethe
FPGA. This approach allowed low execution time for the control
development for the other tasks. The sections coded in the soft-processor include a conventional loop (5) and a faster and easier code
development for the (PI)
Proportional-Integral other tasks. The
controller [10]sections
and a simple codedtrajectory
in the soft-processor
generator, which include a conventional
are ancillary blocks
Proportional-Integral (PI) controller [10] and a simple
that are necessary to allow the experimental test of the torque control method. trajectory generator, which are ancillary
blocks
Withthatreference
are necessary
to Figure to allow
4, the the
softexperimental
processor includes test ofthe thesimple
torquetrajectory
control method.
loop, that according to
With reference to Figure 4, the soft processor includes
a programmed trajectory, calculates the target position PT every 1 ms. PT feeds the the simple trajectory loop, that according
PI controller [10]
to a programmed trajectory, calculates the target position P T every 1 ms. PT feeds the PI controller
that compares PT to the actual position PA and outputs the target torque ΓE . The torque is then
[10] that compares
processed in the Torque PT to the actual
block, which position
applies thePAfirst
andstepoutputsof thethe torque 𝛤𝐸detailed
targetprocedure
control . The torque is then
in Figure 2,
processed in the
theTorque block, which applies
It and the first step of theLAcontrol procedure detailed in Figure
and generates required current the target load angle T . LA T is delivered to the LoadAngle
2, andwhile
block, generates the required
It is directly programmed currentto𝐼𝑡theand the target
driver through load
the angle
SPI. Both𝐿𝐴 𝑇 the
. 𝐿𝐴PI𝑇 is delivered
and the load to the
angle
LoadAngle block, while
calculation run every 200𝑡 µs. 𝐼 is directly programmed to the driver through the SPI. Both the PI and the
loadThe
angle calculation
FPGA fabricsrun everyseveral
include 200 μs.interacting blocks. The EncCnt counter (Figure 4 top, right)
The FPGA fabrics include several
tracks the actual rotor position PA by integrating interactingthe blocks. The EncCnt
quadrature signalscounter
produced (Figure 4 top,
by the right)
encoder.
tracks
PA the used
is then actualbyrotor
the PI position
and thePA by integrating
Mapper block in thethe FPGAquadrature
fabric. signals produced by the encoder.
PA isInthen used by the PI and the Mapper block
the Mapper block, the physical position of the rotor PA in the FPGA fabric.
is converted from encoder to µ-step
In the Mapper block, the physical position
units [18] (8/25 factor for 10 k pulse/turn encoder and NM = 16). of the rotor PA is converted from encoder
The least-significant to of
5 bits μ-step
this
units [18]
value maps (8/25
the factor for 10k pulse/turn
rotor position encoder
in the electrical and
circle of 𝑁 𝑀 =16).1,The
Figure RP,least-significant
expressed in µ-step 5 bits of this
unit, whichvalue
is
maps the to
delivered rotor position inblock.
the LoadAngle the electrical circle of Figure 1, RP, expressed in μ-step unit, which is
delivered to the LoadAngle
The current position CP block.
is tracked in the StepMan block (see Figure 4). The number of µ-steps
The current
STi demanded to position
the driverCP in is tracked
every in the
control cycleStepMan block (see Figure
are accumulated 4). The
in the “step numberwith
counter” of μ-steps
a sign
𝑆𝑇𝑖 demanded to the driver in every control cycle are accumulated in the “step counter” with a sign
that depends on the direction of rotation. The counter works with a 4𝑁𝑀 module: for 𝑁𝑀 =16 a 5-bit
counter is used.
Electronics 2018, 7, 242 7 of 15

that depends on the direction of rotation. The counter works with a 4NM module: for NM = 16 a 5-bit
Electronics
counter is2018,
used.7, x FOR PEER REVIEW 7 of 16

The LoadAngle block (see Figure 4) finally calculates the µ-steps required to maintain the desired
The LoadAngle block (see Figure 4) finally calculates the μ-steps required to maintain the desired
load angle, STi , by applying the second step of the control procedure described in Figure 2 to the
load angle, 𝑆𝑇𝑖 , by applying the second step of the control procedure described in Figure 2 to the
inputs provided from the blocks previously described. Every 50 µs, STi is delivered to the StepMan
inputs provided from the blocks previously described. Every 50 µ s, 𝑆𝑇𝑖 is delivered to the StepMan
block
blockthat
thatissues
issuesto to
thethe
powerSTEP01 driver
powerSTEP01 the the
driver direction command
direction commandfollowed by a by
followed burst of STi of
a burst electrical
𝑆𝑇𝑖
pulses of 1 µs each.
electrical pulses of 1 µ s each.

NIOSII®

1 ms Trajectory
Target Position

Enc Cnt

Enc
Position PI

Shaft Position PA
Target Torque
𝛤𝐸

Mot
200 us
Torque blk ⁄𝛤
𝑀
M
Control step 1
LAT 𝐼 Curr. Driver

Step
Dir.

𝐿𝐴𝑇

50 us
Control step 2
C𝑃 Pulse Pulse
𝑅𝑃 LoadAngle blk 𝑆𝑇𝑖 Count. Gen.
StepMan blk
Mod64

Scaling Factor LAT 𝐼𝑡 CP 𝑅𝑃 𝑆𝑇𝑖


(8/25)
PC
0-63 0-3199 Mapper blk Sampling FPGA Debug
Timer Memory

Figure4.4.FPGA
Figure FPGAimplementation
implementation ofof the
the proposed
proposed method.
method. Control step 11 and
Control step and Control step 22 refer
Control step refer to
to the
calculations reported in the corresponding steps of Figure 2.
the calculations reported in the corresponding steps of Figure 2.

3.3. Debug Memory


3.3. Debug Memory
The FPGA includes a debug memory (see Figure 4 bottom, right), where PA , LA T , It , CP, RP, and
The FPGA includes a debug memory (see Figure 4 bottom, right), where PA, 𝐿𝐴 𝑇 , 𝐼𝑡 , CP, RP,
ST i
andparameters are simultaneously
𝑆𝑇𝑖 parameters are simultaneously saved with
saved a sampling
with rate
a sampling setset
rate bybythe
theuser
userfrom
from11µsμsto
to 100
100 ms.
Upms.toUp
4096
to values of each
4096 values ofparameter can becan
each parameter saved without
be saved interfering
without with the
interfering withalgorithm. The memory
the algorithm. The
can
memory can be downloaded to a host PC when the motor is stopped. Although this feature impact
be downloaded to a host PC when the motor is stopped. Although this feature has no has no on
the algorithm,
impact on the it is essential
algorithm, it isfor debugging
essential and performance
for debugging analysis.analysis.
and performance

3.4.
3.4.Timings
Timingsand
andResources
Resources
The
Thetrajectory
trajectory controller updatesthe
controller updates thetarget
targetposition,
position,PT,Pevery
T , every 1 ms,
1 ms, andand executes
executes in 1.0inμs1.0
onµsa on
a Nios
Niosprocessor
processorclocked
clocked at 100 MHz. The PI controller and the torque control run every
at 100 MHz. The PI controller and the torque control run every 200 μs, and µs, 200
and execute
execute the the calculations
calculations in 1.5
in 1.5 µs only.
μs only. ThisThis result
result is obtained
is obtained using
using a look-up
a look-up tabletable
for for
the the
sin sin
inversion necessary in control step 1 (see Table 2, second row) for low torque condition. The
remaining tasks, performed in FPGA fabric, are simple mathematical calculations or logic operations
Electronics 2018, 7, 242 8 of 15

inversion
Electronics necessary
2018, 7, x FOR in control
PEER REVIEWstep 1 (see Table 2, second row) for low torque condition. The remaining 8 of 16
tasks, performed in FPGA fabric, are simple mathematical calculations or logic operations that take
that
a fewtake a few
clock clockatcycles
cycles most atto most to execute.
execute. The LoadAngle
The LoadAngle block2(step
block (step 2 in Figure
in Figure 2) is evaluated
2) is evaluated every
every 50 μs. In this period, the StepMan block issues a SPI command and
50 µs. In this period, the StepMan block issues a SPI command and a step-clock burst to a step-clock burst
the to the
driver
driver (see Figure
(see Figure 5). The5).
SPIThe SPI transmission,
transmission, 1 byte
1 byte at 4 MHz,at 4takes
MHz,about
takes3 about 3 μs. PowerSTEP01
µs. PowerSTEP01 driver
driver requires
requires a step-clock period of 1 μs, so the maximum length of the burst is of 32 μs (every
a step-clock period of 1 µs, so the maximum length of the burst is of 32 µs (every position in a 64 µ-steps position in
aelectrical
64 μ-steps electrical circle can be reached by, at maximum, 32 μ-steps towards the
circle can be reached by, at maximum, 32 µ-steps towards the shorter path). The minimum shorter path ).
The minimum
temporal lengthtemporal length
of a torque of a torque
control loop iscontrol
thus 3 loop
+ 32 is
= thus
35 µs,3 which
+ 32 = 35
fitsμs, which
well fits50well
in the in the
µs period
50μs period
used here. used here.

50us
3us

SPI Dir Dir


1us Up to 32 CLK
STEP

time
Figure 5. Timing of the commands sent to the power driver.
Figure 5. Timing of the commands sent to the power driver.
The resources employed in the FPGA are reported in Table 3. As expected, most of the resources
The by
are used resources employed
the Nios®soft in thewhile
processor, FPGA theare reported
other in Table
control blocks 3. relatively
need As expected, mostcells
few logic of and
the
resources are used by the Nios® soft processor, while the
registers, and no memory nor mathematical processors (DSPs). other control blocks need relatively few
logic cells and registers, and no memory nor mathematical processors (DSPs).
Table 3. FPGA Resources employed by the control system.
Table 3. FPGA Resources employed by the control system.
FPGA Blok Logic Cell Dedicated Reg Memory Bits DSP
FPGA Blok Logic Cell Dedicated Reg Memory bits DSP
Nios 5017 3079 195,000 6
Nios
StepManager 45 5017 30 3079 -195000 6-
LoadAngleStepManager
+ Mapper Blk 349 45 132 30 - - --
Enc CNT + Mapper Blk 167 349
LoadAngle 67 132 - - --
Enc CNT 167 67 - -
4. Experiments
4. Experiments
4.1. Experimental Set-Ups
4.1. Experimental
The control Set-Ups
method was implemented in the electronics system reported in Section 3.1, which was
connected to themethod
The control set-ups was
shown in Figure 6.inThe
implemented theset-up is composed
electronics by the M1233041
system reported stepper
in Sec. 3.1, whichmotor
was
(Lam Technologies,
connected Florence,
to the set-ups shownItaly) connected
in Figure 6. The to the REV621
set-up (Elap,byMilan,
is composed Italy) encoder
the M1233041 stepperthrough
motor
a flexible
(Lam mechanicalFlorence,
Technologies, coupling. Table
Italy) 4 reports to
connected thethe
main features
REV621 of the
(Elap, employed
Milan, motor and
Italy) encoder encoder.
through a
flexible mechanical coupling. Table 4 reports the main features of the employed motor and encoder.
Electronics 2018, 7, 242 9 of 15
Electronics 2018, 7, x FOR PEER REVIEW 9 of 16

Figure 6. Experimental set-up with the stepper motor (left) connected to the encoder (right) through
Figure 6. Experimental set-up with the stepper motor (left) connected to the encoder (right) through
a flexible mechanical coupling (center).
a flexible mechanical coupling (center).
4.2. Control Procedure Test
4.2. Control Procedure Test
In this test, the trajectory and PI control loops implemented in the Nios II®were bypassed.
The softIn this test, the was
processor trajectory and PI control
programmed to set loops
a fixedimplemented
torque ratioinΓΓMEthe=Nios 0.5. II® were
Being bypassed.
the The
ratio higher
𝛤𝐸
soft processor
than was programmed
the 0.1 threshold, to sets
the control set aafixed
fixedtorque
current ratio
It = 0.5⁄𝛤 · I=
𝑀 M
0.5.
= 2.1 Being 90◦ higher
the aratio
A and than
load angle,
i.e., LA = N
the 0.1 threshold,
T M = 16 µ-steps. The debug memory in FPGA was programmed to acquire
the control sets a fixed current 𝐼𝑡 = 0.5 ∙ 𝐼𝑀 = 2.1A and a 90° load angle, i.e. 𝐿𝐴 𝑇 = a complete
set
𝑁𝑀 of = parameters
16 µ -steps. every 1 µs. The
The debug motorinwas
memory enabled
FPGA was for 1 s, and when
programmed the rotora reached
to acquire completea stable
set of
velocity
parameters after the initial
every acceleration,
1 µ s. The motor was theenabled
debug memory
for 1s, andwaswhendownloaded
the rotor and processed
reached a stableinvelocity
Matlab
(The
after Mathworks, Natick, MA,the
the initial acceleration, USA).
debug The parameters
memory was trend is reported
downloaded and in Figure 7 in
processed forMatlab
a period of
(The
about
Mathworks,1.6 ms.Natick,
The rotor
MA,electrical
USA). Theposition (RP, Figure
parameters 7 first
trend is row)in
reported completes
Figure 7 for an electrical
a period of revolution
about 1.6
(i.e., 64 µ-steps) in 0.68 ms. An electrical revolution corresponds to 4 steps [3]; thus,
ms. The rotor electrical position (RP, Figure 7 first row) completes an electrical revolution (i.e. 64 since the employed
motor
μ-steps)features
in 0.68 200
ms.step/rev, the shaft
An electrical performs
revolution a complete
corresponds to 4physical
steps [3]; turn since ·the
in 200/4
thus, 0.68employed
= 34 ms.
The
motor current electrical
features position,the
200 step/rev, CP,shaft
is reported
performs in the 2nd row of
a complete Figure 7.
physical As in
turn expected, it has
200/4∙0.68 = 34a step-like
ms. The
behavior, with each step being 50 µs, i.e., the loop period. Similarly to RP, CP performs
current electrical position, CP, is reported in the 2nd row of Figure 7. As expected, it has a step-like an electrical
revolution
behavior, with (0–64each step in
µ-steps) 34 ms.
being 50 μs, i.e. the loop period. Similarly to RP, CP performs an electrical
revolution (0–64 μ-steps) in 34 ms.
Table 4. Features of the Motor and the Encoder used in the experimental set-up.
Table 4. Features of the Motor and the Encoder used in the experimental set-up.
MOTOR
Model MOTOR M1233041
Model Manufacturer Lam Technologies,
M1233041Florence, Italy
Manufacturer Flange NEMA23
Lam Technologies, Florence, Italy
Step angle 1.8◦ (200 step/rev)
Flange Hold Torque NEMA23
1.1 N·m
Step angle
Detent Torque 1.8° (200Nstep/rev)
0.035 ·m
Hold Torque Current 1.1 AN·m
4.2
Phase Resistance
Detent Torque 0.4 Ohm
0.035 N·m
Phase Inductance 1.2 mH
Current 4.2 A
Rotor Inertia 0.280 kg·cm−2
Phase Resistance 0.4 Ohm
ENCODER
Phase Inductance 1.2 mH
Rotor Inertia Model REV621
0.280 kg·cm-2
Manufacturer Elap, Milan, Italy
Zero reference
ENCODER yes
ModelPulse/revolution REV621
10,000
Manufacturer Elap, Milan, Italy
Zero reference yes
Every 50 µs, the controller calculates STi from RP and CP (see 3rd row of Figure 7). In this
Pulse/revolution 10000
experiment, STi is in the range 5 ± 1 µ-steps, but most of the time is exactly 5 µ-steps. The calculated
Every 50 μs, the controller calculates 𝑆𝑇𝑖 from RP and CP (see 3rd row of Figure 7). In this
experiment, 𝑆𝑇𝑖 is in the range 5 ± 1 μ-steps, but most of the time is exactly 5 μ-steps. The calculated
Electronics 2018, 7, 242 10 of 15
Electronics 2018, 7, x FOR PEER REVIEW 10 of 16

value
value is is
thenthen used
used to to update
update CPCPin in next
next control
control period.
period. TheThe measured
measured load
load angle,
angle, calculated
calculated in in
Matlab® LA
Matlab®as as M𝐿𝐴=𝑀CP
= C− RP
− R(see(see Figure
Figure 1) is 1) is reported
reported in the
in the last rowlast row of
of Figure Figureit 7,
7, where where it is
is compared
to compared
the target to the target
angle angle 𝐿𝐴 𝑇 represented
LA T represented by thedashed
by the horizontal horizontal
linedashed line at It16features
at 16 µ-step. μ-step. aIt rough
features
a rough triangular
triangular shape of 50shape of 50 μs
µs period. period.
When the When the CP isby
CP is updated updated by 𝑆𝑇LA
STi µ-steps, 𝑖 μ-steps,
M reaches 𝐿𝐴𝑀LAreaches
T and the 𝐿𝐴 𝑇
andangle
load the load
errorangle error
is zero. is zero.
Then, in theThen, in the
following 50following 50 moves,
µs, the shaft μs, the RP
shaft moves,
rises, and LA RP Mrises, and 𝐿𝐴𝑀
diminishes
diminishes
until the next until theperiod
control next control
zeroes period zeroes
the error again.the error again.
RP (uSt)

50

0
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6
CP (uSt)

50

0
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6
10
ST (uSt)

5
i

0
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6
20
LA (uSt)

10
M

0
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6
time (ms)

Figure Rotor
7. 7.
Figure (RP)
Rotor and
(RP) Current
and (CP)
Current Positions,
(CP) Step
Positions, Increment
Step Increment(ST(𝑆𝑇
i ), and measured Load Angle
𝑖 ), and measured Load Angle
(LA M ) with fixed 2.5 A phase currents and 16 µ-steps target load angle (LA T ).
(𝐿𝐴𝑀 ) with fixed 2.5A phase currents and 16 µ -steps target load angle (𝐿𝐴 𝑇 ).

This experiment helps to clarify that the error between the measured and target angle depends on
This experiment helps to clarify that the error between the measured and target angle depends
the motor velocity and the control period T. In fact, the higher the velocity, the wider the angle turned
on the motor velocity and the control period T. In fact, the higher the velocity, the wider the angle
by RP in the control period. Quantitatively, the load angle peak error, in µ-steps can be expressed as:
turned by RP in the control period. Quantitatively, the load angle peak error, in μ-steps can be
expressed as: ω
Lerr = ·3200·T (6)
2πω (6)
Lerr = · 3200 · T
2𝜋
where ω is the motor velocity in rad/s and 3200 is the number of µ-steps per revolution. Since the
where
error ω is the
features motor velocity
a triangle-like in (see
shape rad/slast
and 3200
row of is the number
Figure of μ-steps
7), its mean value per revolution.
is half Since
of the peak, the
i.e.,
error features a triangle-like shape (see last row of Figure 7), its mean value is half of the peak, i.e.,
Lerr/2.
Lerr/2.
4.3. Torque Load Disturbance Test
4.3.With
Torque
theLoad Disturbance
set-up Test
used in previous experiment, the trajectory generator was disabled and the PI
was enabled with its input fixed
With the set-up used in previous to P T = experiment,
0 (see Figurethe 4).trajectory
The debug memorywas
generator wasdisabled
programmed toPI
and the
save a parameter set every 200 µs. In this test, the motor shaft was loaded
was enabled with its input fixed to PT = 0 (see Figure 4). The debug memory was programmed towith an external positive
torque,
save awhich was released
parameter set every time t =In0.this
at 200μs. Figure
test,8the
reports
motor theshaft
shaftwas
position
loaded measured
with an by the encoder,
external positive
PAtorque,
, the current ratio, It/I
which was released M , the target angle, LA
at time t = 0. Figure , calculated by the motor control, and the measured
T 8 reports the shaft position measured by the encoder,
load
PA,angle, LA M , ratio,
the current togetherIt/IMwith
, theits errorangle,
target with respect to the target
𝐿𝐴 𝑇 , calculated angle.
by the motor control, and the measured
loadBefore the𝐿𝐴
angle, torque
𝑀 , was
together released
with its(t < 0),
error the
with control
respect system
to the maintained
target angle. the rotor at position PA = 0
by imposing maximum load angle LA = −
Before the torque was released (t < T0), the control system maintainedabout
the 16 µ-steps and a current of 50% of
the rotor the nominal
at position PA = 0
value. After thethe
by imposing external torqueload
maximum wasangle
released
𝐿𝐴 𝑇(t > 0), the
= −16 control
μ-steps system
and reacted
a current by reducing
of about 50% ofthe
thecurrent
nominal
value. After the external torque was released (t > 0), the control system reacted by reducing the
current to its minimum of 10% in about 40 ms, then further reduced the torque by lowering the load
Electronics 2018, 7, 242 11 of 15

to its minimum of 10% in about 40 ms, then further reduced the torque by lowering the load angle
towards 0. Meanwhile, due to the sudden load change, the shaft rotated of about −1.5 rad out of
position, so the PI responded by imposing a slight positive load angle (t > 60 ms), while maintaining
the current at its minimum level. The shaft recovered the target position in about 250 ms and the
load angle decreased to 0. The error between the target and measured load angles, shown in last row,
is within ±1 µ-step, except for few outliers. The load angle error is the same with (t < 0), and without
(t > 0) the presence of load. The position error calculated as mean ± standard deviation of the errors
measured before torque release (t < 0) is 0.05 ± 1.3 mrad, while after a stable condition was reached at
t > 250 ms, is 0.09 ± 1.4 mrad. The test shows that the control reacts to a strong load change recovering
the original position and controlling the load angle with a high level of accuracy.

4.4. Trajectory Test in Different Load Conditions


The trajectory generator of Figure 4 was programmed to produce a forward movement of 2π
rad, with a constant acceleration/deceleration of 270 rad/s2 and a maximum velocity of 16.4 rad/s.
The experiment was repeated with the motor free, i.e., no load except the encoder, and with the motor
connected to a load. The load was realized with a weight suspended by wire wrapped around the
shaft. In the movement, the motor raised up the weight generating a torque that corresponds to about
20% of the full motor capacity. Figure 9 reports the parameters acquired in the FPGA every 300 µs.
Left and right columns report the measurements obtained without and with the load, respectively.
The errors are expressed as mean ± standard deviation calculated on the samples population of the
corresponding measurement.
The measured position PA is reported on the 1st row of Figure 9. The movement lasted
0.83 s; it featured a typical “S” shape, which is barely visible because of the high acceleration used.
The position error Perr is shown in the 2nd row. In the experiment with no load, the error peaks
up to ±0.2 rad in the high acceleration/deceleration regions, but it is as low as 1 ± 2 mrad in the
constant velocity region. The motor reacts to the acceleration in presence of load with an oscillation
error of ±0.02 rad, which damps down in 200 ms. In the remaining part of the constant velocity region,
the error is the same as in the no-load condition. With load, after the movement, the controller recovers
the right steady position a bit more slowly with respect to no-load condition.
Electronics 2018, 7, 242 12 of 15
Electronics 2018, 7, x FOR PEER REVIEW 12 of 16

Figure 8. The rotor position is controlled at position 0. An external positive torque is applied and
Figure 8. The rotor position is controlled at position 0. An external positive torque is applied and
released at t = 0 (vertical dashed line). From top to bottom, physical Rotor position PA , motor current
released at t = 0 (vertical dashed line). From top to bottom, physical Rotor position P A, motor current
ratio (It /IM ), target (LAT ) and measured (LAM ) load angles, and load angle error (Err), are reported.
ratio (It/IM), target (LAT) and measured (LAM) load angles, and load angle error (Err), are reported.
The measured velocity shows the expected trapezoidal shape with some oscillations. The velocity
The measured
is reported on the 3rd velocity shows 9,the
row of Figure expected
where trapezoidalto shape
it is compared withvalue,
the target some i.e.,
oscillations.
16.4 rad/s, The
velocity is reported on the 3rd row of Figure 9, where it is compared to the
highlighted by the red horizontal segment. The velocity error was 0.01 ± 0.58 rad/s with no load, target value, i.e., 16.4
andrad/s,
0.02 highlighted
± 0.85 rad/sby thethe
with redload.
horizontal segment. The velocity error was 0.01 ± 0.58 rad/s with no
load,
Without load, as expected, thethe
and 0.02 ± 0.85 rad/s with load. was set to its 10% minimum (4th row, left) and the torque
current
Without load, as expected,
was modulated by the load angle (LA the current was set to its 10% minimum (4th row, left) and the torque
T 5th row, left), which, during the movement, was about
10was modulated
µ-steps by the in
and reduced load
theangle
steady (𝐿𝐴region.
𝑇 5th row,Theleft), which,
error on theduring
load the movement,
angle (Lerr, 6thwas
row,about
left)10
μ-steps and reduced in the steady region. The error on the load angle (Lerr,
was 0.03 ± 0.7 µ-step. With load, during the movement, the load angle was fixed to its maximum, 6th row, left) was 0.03 ±
0.7 μ-step. With load, during the
◦ movement, the load angle was fixed to its maximum,
i.e., 16 µ-step corresponding to 90 (LA T 5th row, right), and the torque was modulated by the current i.e. 16 μ-step
corresponding
(4th to 90°was
row, right), which (𝐿𝐴about
𝑇 5th row,
20% of right), and the value.
the nominal torqueAt was
themodulated
end of the by the current
movement, when(4ththe
row,
right), which was about 20% of the nominal value. At the end of the movement,
torque required reduced, the current went down to 10% and the torque was again modulated by the when the torque
required
angle. reduced,
In this case, thethe current
error went
on the loaddown
angletowas
10%−and
0.4 ±the0.5torque
µ-step.was again modulated by the angle.
In this case, the error on the load angle was −0.4 ± 0.5 μ-step.
Electronics 2018, 7, 242 13 of 15
Electronics 2018, 7, x FOR PEER REVIEW 13 of 16

2
Figure
Figure 9.9. Movement
Movement of of 2π
2πrad
radwith
withacceleration
accelerationofof270270rad/s
rad/s2 and
and maximum
maximum velocity
velocity of
of 16.4
16.4rad/s,
rad/s,
performed with motor free (left column) and with a load of 20% motor capacity
performed with motor free (left column) and with a load of 20% motor capacity (right column). From (right column).
From
top totop to bottom,
bottom, ShaftShaft position
position (PA)(P A ), Position
, Position error
error (Perr),
(Perr), Velocity(Vel),
Velocity (Vel),motor
motor current ratio (I(Itt/I/IM
current ratio ),
M),
target
target load
load angle
angle (LA
(LATT),
), and
and load
load angle
angle error
error (Lerr),
(Lerr), are
are reported.
reported.

5. Discussion and Conclusions


5. Discussion and Conclusions
Stepper motors are pervasive in modern applications; however, their use of open loops has several
Stepper motors are pervasive in modern applications; however, their use of open loops has
drawbacks. This work aims at a simple closed-loop method for overcoming such disadvantages.
several drawbacks. This work aims at a simple closed-loop method for overcoming such
The method is fully compatible with the commercial monolithic devices typically used for open-loop
disadvantages. The method is fully compatible with the commercial monolithic devices typically
drive of stepper motors, so that the generation and control of phase currents can be achieved on
used for open-loop drive of stepper motors, so that the generation and control of phase currents can
such devices.
be achieved on such devices.
Electronics 2018, 7, 242 14 of 15

The heart of the method is represented by the loop control (5). It comprises a few simple operations
that are executed at a high rate. In fact, the ripple on the load angle error depends on the loop execution
period T, according to (6). In this implementation, we used T = 50 µs, which, for example, allowed
us to reduce the load angle error to less than −5 µ-step (about 1/100 rad) for a rotor velocity up to
750 rev/min. The proposed method achieves a very low static error both in load (0.05 ± 1.3 mrad)
and no-load (0.09 ± 1.4 mrad) conditions, as measured in the experiment reported in Section 4.4).
This error can be compared, for example, to those obtained by similar closed loop controllers described
in [19] and [20], where static errors of 0.5◦ (~8 mrad) and 0.2◦ (3.5 mrad) are reported, respectively.
The position error present during constant velocity movement (see experiment 4.4) is similar or lower
to that shown in Figure 5 of [11], where a different FOC closed loop controller for stepper motors is
presented. The controller presented in [11], among other differences, is based on a microcontroller
where the control loop runs at T = 350 µs, with respect to T = 50 µs proposed here.
The high execution rate used in this work would be critical—if not unfeasible—in full microprocess
implementation; hence, the use of an FPGA, as proposed here. On the other hand, the remaining
tasks, e.g., current calculation, are more time-relaxed, and a C-like microprocessor approach makes
the development and the debug easier. The use of the FPGA fabric and the soft processor answers to
both requirements with a single electronics device. However, in cases where FPGA resources must be
saved, a full VHDL controller implementation is feasible.
Several improvements can be made to the proposed method, like the damping of the motor
resonances [21], the use of optimal load angle [22], the sensor-less angle measurement [23,24], ripple
reduction [25], and others.
The proposed method represents a simple and economic implementation of closed-loop control,
which yields significant improvement in stepper motor performance with respect to the typical
open-loop approach.

Author Contributions: Conceptualization, Methodology, Writing paper, Funding Acquisition: S.R.; Software,
Investigation, Data Curation: V.M.
Funding: This work is part of the MIPEC project, CUP 4421.02102014.072000051, funded by the Tuscany Region
government through the FAR-FAS 2014 program.
Acknowledgments: Authors thank Microtest srl (Altopascio, Italy) for managing the funding project, and the
Industrial Engineering Department (DIEF) of the University of Florence for their advices in the realization of the
mechanical set-up.
Conflicts of Interest: The authors declare no conflict of interest. The funders had no role in the design of the
study; in the collection, analyses, or interpretation of data; in the writing of the manuscript, and in the decision to
publish the results.

References
1. Athani, V.V. Stepper Motors: Fundamentals, Applications and Design; New Age International: New Delhi, India,
2005; ISBN 81-224-1006-5.
2. Robert, B.; Feki, M. Control of the stepping motor. In Control of Non-Con- Conventional Synchronous Motors;
Louis, J.P., Ed.; Wiley-ISTE: London, UK, 2012; ISBN 978-1-848-21331-9.
3. Gaan, D.R.; Kumar, M.; Sudhakar, S. Real-time precise position tracking with stepper motor using frequency
modulation based microstepping. IEEE Trans. Ind. Appl. 2018, 54, 693–701. [CrossRef]
4. Derammelaere, S.; Vervisch, B.; Cottyn, J.; Vanwalleghem, B.; Cox, P.; De Belie, F.; Stockman, K.;
Vandevelde, L.; Van Den Abeele, G. The efficiency of hybrid stepping motors. IEEE Ind. Appl. Mag.
2014, 20, 50–60. [CrossRef]
5. Krause, P.; Wasynczuk, O.; Sudhoff, S.; Pekarek, S. Analysis of Electric Machinery and Drive Systems; IEEE Press
Wiley: Hoboken, NJ, USA, 2013; ISBN 978-1-118-02429-4.
6. Wang, F.; Zhang, Z.; Mei, X.; Rodríguez, J.; Kennel, R. Advanced control strategies of induction machine:
Field oriented control, direct torque control and model predictive control. Energies 2018, 11, 120. [CrossRef]
7. Blackburn, J.L. Symmetrical Components for Power Systems Engineering; Marcel Dekker: New York, NY,
USA, 1993.
Electronics 2018, 7, 242 15 of 15

8. Monmasson, E.; Cirstea, M.N. FPGA design methodology for industrial control systems—A review.
IEEE Trans. Ind. Electron. 2007, 54, 1824–1842. [CrossRef]
9. Ricci, S.; Meacci, V.; Birkhofer, B.; Wiklund, J. FPGA-based system for in-line measurement of velocity
profiles of fluids in industrial pipe flow. IEEE Trans. Ind. Electron. 2017, 64, 3997–4005. [CrossRef]
10. Astrom, K.J.; Hagglund, T. Advanced PID Control; ISA-The Instrumentation, Systems, and Automation
Society: Research Triangle Park, CA, USA, 2006; ISBN 13: 978-1556179426.
11. Kim, W.; Yang, C.; Chung, C.C. Design and implementation of simple field-oriented control for permanent
magnet stepper motors without DQ transformation. IEEE Trans. Magn. 2011, 47, 4231–4234. [CrossRef]
12. Le, K.M.; Hoang, H.V.; Jeon, J.W. An advanced closed-loop control to improve the performance of hybrid
stepper motors. IEEE Trans. Power Electron. 2016, 32, 7244–7255. [CrossRef]
13. Jimenez-Fernandez, A.; Jimenez-Moreno, G.; Linares-Barranco, A.; Dominguez-Morales, M.J.; Paz-Vicente, R.;
Civit-Balcells, A. A neuro-inspired spike-based PID motor controller for multi-motor robots with low cost
FPGAs. Sensors 2012, 12, 3831–3856. [CrossRef] [PubMed]
14. Le, Q.N.; Jeon, J.W. Neural-network-based low-speed-damping controller for stepper motor with an FPGA.
IEEE Trans. Ind. Electron. 2009, 57, 3167–3180. [CrossRef]
15. Matsui, N.; Nakamura, M.; Kosaka, T. Instantaneous torque analysis of hybrid stepping motor. IEEE Trans.
Ind. Electron. 1996, 32, 1176–1182. [CrossRef]
16. Cetin, E.; Daldaban, F. Analyzing the profile effects of the various magnet shapes in axial flux PM motors by
means of 3D-FEA. Electronics 2018, 7, 13. [CrossRef]
17. Kazmierkowski, M.P.; Malesani, L. Current control techniques for three-phase voltage-source PWM
converters: A survey. IEEE Trans. Ind. Electron. 1998, 45, 691–703. [CrossRef]
18. Ricci, S.; Meacci, V.; Russo, D.; Matera, R. Encoder-Motor Misalignment Compensation for Closed-Loop
Hybrid Stepper Motor Control. In Proceedings of the 6th International Conference Applications in Electronics
Pervading Industry Environment Society (APPLEPIES 2018), Pisa, Italy, 26–27 September 2018.
19. Lu, W.; Wang, Q.; Ji, K.; Dong, H.; Lin, J.; Qian, J. Research on closed-loop drive system of two-phase hybrid
step motor based on SVPWM. In Proceedings of the 2016 IEEE Vehicle Power and Propulsion Conference
(VPPC), Hangzhou, China, 17–20 October 2016.
20. Liu, G.F.; Li, H.W. Design of stepper motor position control system based on DSP. In Proceedings of the 2017
2nd International Conference on Machinery, Electronics and Control Simulation (MECS 2017), Dubai, UAE,
24–25 June 2017.
21. Crnosija, P.; Kuzmanovic, B.; Ajdukovic, S. Microcomputer implementation of optimal algorithms for
closed-loop control of hybrid stepper motor drives. IEEE Trans. Ind. Electron. 2000, 47, 1319–1325. [CrossRef]
22. Tsui, K.W.H.; Cheung, N.C.; Yuen, K.C.W. Novel modeling and damping technique for hybrid stepper motor.
IEEE Trans. Ind. Electron. 2009, 56, 202–211. [CrossRef]
23. Derammelaere, S.; Vervisch, B.; De Viaene, J.; Stockman, K. Sensorless load angle control for two-phase
hybrid stepper motors. Mechatronics 2017, 43, 6–17. [CrossRef]
24. Gutierrez-Villalobos, J.M.; Rodriguez-Resendiz, J.; Rivas-Araiza, E.A.; Martínez-Hernández, M.A. Sensorless
FOC performance improved with on-line speed and rotor resistance estimator based on an artificial neural
network for an induction motor drive. Sensors 2015, 15, 15311–15325. [CrossRef] [PubMed]
25. Gómez-Espinosa, A.; Hernández-Guzmán, V.M.; Bandala-Sánchez, M.; Jiménez-Hernández, H.;
Rivas-Araiza, E.A.; Rodríguez-Reséndiz, J.; Herrera-Ruíz, G. A new adaptive self-tuning Fourier coefficients
algorithm for periodic torque ripple minimization in permanent magnet synchronous motors (PMSM).
Sensors 2013, 13, 3831–3847. [CrossRef] [PubMed]

© 2018 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access
article distributed under the terms and conditions of the Creative Commons Attribution
(CC BY) license (http://creativecommons.org/licenses/by/4.0/).

You might also like