Anda di halaman 1dari 5

REAL-TIME BLDC MOTOR CONTROL USING THE STELLARIS LM3S8962

MICROCONTROLLER
Radu Duma
1)
, Petru Dobra
2)
, Dorin Petreus
3)
, Ioan Valentin Sita
4)
and Radu Adrian Munteanu
5)
1, 2, 4)
Automatic Control Department,
3)
Applied Electronics Department,
5)
Electrical Measurement Department
Technical University of ClujNapoca
str. Memorandumului nr. 28, 400114, Cluj-Napoca, Romania
phone: + 4 0264 401 433, fax: +4 0264 592 055, email:
1)
radu.duma@.yahoo.com,
2)
dobra@aut.utcluj.ro,
3)
dorin.petreus@ael.utcluj.ro,
4)
valisita@yahoo.com,
5)
Radu.A.Munteanu@mas.utcluj.ro
web: www.utcluj.ro
ABSTRACT
The paper presents a brushless direct current (BLDC)
motor closed loop control application using the Texas
Instruments (TI) Stellaris LM3S8962 microcontroller. The
motor speed can be controlled and monitored in real-time
using the CAN module of the LM3S8962 microcontroller
and a graphical user interface (GUI) implemented in
Matlab. The data transfer between the microcontroller and
the PC is done using a USB to CAN converter. The
application presented in this paper also allows the remote
control of the BLDC motor using the Ethernet controller of
the LM3S8962 microcontroller. For speed control a PID
controller with anti-windup is implemented on the Stellaris
LM3S8962 microcontroller.
1. INTRODUCTION
Brushless direct current (BLDC) motor are extensively used
in many industry fields due to their characteristics: better
speed versus torque characteristics, high dynamic response,
high efficiency, long operating life, noiseless operation,
higher speed ranges.
For BLDC motor control there are analog solutions,
integrated solution and digital control solutions. Most
integrated circuits producers offer analog ICs for BLDC
motor control [1, 2]. There are also integrated control
solutions [3, 4] which allow the customization of the
control algorithm from a PC, using a graphical user
interface. The highest flexibility can be achieved by
implementing the control algorithm on a microcontroller or
a Digital Signal Processor (DSP). Texas Instruments (TI)
offers several digital control solutions for BLDC motor
control [5].
In this paper a closed loop control application for a BLDC
motor is implemented on a Stellaris LM3S8962
microcontroller [6]. Most BLDC motor control evaluation
kits implement a graphical user interface (GUI) which
allows the control of the BLDC motor, using the serial
interface for communication between the PC and
microcontroller. The Stellaris BLDC motor control
reference design kit [7] implements a GUI which
communicates with the control board using Ethernet. In this
paper, for real-time data exchange the CAN bus of the
microcontroller and an USB to CAN converter are used. A
GUI, implemented in Matlab, allows data visualization and
the control of the speed of the motor. Using the Ethernet
controller of the LM3S8962 microcontroller, also the
remote control of the BLDC motor is implemented. A PID
controller with anti-windup is used for closed loop BLDC
motor control.
2. HARDWARE ARCHITECTURE
In this paper the Stellaris LM3S8962 microcontroller,
member of the Stellaris LM3S8000 series, is used for the
implementation of a BLDC motor control algorithm. The
Stellaris family of microcontrollers - the first ARM Cortex-
M3 based controllers - brings high-performance 32-bit
computing to cost-sensitive embedded microcontroller
applications. The Stellaris LM3S8000 series combines
Bosch Controller Area Network (CAN) technology with
both a 10/100 Ethernet Media Access Control (MAC) and
Physical (PHY) layer.
The LM3S8962 microcontroller is targeted for industrial
applications, including remote monitoring, electronic point-
of-sale machines, test and measurement equipment,
network appliances and switches, factory automation,
HVAC and building control, gaming equipment, motion
control, medical instrumentation and fire and security. In
addition, the LM3S8962 microcontroller offers the
advantages of ARM's widely available development tools,
System-on-Chip infrastructure IP applications, and a large
user community.
Using the Stellaris microcontrollers a reduced time to
market can be obtained due to the following reasons:
StellarisWare on ROM includes driver and peripheral
libraries to ease development, C friendly IDE and compilers
from industry leaders, low cost development tools,
application specific and advanced development kits,
production-ready application modules. The Stellaris
microcontrollers are supported in several IDEs: Keil
Microcontroller Development Toolkit for ARM, IAR
Embedded Workbench, Code Composer Studio, Code Red
Technologies' RedSuite, Code Sourcery SourceryG++. For
the application presented in this paper Code Composer
Studio is used.
The hardware test setup is presented in Fig. 1. A Stellaris
Proceedings of the 4th European DSP in Education and Research Conference
57











Figure 1 Test setup.
LM3S8962 Ethernet+CAN evaluation kit, equipped with a
LM3S8962 microcontroller is used. The motor which is
controlled is a Hurst-Emerson BLDC motor [8]. On the
shaft of the motor an encoder is mounted.
The integrated power module IRAMS10UP60A, optimized
for electronic motor control, is used as motor drive for the
BLDC motor.
In order to communicate between the embedded processor
and the PC, an USB to CAN converter produced by Systec-
Electronic [9] is used
Unlike a brushed DC motor, the commutation of a BLDC
motor is controlled electronically. To rotate the BLDC
motor, the stator windings should be energized in a certain
sequence. For each motor the producer defines the
commutation sequence.
There are various modulation techniques for controlling
inverter drives: upper modulation, lower modulation,
rotating modulation, or balanced modulation. In this paper
the upper modulation is used. Using upper modulation
technique, only the upper transistors of the three phase
bridge are controlled using Pulse Width Modulation
(PWM) signals while for the lower transistors
enable/disable signals are used.
In Fig. 2 is presented an example of the upper modulation
waveforms and the signature of the Hall sensors. In this
figure, H
W
, H
V
, H
U
represent the signals from the Hall
sensors, corresponding to the three phases of the motor U,
V, W respectively; U
P
, V
P
and W
P
represent the upper
transistors of the three phase bridge corresponding to the
three phases of the motor U, V, W respectively; while U
N
,
V
N
and W
N
represent the lower transistors of the three phase
bridge corresponding to the three phases of the motor U, V,
W respectively. According to Fig. 2, when the signature of
the HALL sensors is 3 (3 corresponds to binary value 11,
that is H
W
= 0, H
V
= 1 and H
U
= 1) the V
P
and W
N
transistors
of the three phase inverter bridge have to be controlled.

Figure 2 - Upper modulation technique.
3. SOFTWARE ARCHITECTURE
The block diagram of a closed loop control system for
BLDC motor control with a LM3S8962 microcontroller is
presented in Fig. 3.
The controller must generate three PWM signals for
controlling the upper arm transistors of the three phase
bridge, while three General Purpose Input Output (GPIO)
pins are used to generate the enable/disable signals for the
lower arm transistors of the three phase bridge.
The signals from the HALL sensors are applied on three
GPIOs which are configured to generate an interrupt on
both edges of the incoming signal. The speed of the motor
can be determined using the signals from the Hall sensors,
but for applications which require a high accuracy of the
measured speed an encoder must be used. The reference
speed of the motor can be set over CAN or Ethernet. Based
on the reference and measured speed, the PID controller
computes the duty cycle for the PWM control signals.
TI provides for the Stellaris LM3S8962 microcontroller a
library for the drivers and the peripherals of the
microcontroller and well documented code examples,
which ease the development process. In the following
subsections some details of the software implementation are
presented.

Figure 3 - Closed loop control diagram with the LM3S8962
microcontroller.

BLDC Motor LM3S8000 Evaluation Kit USB-CAN Converter Driver
58
3.1 Control Signals
In order to control the three-phase bridge using the upper
modulation technique, the microcontroller must generate
three PWM signals. The Stellaris PWM module provides a
great deal of flexibility. It can generate simple PWM
signals, such as those required by a simple charge pump. It
can also generate paired PWM signals with dead-band
delays, such as those required by a half-H bridge driver.
Three generator blocks can also generate the full six
channels of gate controls required by a 3-phase inverter
bridge. Using the functions from the driver library the
LM3S8962 microcontroller is configured to generate three
PWM signal.
The upper modulation technique also requires three
enable/disable signals which are generated using three
GPIO pins. Based on the commutation sequence of the
BLDC motor, a certain PWM signal and a GPIO pin must
be used to control the three-phase bridge. The output
control block of the PWM module allows the enable/disable
of each PWM signal. This feature is used for the control of
the three phase bridge.
3.2 Feedback Signals
The BLDC motor must be commutated electronically, thus
it is important to know the position of the rotor. BLDC
motors have HALL sensors embedded in the stator. The
signals from the HALL sensors have to be applied to
external hardware interrupts pins, such that the
microcontroller can commutate the motor. Three GPIO pins
of the LM3S8962 microcontroller are configured as inputs.
Also the GPIOs are configured to generate interrupts on
both rising and falling edges of the signals generated by the
Hall sensors.
For closed loop control the speed of the motor is measured
using an encoder. The LM3S8962 microcontroller includes
two quadrature encoder interface (QEI) modules. Each QEI
module interprets the code produced by a quadrature
encoder wheel to integrate position over time and determine
direction of rotation. In addition, it can capture a running
estimate of the velocity of the encoder wheel. For the
presented application, the QEI block is configured for
capturing the velocity by counting the number of edges
during a fixed time period.
3.3 Interrupts
An embedded control system uses the interrupts of the
microcontroller for assuring real-time constraints. For
controlling a BLDC motor there are required an
asynchronous interrupt for motor commutation and a
synchronous interrupt for PID controller computation. The
Nested Vectored Interrupt Controller (NVIC) of the
LM3S8962 microcotroller prioritizes and handles all
exceptions.
In the asynchronous interrupts generated by the Hall
sensors the value of the three Hall sensors is read and the
corresponding transistors are energized based on the
commutation sequence. A timer of the microcontroller is
used for the generation of a periodic interrupt. In this
interrupt, based on the value from the encoder the speed of
the motor is computed. Using the reference speed and the
measured speed, the PID controller computes a new value
for the duty cycle of the PWM control signals. The new
value for the PWM duty cycle is applied on the
asynchronous interrupts.
4. CLOSED LOOP CONTROL
In this section the structure of the implemented PID
controller is described and the closed loop results are
presented.

4.1 Controller implementation
The standard equation of a PID controller is presented
below:
|
|
.
|

\
|
+ + =
}
t
d
i
p
dt
t d
T d
T
t K t u
0
) (
) (
1
) ( ) (
c
t t c c
where ) ( ) ( ) ( t y t y t
sp
= c is the error signal,
sp
y is the
set point and y is the output of the process.
Several modifications have been done to the standard PID
controller structure. A pure derivative gives a very large
amplification of measurement noise. The gain of the
derivative must thus be limited, by low-pass filtering the
derivative term, resulting in a limited gain N at high
frequencies. A fraction of the command signal acts on the
proportional part, while the derivative component acts only
on the output of the process.
The structure of the PID controller with integrator anti-
windup is shown in Fig. 4. Taking into consideration the
above remarks, the PID algorithm can be described by the
following equations [10]:


Figure 4 - The structure of the PID controller.
59
P
D
v
I
w
|
E
al
cy
of
re
4.
F
A
Z
cy
bu
co
ga
pa
li
F
co
co
im
to
T
pr
ca
F
F
re
( ) ( y K n P
p
= |
( ) ( n D n D
d
= o
) ( ) ( n P n v + =
) ( ) 1 ( n I n I = +
where T
d d
= o
s p i
T T K = |
Equations (1) w
lgorithm, on
ycle multiply
f Stellaris mic
eal-time const
.2 Controller
or controller
Astrom and H
Ziegler-Nichol
ycle the proce
ut a nonlinear
ontrol loop. F
ain and the
arameters of
mit cycle for t
rom the obta
ontroller are
ontroller, a cl
mplemented. T
o a rectangular
The motor p
resented in Fi
an be observe
Figure 5 - Limi
Figure 6 Clos
ectangular ref
) ( ) ( n y n y
sp
|
( ) 1 y n
d
+ |
( ) ( n D n I + +
) ( ( ) n y
sp i
+ |
( ) Nh T
d d
+
i
T and
s t
T = |
were used for
the LM3S896
instruction an
crocontrollers
traints.
r tuning
tuning the re
Hagglund [11]
s [12] metho
ess must not b
r feedback of
From the obt
ultimate per
the controlle
the BLDC mo
ained limit cy
e determined
losed loop for
The closed loo
r reference sig
phase voltag
ig. 7. From F
d.
it cycle of the
sed loop respo
ference signal
))
) ( ) 1 ( n y n y
) n

( )) (n y
t
+ |
, ( T K
d p d
= |
t s
T T .
r the impleme
62 microcontr
nd the hardwa
are used in o
elay feedback
proposed an
od. In order t
be brought at
f relay type is
tained limit c
riod are dete
er are comput
otor is present
ycle the param
. Using the
r BLDC moto
op response o
gnal is present
ges during
ig. 7 the six c
BLDC motor
onse of the BL
l.
))

)) ( ) ( ( n v n u
) ( N T N T
d d
+
ntation of the
roller. The sin
are divide fea
order to respec
k method is u
n extension o
o obtain the
the stability l
s introduced in
cycle the ulti
ermined, and
ted. The obta
ted in Fig. 5.
meters of the
e computed
or control spe
f the BLDC m
ted in Fig. 6.
commutation
commutation
r.
LDC motor to
(1)

) Nh ,
e PID
ngle-
atures
ct the
used.
of the
limit
limit,
n the
imate
d the
ained
PID
PID
eed is
motor
are
steps

a
Figu
capt
5. I
One
the
over
An i
emb
code
stan
pres
micr
com
Usin
CAN
varia
impl
spee
For
a U
prod
USB
mon
Matl
func
with
instr
The
need
insta
RPM
resp
pres
perc
The
whic
ure 7 - Motor p
tured using a d
INSTRUMEN
e important fe
high integrate
r: Ethernet, US
important fea
bedded applic
e executed on
dard is the u
ented in this p
rocontroller
mmunication be
ng the high lev
N module is
ables can be
lemented in
ed and the disp
data exchang
SB to CAN
ducer offers a
BCAN32.dll fi
nitoring is imp
lab environm
ctions are call
h the USB
rumentation p
reference sp
dle of the
antaneous spe
M-MEASURE.
onse of the m
ented, and in
centages, of th
LM3S8962 m
ch consists of
phase voltage
digital oscillo
NTATION, D
RESU
eature of the
ed connectivi
SB and CAN.
ature which sh
ation is the r
n the embedd
use of the C
paper, the CA
is used f
etween the mi
vel C function
configured,
e read or wri
Matlab allow
play of variou
ge between the
converter is u
an API in the
ile, a Matalb a
plemented. Af
ment, using
led which im
to CAN co
anel is presen
peed of the m
angular ga
eed can be ob
. In the upp
motor to a re
n the lower
he PWM contr
microcontrolle
f a fully integra
es during com
oscope.
DATA ACQU
ULTS
Stellaris mic
ity, allowing

hould be impl
real-time obs
ded processor
CAN bus. In
AN module of
for real-time
icrocontroller
ns from the St
and the valu
itten from th
ws the contro
us parameters.
e PC and the
used. For thi
form of a dll
application fo
fter loading th
the loadlibr
mplement the
onverter. The
nted in Fig. 8.
motor is set
auge RPM-S
bserved on the
per graphic,
ctangular refe
graphic the
rol signals is s
er has an Eth
ated MAC an
mutation
UISISION AN
crocontrollers
communicatio
lemented by
servation of t
r. One indust
the applicatio
f the LM3S896
e bidirection
and the PC.
ellarisWare, t
ues of differe
he PC. A GU
ol of the mot

microcontroll
is converter t
l file. Using t
or the CAN b
he dll file in t
rary comman
communicatio
e implement
by turning t
SP, while t
e angular gau
of Fig. 8, t
erence signal
duty cycle,
shown.
hernet controll
nd PHY. Usin

ND
is
on
an
the
try
on
62
nal
the
ent
UI
tor
ler
he
the
bus
the
nd,
on
ed
the
the
ge
the
is
in
ler
ng
60
F
us
th
S
in
F
T
B
S
m
co
F

Figure 8- Instr
sing the CAN.
he open sour
tellaris, the re
nstantenous sp
ig. 9 allows th
This paper pre
BLDC motor. T
tellaris LM
microcontroller
ontrollers, wit
Figure 9- Web
rumentation pa
.
rce light-weig
eference speed
peed is display
he remote con
6. CONC
esented a real
The control a
M3S8962 mi
rs are 32-b
th a reach se
page for remo
anel for BLDC
ght IP TCP/IP
d of the motor
yed. The web
ntrol of the BL
CLUSIONS
l-time control
lgorithm was
icrocontroller.
bit ARM C
et of peripher
ote control of
C motor contr
P stack porte
r can be set an
page present
LDC motor.
l application
implemented
. The Ste
Cortex-M3 b
rals. They ha
f the BLDC mo

rol
ed to
nd the
ted in
for a
d on a
ellaris
based
ve a

otor.
high
CAN
for m
moti
dete
For
inter
real-
the C
A G
moto
poss
cont
This
deve
in en
POS
Euro
Prog

REF
[1]
Fair
[2]
direc
Rect
[3] *
Sign
Atm
[4] *
Perf
[5]
Instr
[6] *
[7]
Refe
Instr
[8] *
[9]
Man
[10]
Pres
[11]
of th
D C
Mar
[12]
auto

h integrated co
N and Etherne
motor control
ion plus co
rministic arch
the real-time
rrupts of the
-time observat
CAN module
GUI implemen
or speed. The
sible through
troller an expe
A
s paper was
elopment thro
ngineering an
SDRU/89/1.5/
opean Social
gram Human R
FERENCES
***, Moto
child, Semico
***, Full-fe
ct drive of 3-
tifier, DataShe
***, Fully In
nal Generation
mel, Applicatio
***, Advance
formance Mot
***, http://ww
ruments.
***, http://ww
***, Stellari
erence Design
ruments, User
***, http://ww
***, "USB-
nul, 2008.
P. Dobra, N
ss, Cluj-Napoc
C. C. Hang,
he Ziegler-Nic
Control Theory
r. 1991.
J. Ziegler a
omatic control
onnectivity fro
et. The Stellar
l and commun
onnectivity i
hitecture like A
e execution o
microcontrol
tion of the co
of the LM3S8
nted in Matla
e remote con
a web page.
erimental tunin
ACKNOWLE
supported by
ough post-doct
nd applied scie
/S/57083",
l Fund thro
Resources 200
or drive syst
onductor, App
eatured powe
-phase brushl
eet.
ntegrated BL
n to the Full B
on Note.
ed 3-Phase M
tion Devices, P
ww.ti.com/mo
ww.ti.com/stel
is Brushless
n Kit with E
rss Manual, 2
ww.emersonm
CANmodul,''
Nonlinear Sy
ca, 1999.
K. J. Astrom
chols tuning f
y and Applica
and N. Nich
lers, Trans. A
om UART in
ris microcontro
nication appli
is possible
ARM Cortex-
of the control
ller are used,
de executed o
8962 microco
ab allows the
ntrol of the B
. For the tun
ng method wa
EDGMENT
y the project
toral research
ences PRiDE
project co-
ough Sectori
07-2013.
tem using S
lication Note
er module fo
less dc motor
DC Motor C
BLDC Motor C
Motor Control I
Product Manu
otorcontrol, Te
laris, Texas In
DC (BLDC)
Ethernet and
2010.
otors.com, Em
Systec-Elect
ystems (in R
and W. K. Ho
formula, IEE
ations, vol. 13
hols, Optimu
ASME, 7597
terface to US
ollers are suit
cations becau
only with
M3.
l algorithm t
, while for t
on the controll
ontroller is use
e control of t
BLDC motor
ing of the PI
as used.
Progress an
h and innovatio
E - Contract n
-funded fro
al Operation
SPM inverter
9019, 2001.
or high volta
r, Internation
ontrol from th
Control Chain
IC,
ual, 2008.
exas
nstruments.
Motor Contr
CAN, Tex
merson
tronic, Produ
Romanian), U.
o, Refinemen
EE Proceedin
38, pp. 111-11
um settings f
768, 1942
B,
ted
use
a
he
the
ler
ed.
the
is
ID
nd
on
no.
om
nal
r,
age
nal
he
n,
rol
xas
uct
.T.
nts
ngs
18,
for
61

Anda mungkin juga menyukai