Upload
sachin-ghankot
View
251
Download
3
Embed Size (px)
Citation preview
7/25/2019 BLDC algorithms
1/13
ECE 480 Application Note
Brushless DC MotorControl Algorithms
and ApplicationsAbstract
Brushless DC motors are high efficiency motors which are used
across a wide variety of applications. These motors require more robustcontrol algorithms then their brushed DC counterpart. BLDC motors are
synchronous motors that require a 3-phase C signal to drive them. This
note will give a brief overview of BLDC motor control as well as give
information and an e!ample of a basic control algorithm.
Keywords
BLDC" #-step commutation" rduino" motor controller" bac$ %&'" (all %ffect" )nverter"
%lectric *ehicle"
By: Matt Myers
11/6/2013
7/25/2019 BLDC algorithms
2/13
Brushless DC &otor Control lgorithms and pplications 201
3
Table of Contents
Introduction------------------------------------------------3
Objective----------------------------------------------------+
Body---------------------------------------------------------+
)nverter Bridge----------------------------------------------+
Commutation------------------------------------------------,
rduino )mplementation----------------------------------#Coding with the rduino----------------------------------
Testing the code--------------------------------------------
Conclusion---------------------------------------------page
Appendix-----------------------------------------------page
References----------------------------------------------page
&att &yers Team /0 1
7/25/2019 BLDC algorithms
3/13
Brushless DC &otor Control lgorithms and pplications 201
3
32,3+,.doc
Introduction
Brushless DC motors are becoming more common in a variety of motor
applications such as fans" pumps" appliances" automation" and automotive drive. Thereasons for their increased popularity are better speed versus torque characteristics" high
efficiency" long operating life" and noiseless operation. )n addition to these advantages"the ratio of torque delivered to the si4e of the motor is higher" ma$ing it useful in
applications where space and weight are critical factors.
The stator of a BLDC motor is similar to that of an induction machine but the
windings are distributed quite differently. The stator windings can be seen on the outsidering of figure . The two different common distributions of the windings are distributed
and sinusoidal. distributed winding will have a trape4oidal bac$ %&' while a
sinusoidal winding will have a sinusoidal bac$ %&'. 'or more information on bac$ %&'see this note.This application note will focus on BLDC motors with distributed stator
windings. The rotor of a brushless DC motor is different in the fact that the rotor containspermanent magnets instead of additional windings. This is represented by the north andsouth poles in figure .
5nli$e a brushed DC motor" the commutation of a BLDC motor in controlled
electronically. To rotate the BLDC motor" the stator windings should be energi4ed in asequence. )n order to ma$e sure the motor controller is energi4ing coils in the correct
sequence6 (all %ffect sensors must be used to detect the position of the rotor in the motor.
7hen the rotor is spinning inside the motor either a 8orth or 9outh :ole will pass by the
(all %ffect sensors which will cause the sensor to output which section of the rotor ispassed.
Figure 1
&att &yers Team /0 3
http://physics.bu.edu/~duffy/sc545_notes04/back_emf.htmlhttp://physics.bu.edu/~duffy/sc545_notes04/back_emf.htmlhttp://physics.bu.edu/~duffy/sc545_notes04/back_emf.html7/25/2019 BLDC algorithms
4/13
Brushless DC &otor Control lgorithms and pplications 201
3
32,3+,.doc
Objective
This application note outlines the basic theory behind BLDC motor control
algorithms and also will give an overview of how to implement basic versions of thesealgorithms on both the C1222 launch pad and an rduino microcontroller.
Inverter Bridge
%very C motor controller will have a high voltage bridge that feeds current into
the separate phases. diagram of this system can be seen in figure 1. This bridge consists
of si! &;9'%T switches that force current through two of the three phases of the motoras seen in figure three. The top three &;9'%T9 are attached to the positive side of the
DC voltage while the bottom three &;9'%Ts are attached to the ground side of the DC
supply. This allows the motor controller to create a negative voltage by changing thedirection the current travels through the inductor. 'igure 3 below" shows one of the si!
possible positions the switches can be in. )n order to prevent shorts only a single
&;9'%T on the top and bottom rows can be closed at one time.
Figure
&att &yers Team /0 +
7/25/2019 BLDC algorithms
5/13
Brushless DC &otor Control lgorithms and pplications 201
3
32,3+,.doc
Figure !
Commutation
Commutation is process of switching the state of the &;9'%T9 in the (-bridge
in order to $eep the motor spinning. s mentioned previously there are si! possible statesthat can be used to drive a BLDC motor" the table below DC- 8C ?(" B?L
2 2 DC> 8C DC- # ?(" C?L
2 8C DC> DC- , B?(" C?L2 2 DC- DC> 8C + B?(" ?L
2 DC- 8C DC> 3 C?(" ?L
2 2 8C DC- DC> 1 C?(" B?LFigure "
&att &yers Team /0 ,
7/25/2019 BLDC algorithms
6/13
Brushless DC &otor Control lgorithms and pplications 201
3
32,3+,.doc
Figure #
The graphs above
7/25/2019 BLDC algorithms
7/13
Brushless DC &otor Control lgorithms and pplications 201
3
32,3+,.docthe program visit the rduino site here.The main window of the software should loo$
similar to the window pictured below in figure .
Figure $
Coding "it# t#e Arduino
To start coding connect your rduino to the computer via the 59B connection.The 59B connection provides communication as well as power to the chip. )f you are
unfamiliar with the rduino coding environment these tutorials onoutubeare helpful.
8ow the chip is ready to be programmed. Below a simple e!ample will be e!plained toget your motor spinning.
The code below shown in figure seen gives the basic variables that need to bedefined. These variables will store the hall effect sensor states and the current speed that
is desired for the motor. 8e!t the pin modes must be set. %ach pin on the rduino haseither an output or an input mode. )8 figure below the pin setup is shown. The pin
setup must be contained within your void
7/25/2019 BLDC algorithms
8/13
Brushless DC &otor Control lgorithms and pplications 201
3
32,3+,.doc
Figure %
Figure & Figure '
8e!t you must setup the :7& pins so that the frequency they operate is 31 $(4. Thiscan be accomplished in a few different ways and is outside the scope of this document.There is a great tutorial for accomplishing this tas$here.8ow that the pin modes"
variables" and other settings are correct the main loop of the program can be constructed.
)t is helpful to instantiate the serial communication available on the rduino6 this
allows you to debug the program as it is running in real time. The code to start the serialcommunication is shown in figure 0. The code above will need to be uncommented in
order to wor$ properly. 8e!t the program will need to read information from the user and
the hall effect sensors from the motor.
Figure 1(
&att &yers Team /0
http://usethearduino.blogspot.com/2008/11/changing-pwm-frequency-on-arduino.htmlhttp://usethearduino.blogspot.com/2008/11/changing-pwm-frequency-on-arduino.htmlhttp://usethearduino.blogspot.com/2008/11/changing-pwm-frequency-on-arduino.htmlhttp://usethearduino.blogspot.com/2008/11/changing-pwm-frequency-on-arduino.html7/25/2019 BLDC algorithms
9/13
Brushless DC &otor Control lgorithms and pplications 201
3
32,3+,.doc'igure 2 shows the code necessary to set variables equal to the inputs on the
microcontroller. The final step of programming is to implement the #-step commutation
in code. The e!ample code for this step is given in e!ample 1 of the appendi!. This
section of code is a state machine that switches state depending on the input from the halleffect sensors. These states will change the outputs of the microcontroller so that the
:7& is applying the correct voltage to each phase in turn.
$esting t#e Code
s mentioned previously the serial monitor on the rduino is a great tool fortroubleshooting code that has been developed. There are several other ways that code can
be tested for this proect. Before hoo$ing the microcontroller to the motor it is possible to
test its output using a dummy hall effect input. This can be accomplished in software withthe rduino or with another microcontroller that can be interfaced with the rduino. )n
e!ample one of the appendi!" code is given which will simulate the hall effect output of amotor. This code is written for the &9:+32 microcontroller and is essentially a statemachine with si! states that change based on a predetermined rotation. This code is
written so that the hall effect sensors cycle at a frequency of + (4. The code can easily
be modified to vary the frequency based on a voltage input. The code for the analog to
digital conversion is given at the top of the e!ample code.
Conc!usion
This application note gives a rudimentary overview of BLDC motor control and a way to
implement a simple BLDC motor controller. There is much more involved with anindustrial grade controller such as :)D control" over current protection" temperature
sensing and other capabilities. )t is possible to use the rduino to implement some of
these features but it is recommended to move to a more powerful microcontroller in orderto provide smooth operation and increased safety. ;ne option to loo$ at is T)s :iccolo
microcontrollers which have far more capabilities then the rduino.
Aendi%
)xa*ple 1+ Dummy (all %ffect 9ensor designed for &9:+32
Auns at + (E Can easily be adapted to another microcontroller
/include Fmsp+32g1,,3.hG
int 8e!t?9tateH16
int Current?9tateH6
long delayH26
&att &yers Team /0 0
7/25/2019 BLDC algorithms
10/13
Brushless DC &otor Control lgorithms and pplications 201
3
32,3+,.docint mainB)T1>B)T36
Knalog to Digital 9et5:K
DC2CTL H )8C(?+> C;89%M?16 KK%nable Continuous one channel read
DC2%2HB)T+6 KKTurns on + which is on :.+
KK9ets on *?ref to 1.,KK%nables Aeference" CD2 and
KK9ets 9ample and (old time to + cycles
KK%nable &C9
DC2CTL2 H A%'1?,* > A%';8 > DC2;8 > DC29(T?2 > B)T>9A%'?6?delay?cycles DC29C6 KK%nables DC
K:7&
9et5pKDC;CTL H CLDC;?#&(E6 KK9ets DC; to # &(4
BC9CTL H CLBC?#&(E6
KK:)8 :.# ;utputs T2.:9%LHB)T26
KK&C!H The timer repeatedly counts from 4ero up to the value of TCCA2 and bac$ down to 4ero.
KK9&CLN is the cloc$ source
T2CTLHT99%L?1>B)T,>B)T+6 KK5pKdown modeO the timer counts up to TCCA2 then down to 2222h.T2CCA2H2136 KKma! value to DC
T2CCTLH;5T&;D?16 KK9et mode #
T2CCAH1+,6 KK9ets the Duty Cycle
whileB)T168e!t?9tateH+6
brea$6
case +O:;5THB)T16
8e!t?9tateH,6
brea$6
case ,O:;5THB)T>B)T16
&att &yers Team /0 2
7/25/2019 BLDC algorithms
11/13
Brushless DC &otor Control lgorithms and pplications 201
3
32,3+,.doc8e!t?9tateH#6brea$6
case #O
:;5THB)T6
8e!t?9tateH6brea$6
P
?delay?cycles
7/25/2019 BLDC algorithms
12/13
Brushless DC &otor Control lgorithms and pplications 201
3
32,3+,.doc case +O
KK:;ATD H B22!!!226 KK Desired ;utput for pins 2-
:;ATD @H B2226
:;ATD JH B22222226 KK
analog7rite
7/25/2019 BLDC algorithms
13/13
Brushless DC &otor Control lgorithms and pplications 201
3
32,3+,.doc
&e'erences
Bac, )-F sitehttpOKKphysics.bu.eduKRduffyKsc,+,?notes2+Kbac$?emf.html
B./C *otor control by *icroc0ip
httpOKKww.microchip.comKdownloadsKenKappnotesK22,a.pdf
-ore B./C *otor control
httpOKKwww.imfran$lin.infoKmicrochipdatasheetsK22,a.pdf
ArduinohttpOKKwww.arduino.ccK
C0anging 2- Fre3uency on t0e Arduino
httpOKKusethearduino.blogspot.comK122KKchanging-pwm-frequency-on-arduino.html
&att &yers Team /0 3
http://physics.bu.edu/~duffy/sc545_notes04/back_emf.htmlhttp://ww1.microchip.com/downloads/en/appnotes/00885a.pdfhttp://www.jimfranklin.info/microchipdatasheets/00857a.pdfhttp://www.arduino.cc/http://usethearduino.blogspot.com/2008/11/changing-pwm-frequency-on-arduino.htmlhttp://physics.bu.edu/~duffy/sc545_notes04/back_emf.htmlhttp://ww1.microchip.com/downloads/en/appnotes/00885a.pdfhttp://www.jimfranklin.info/microchipdatasheets/00857a.pdfhttp://www.arduino.cc/http://usethearduino.blogspot.com/2008/11/changing-pwm-frequency-on-arduino.html