real-time bldc motor control using the stellaris lm3s8962

Upload: deependra-magarde

Post on 03-Apr-2018

214 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/28/2019 Real-time Bldc Motor Control Using the Stellaris Lm3s8962

    1/5

    REAL-TIME BLDC MOTOR CONTROL USING THE STELLARIS LM3S8962

    MICROCONTROLLER

    Radu Duma1), Petru Dobra2), Dorin Petreus3), Ioan Valentin Sita4) and Radu Adrian Munteanu5)

    1, 2, 4)

    Automatic Control Department,

    3)

    Applied Electronics Department,

    5)

    Electrical Measurement DepartmentTechnical University of ClujNapocastr. Memorandumului nr. 28, 400114, Cluj-Napoca, Romania

    phone: + 4 0264 401 433, fax: +4 0264 592 055, email:1)

    [email protected],2)

    [email protected],3)[email protected], 4)[email protected], 5)[email protected]

    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. Themotor speed can be controlled and monitored in real-time

    using the CAN module of the LM3S8962 microcontrollerand a graphical user interface (GUI) implemented inMatlab. The data transfer between the microcontroller andthe PC is done using a USB to CAN converter. Theapplication presented in this paper also allows the remotecontrol of the BLDC motor using the Ethernet controller of

    the LM3S8962 microcontroller. For speed control a PIDcontroller with anti-windup is implemented on the StellarisLM3S8962 microcontroller.

    1. INTRODUCTION

    Brushless direct current (BLDC) motor are extensively used

    in many industry fields due to their characteristics: betterspeed 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. Mostintegrated circuits producers offer analog ICs for BLDCmotor control [1, 2]. There are also integrated controlsolutions [3, 4] which allow the customization of thecontrol algorithm from a PC, using a graphical user

    interface. The highest flexibility can be achieved byimplementing the control algorithm on a microcontroller or

    a Digital Signal Processor (DSP). Texas Instruments (TI)offers several digital control solutions for BLDC motorcontrol [5].

    In this paper a closed loop control application for a BLDCmotor is implemented on a Stellaris LM3S8962microcontroller [6]. Most BLDC motor control evaluationkits implement a graphical user interface (GUI) whichallows the control of the BLDC motor, using the serialinterface for communication between the PC andmicrocontroller. The Stellaris BLDC motor control

    reference design kit [7] implements a GUI whichcommunicates 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 andthe control of the speed of the motor. Using the Ethernetcontroller of the LM3S8962 microcontroller, also the

    remote control of the BLDC motor is implemented. A PIDcontroller 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 theimplementation of a BLDC motor control algorithm. TheStellaris family of microcontrollers - the first ARM Cortex-M3 based controllers - brings high-performance 32-bitcomputing to cost-sensitive embedded microcontrollerapplications. The Stellaris LM3S8000 series combinesBosch 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, motioncontrol, medical instrumentation and fire and security. Inaddition, the LM3S8962 microcontroller offers theadvantages 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 peripherallibraries 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 Stellarismicrocontrollers are supported in several IDEs: KeilMicrocontroller Development Toolkit for ARM, IAREmbedded Workbench, Code Composer Studio, Code RedTechnologies' RedSuite, Code Sourcery SourceryG++. For

    the application presented in this paper Code ComposerStudio 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

  • 7/28/2019 Real-time Bldc Motor Control Using the Stellaris Lm3s8962

    2/5

    Figure 1 Test setup.

    LM3S8962 Ethernet+CAN evaluation kit, equipped with a

    LM3S8962 microcontroller is used. The motor which iscontrolled is a Hurst-Emerson BLDC motor [8]. On theshaft of the motor an encoder is mounted.

    The integrated power module IRAMS10UP60A, optimizedfor electronic motor control, is used as motor drive for theBLDC motor.

    In order to communicate between the embedded processorand the PC, an USB to CAN converter produced by Systec-Electronic [9] is used

    Unlike a brushed DC motor, the commutation of a BLDCmotor is controlled electronically. To rotate the BLDC

    motor, the stator windings should be energized in a certainsequence. For each motor the producer defines thecommutation sequence.

    There are various modulation techniques for controllinginverter drives: upper modulation, lower modulation,

    rotating modulation, or balanced modulation. In this paperthe upper modulation is used. Using upper modulationtechnique, only the upper transistors of the three phasebridge are controlled using Pulse Width Modulation(PWM) signals while for the lower transistorsenable/disable signals are used.

    In Fig. 2 is presented an example of the upper modulation

    waveforms and the signature of the Hall sensors. In thisfigure, HW, HV, HU represent the signals from the Hallsensors, corresponding to the three phases of the motorU,

    V, W respectively; UP, VP and WP represent the uppertransistors of the three phase bridge corresponding to the

    three phases of the motor U, V, Wrespectively; while UN,VN and WNrepresent the lower transistors of the three phasebridge corresponding to the three phases of the motorU, V,Wrespectively. According to Fig. 2, when the signature ofthe HALL sensors is 3 (3 corresponds to binary value 11,that isHW= 0,HV= 1 andHU= 1) the VPand WN 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 ispresented in Fig. 3.

    The controller must generate three PWM signals forcontrolling 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 thelower 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 referencespeed 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 alibrary for the drivers and the peripherals of the

    microcontroller and well documented code examples,which ease the development process. In the followingsubsections some details of the software implementation arepresented.

    Figure 3 - Closed loop control diagram with the LM3S8962microcontroller.

    BLDC Motor LM3S8000 Evaluation Kit USB-CAN Converter Driver

    58

  • 7/28/2019 Real-time Bldc Motor Control Using the Stellaris Lm3s8962

    3/5

    3.1 Control SignalsIn order to control the three-phase bridge using the uppermodulation technique, the microcontroller must generatethree PWM signals. The Stellaris PWM module provides agreat deal of flexibility. It can generate simple PWMsignals, such as those required by a simple charge pump. It

    can also generate paired PWM signals with dead-banddelays, such as those required by a half-H bridge driver.

    Three generator blocks can also generate the full sixchannels of gate controls required by a 3-phase inverterbridge. Using the functions from the driver library theLM3S8962 microcontroller is configured to generate threePWM signal.

    The upper modulation technique also requires threeenable/disable signals which are generated using three

    GPIO pins. Based on the commutation sequence of theBLDC motor, a certain PWM signal and a GPIO pin must

    be used to control the three-phase bridge. The outputcontrol block of the PWM module allows the enable/disableof each PWM signal. This feature is used for the control ofthe three phase bridge.

    3.2 Feedback SignalsThe BLDC motor must be commutated electronically, thusit is important to know the position of the rotor. BLDCmotors have HALL sensors embedded in the stator. The

    signals from the HALL sensors have to be applied toexternal hardware interrupts pins, such that themicrocontroller can commutate the motor. Three GPIO pinsof the LM3S8962 microcontroller are configured as inputs.Also the GPIOs are configured to generate interrupts onboth rising and falling edges of the signals generated by theHall sensors.

    For closed loop control the speed of the motor is measuredusing an encoder. The LM3S8962 microcontroller includestwo quadrature encoder interface (QEI) modules. Each QEI

    module interprets the code produced by a quadratureencoder wheel to integrate position over time and determine

    direction of rotation. In addition, it can capture a runningestimate of the velocity of the encoder wheel. For thepresented application, the QEI block is configured forcapturing the velocity by counting the number of edgesduring a fixed time period.

    3.3 InterruptsAn embedded control system uses the interrupts of themicrocontroller for assuring real-time constraints. For

    controlling a BLDC motor there are required anasynchronous interrupt for motor commutation and asynchronous interrupt for PID controller computation. TheNested Vectored Interrupt Controller (NVIC) of theLM3S8962 microcotroller prioritizes and handles allexceptions.

    In the asynchronous interrupts generated by the Hallsensors 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 isused for the generation of a periodic interrupt. In thisinterrupt, based on the value from the encoder the speed of

    the motor is computed. Using the reference speed and themeasured 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 theasynchronous interrupts.

    4. CLOSED LOOP CONTROL

    In this section the structure of the implemented PIDcontroller is described and the closed loop results arepresented.

    4.1 Controller implementationThe standard equation of a PID controller is presented

    below:

    t

    d

    i

    pdt

    tdTd

    TtKtu

    0

    )()(

    1)()(

    where )()()( tytyt sp is the error signal, spy is the

    set point and y is the output of the process.

    Several modifications have been done to the standard PIDcontroller structure. A pure derivative gives a very largeamplification of measurement noise. The gain of the

    derivative must thus be limited, by low-pass filtering thederivative term, resulting in a limited gain N at high

    frequencies. A fraction of the command signal acts on theproportional part, while the derivative component acts onlyon the output of the process.

    The structure of the PID controller with integrator anti-windup is shown in Fig. 4. Taking into consideration theabove remarks, the PID algorithm can be described by thefollowing equations [10]:

    Figure 4 - The structure of the PID controller.

    59

  • 7/28/2019 Real-time Bldc Motor Control Using the Stellaris Lm3s8962

    4/5

    v

    I

    Ealc

    or

    4

    F

    Zcbcgp

    li

    Fcci

    t

    Tpc

    r

    ()( Kn p

    ()( Dn d

    )()( nPn

    ()1( nIn

    here Td

    spi TK

    quations (1)gorithm, oncle multiply

    f Stellaris mial-time const

    .2 Controlleor controller

    strom and Hiegler-Nicholcle the proct a nonlineantrol loop.

    ain and thearameters of

    mit cycle for

    rom the obtntroller arentroller, a clplemented.

    a rectangula

    he motoresented in Fn be observe

    igure 5 - Lim

    igure 6 Clo

    ctangular re

    ()( nynsp

    ()1 yd

    ()( DnI

    )(() nyspi

    NhTd

    i and t

    ere used forthe LM3S89instruction a

    rocontrollersraints.

    tuning

    tuning the r

    agglund [11]s [12] methoss must notfeedback of

    From the obultimate pethe controlle

    the BLDC m

    ined limit cydetermined

    osed loop fohe closed lo

    r reference si

    hase voltagg. 7. From Fd.

    it cycle of the

    sed loop resp

    erence signa

    )

    ()1( nyn

    )

    ))(nyt

    , Kpd

    ts T .

    the impleme2 microcontd the hardw

    are used in o

    elay feedbac

    proposed ad. In order te brought atrelay type isained limitiod are detr are compu

    tor is present

    cle the para. Using th

    BLDC motp response o

    nal is presen

    es duringig. 7 the six

    BLDC motor

    nse of the B

    .

    )

    ))()( nvnu

    TN d

    ntation of theoller. The si

    are divide fe

    rder to respe

    method is

    extension oo obtain thethe stability lintroduced iycle the ulti

    ermined, anted. The obt

    ed in Fig. 5.

    eters of thecomputed

    r control spef the BLDC

    ed in Fig. 6.

    commutationommutation

    .

    DC motor to

    (1)

    h ,

    PIDngle-tures

    t the

    sed.

    f thelimitimit,

    themate

    theined

    PIDPID

    ed isotor

    aresteps

    a

    Fig

    capt

    5. I

    One

    theove

    An

    embcod

    stanpres

    miccom

    UsiCAvariimpspe

    Fora UproUSmo

    Matfunwit

    inst

    Thenee

    instRPresppresperc

    The

    whi

    re 7 - otor

    ured using a

    NSTRUME

    important f

    high integrat: Ethernet, U

    important fea

    edded applicexecuted o

    dard is theented in this

    ocontrollermunication b

    g the high lemodule is

    ables can beemented ind and the dis

    data exchangSB to CANucer offers aCAN32.dllfiitoring is im

    lab environtions are cal

    the USB

    umentation p

    reference sple of the

    ntaneous spe-MEASURE.

    onse of theented, and ientages, of th

    LM3S8962

    h consists of

    hase voltag

    igital oscillo

    TATION,

    RESU

    ature of the

    d connectiviB and CAN.

    ture which s

    ation is thethe embed

    se of the Caper, the C

    is used fetween the m

    el C functioconfigured,read or wr

    Matlab allolay of variou

    e between thconverter isn API in thele, a Matalblemented. A

    ent, usinged which ito CAN c

    anel is presen

    eed of theangular g

    ed can be obIn the uppotor to a rethe lower

    e PWM contr

    icrocontroll

    a fully integr

    s during com

    scope.

    ATA ACQU

    LTS

    Stellaris mic

    ty, allowing

    ould be imp

    real-time obsed processo

    AN bus. InN module of

    or real-timecrocontroller

    s from the Stand the valitten from ts the contros parameters.

    PC and theused. For thiform of a dllapplication foter loading t

    the loadlibrplement thenverter. Th

    ted in Fig. 8.

    otor is setuge RPM-

    served on ther graphic,ctangular refgraphic theol signals is s

    er has an Eth

    ated MAC a

    mutation

    ISISION A

    rocontrollers

    communicati

    emented by

    ervation of t. One indus

    the applicatithe LM3S89

    bidirectioand the PC.

    ellarisWare, tes of differe PC. A Gl of the mo

    microcontrols converter tfile. Using tr the CAN be dllfile in t

    ary commacommunicati

    implement

    by turning tP, while t

    angular gauof Fig. 8, trence signalduty cycle,hown.

    ernet controll

    d PHY. Usi

    D

    is

    on

    an

    hery

    on62

    al

    hentI

    or

    erheheushe

    d,oned

    hehe

    geheisin

    er

    g

    60

  • 7/28/2019 Real-time Bldc Motor Control Using the Stellaris Lm3s8962

    5/5

    u

    tSiF

    TB

    S

    c

    igure 8- Instring the CAN.

    e open sourtellaris, the restantenous sig. 9 allows t

    his paper prLDC motor.

    tellaris LMicrocontrollentrollers, wi

    igure 9- Web

    umentation p

    ce light-weigference speeeed is displae remote con

    6. CON

    sented a realThe control a

    3S8962 mirs are 32-h a reach s

    page for rem

    nel for BLD

    ht IP TCP/Iof the motored. The web

    trol of the B

    CLUSIONS

    -time controllgorithm was

    crocontroller.it ARMt of periphe

    te control o

    motor contr

    P stack portcan be set anpage presentDC motor.

    applicationimplemented

    The Steortex-M3als. They ha

    the BLDC m

    ol

    d tod theed in

    for aon a

    llarisasedve a

    tor.

    higCA

    formotdete

    For

    interealtheAmotpos

    cont

    Thi

    devin e

    POEurPro

    RE

    [1]Fair[2]

    direRec

    [3]SigAt[4]Per[5]

    Inst[6]

    [7]RefInst[8][9]Ma

    [10]Pres[11]of tDMar[12]auto

    integrated cand Ethern

    otor controlon plus crministic arc

    the real-tim

    rupts of thetime observaAN module

    UI implemeor speed. Thible through

    roller an exp

    paper was

    lopment throgineering an

    DRU/89/1.5/pean Socialram Human

    ERENCES

    ***, Motochild, Semico***, Full-f

    ct drive of 3ifier, DataSh

    ***, Fully Ial Generatioel, Applicatio**, Advancormance Mot***, http://w

    uments.**, http://w

    ***, Stellarirence Desiguments, User**, http://w***, "USB-ul, 2008.

    P. Dobra, s, Cluj-NapoC. C. Hang,e Ziegler-Ni

    ontrol Theor. 1991.

    J. Zieglermatic control

    nnectivity frt. The Stellar

    and communnectivityitecture like

    execution

    microcontrotion of the coof the LM3Sted in Matl

    e remote coa web page.

    rimental tuni

    CKNOWL

    supported b

    ugh post-docd applied sci

    S/57083",Fund thr

    esources 20

    r drive sysnductor, Appatured powe

    -phase brushleet.

    tegrated BLto the Full

    n Note.ed 3-Phase Mion Devices,w.ti.com/mo

    w.ti.com/stel

    s BrushlessKit with

    ss Manual, 2w.emersonmCANmodul,''

    onlinear Sya, 1999.K. J. Astromchols tuning

    and Applic

    nd N. Nichlers, Trans.

    om UART inis microcontr

    ication applis possibleRM Cortex-

    f the contro

    ler are used,de executed o8962 microcob allows thetrol of theFor the tun

    ng method w

    DGMENT

    the project

    oral researchnces PRiD

    project co-ugh Sectori7-2013.

    em usinglication Noter module fo

    ess dc motor

    DC Motor CLDC Motor

    otor ControlProduct Mantorcontrol, T

    laris, Texas I

    DC (BLDC)Ethernet and010.otors.com, E

    Systec-Elec

    stems (in R

    and W. K. Hformula,IEtions, vol. 13

    ols, OptimSME, 7597

    terface to USollers are suit

    cations becauonly with

    M3.

    algorithm t

    while for tn the controlntroller is uscontrol of tLDC motor

    ing of the P

    s used.

    Progress a

    and innovati- Contract

    funded froal Operatio

    PM inverte9019, 2001.r high volta

    , Internatio

    ontrol from tontrol Chai

    C,al, 2008.xas

    struments.

    Motor ContCAN, Tex

    ersonronic, Prod

    omanian), U.

    , RefinemeE Proceedin8, pp. 111-11

    m settings68, 1942

    B,ed

    sea

    he

    heerd.heis

    ID

    d

    ono.

    mal

    ,

    ge

    al

    he,

    olas

    ct

    T.

    tsgs8,

    or

    61