Preview only show first 10 pages with watermark. For full document please download

An2974

AN2974

   EMBED


Share

Transcript

   ©Freescale Semiconductor, Inc., 2005. All rights reserved. Freescale Semiconductor Application Note AN2974Rev. 1, 06/2005 Quick Start for Beginners toDrive a Stepper Motor by:Matthew Grant16-Bit Automotive ApplicationsMicrocontroller Division Introduction Thisapplicationnoteisfornoviceswhowantageneralquick-startguideshowinghowtocontrolasteppermotor.Becausesteppermotorscanbeusedinavarietyofwaysandaredrivenbyavarietyofdevices,there is a great deal of information available about how these motors work and how to use them. Toreduce confusion, the focus of this application note is on stepper motors that can be driven bymicrocontrollers.Thisdocumentincludesbasicinformationneededtogetstartedquickly,andincludesapractical example that is simple and easy to implement. What is a Stepper Motor? A stepper motor is an electrically powered motor that creates rotation from electrical current driven intothemotor.Physically,steppermotorscanbelargebutareoftensmallenoughtobedrivenbycurrentontheorderofmilliampere.Currentpulsesareappliedtothemotor,andthisgeneratesdiscreterotationofthemotorshaft.ThisisunlikeaDCmotorthatexhibitscontinuousrotation.Althoughitispossibletodriveasteppermotorinamannerwhereithasnearcontinuousrotation,doingsorequiresmorefinesseoftheinputwaveformthatdrivesthesteppermotor.Figure1illustratessomebasicdifferencesinstepperandDC motor rotation.  Quick Start for Beginners to Drive a Stepper Motor, Rev. 1 2Freescale Semiconductor Types of Stepper Motors Figure1. Stepper vs. DC Motor Rotation Types of Stepper Motors There are a variety of stepper motors available, but most of them can be separated into two groups:• Permanent-magnet (PM) stepper motor  — This kind of motor creates rotation by using theforces between a permanent magnet and an electromagnet created by electrical current. Aninterestingcharacteristicofthismotoristhatevenwhenitisnotpowered,themotorexhibitssomemagnetic resistance to turning.• Variable-reluctance(VR)steppermotor —UnlikethePMsteppermotor,theVRsteppermotordoesnothaveapermanent-magnetandcreatesrotationentirelywithelectromagneticforces.Thismotor does not exhibit magnetic resistance to turning when the motor is not powered. DISCRETE ROTATIONSTEPPER MOTOR x   °       x    ° HCS12MICROCONTROLLERCONTROLCONTINUOUS ROTATIONDC MOTORHCS12MICROCONTROLLERCONTROL1a)1b)  What is Inside?Quick Start for Beginners to Drive a Stepper Motor, Rev. 1 Freescale Semiconductor3 What is Inside? Generally, a stepper motor consists of a stator, a rotor with a shaft, and coil windings. The stator is asurrounding casing that remains stationary and is part of the motor housing, while the rotor is a centralshaft within the motor that actually spins during use. The characteristics of these components and howthey are arranged determines whether the stepper motor is a PM or VR stepper motor.Figure2andFigure3show an example of these internal components. Figure2. Permanent Magnet (PM) Stepper Motor Takingacloserlook,therotorinPMsteppermotorsisactuallyapermanent-magnet.Insomecases,thepermanentmagnetisintheshapeofadisksurroundingtherotorshaft.Onearrangementisamagneticdisk which consists of north and south magnetic poles interlaced together. The number of poles on themagnetic disk varies from motor to motor. Some simple PM stepper motors such as the one inFigure2onlyhavetwopolesonthedisk,whileothersmayhavemanypoles.Thestatorusuallyhastwoormorecoil windings, with each winding around a soft metallic core.Whenelectricalcurrentflowsthroughthecoilwindings,amagneticfieldisgeneratedwithinthecoil.Themetalliccoreisplacedwithinthecoilwindingstohelpchanneltheelectromagneticfieldperpendiculartothe outer perimeter of the magnetic disk. SIGNAL Ai+SN–+SIGNAL BROTOR SHAFTCOMING OUT OFPAGEDIRECTION OFMAGNETIC FIELDMETAL CORE USEDTO HELP CHANNELTHE MAGNETIC FIELDCOILWINDING–PERMANENT MAGNETDISK WITH TWO POLESCURRENTPERMANENT MAGNET STEPPER MOTOR  Quick Start for Beginners to Drive a Stepper Motor, Rev. 1 4Freescale Semiconductor What is Inside? Dependinguponthepolarityoftheelectromagneticfieldgeneratedinthecoil(northpole,outofthecoil,orsouthpole,intothecoil)andtheclosestpermanentmagneticfieldonthedisk,anattractionorrepulsionforce will exist. This causes the rotor to spin in a direction that allows an opposite pole on the perimeterofthemagneticdisktoalignitselfwiththeelectromagneticfieldgeneratedbythecoil.Whenthenearestopposite pole on the disk aligns itself with the electromagnetic field generated by the coil, the rotor willcometoastopandremainfixedinthisalignmentaslongastheelectromagneticfieldfromthecoilisnotchanged.VR stepper motors work in a very similar fashion.Figure3shows some of the physical details thatcharacterize its operation. In a VR stepper motor, the surrounding coils that are physically locatedoppositeofeachotherareenergizedtocreateoppositemagneticfields.Forexample,inFigure3a),coilC produces a south-pole magnetic field, and coilC produces a north-pole magnetic field. The magneticfieldsproducedbythecoilspassthroughtheairgapandthroughthemetallicrotor.Becausethemagneticfields attract each other, the metallic rotor spins in a direction that brings the nearest edges (2 and 4) oftherotorascloseaspossibletothepairofenergizedcoils(CandC).LikethePMstepperrotor,theVRstepper rotor will remain aligned to the coils as long as coils C andC are energized and the magneticfields are not changed. To move to the next state and continue this rotation, coils C andC must be de-energized,whilecoilsAandAmustbeoppositelyenergizedtoattractrotoredges1and3respectively.The same process occurs with coils B andB to attract rotor edges 2 and 4 respectively, and so on.Figure3showshowtherotorspinsasthecoilsareenergizedandde-energized.Thisisanexampleofa3-phase VR motor. Figure3. How the Variable Reluctance (VR) Rotor Spins Fromtheexamplesdiscussedearlier,wecanseethatiftheelectromagneticfieldsinboththePMandVRstepper motors are turned on, off, and reversed in the proper sequence, the rotor can be turned in aspecificdirection.Eachtimeanelectromagneticfieldcombinationischanged,therotormayturnafixednumberofdegrees.Asthesestatechangesinelectromagneticfieldstakeplacemorerapidly,ontheorderof milliseconds, the rotor can rotate faster, smoother, and sometimes more quietly. Because of themechanical limitations of the system, the rotor can only rotate effectively up to certain speeds.An external device, such as an HCS12 microcontroller (or, MCU), is very good for controlling theelectromagneticsequencesbydirectingtheflowofcurrentthroughthecoilwindings.Todothis,softwarecan be written and loaded into an HCS12 MCU. 1       2     3 4    A       B       C     A B  C     1       2  3 4       3b)       1      2   3 4   3a)  A       B       C     A B  C    A       B       C     A B  C   3c) VARIABLE RELUCTANCE STEPPER MOTOR  Waveforms that can Drive a Stepper MotorQuick Start for Beginners to Drive a Stepper Motor, Rev. 1 Freescale Semiconductor5 Waveforms that can Drive a Stepper Motor Stepper motors have input pins or contacts that allow current from a supply source (in this applicationnote, a microcontroller) into the coil windings of the motor. Pulsed waveforms in the correct pattern canbe used to create the electromagnetic fields needed to drive the motor. Depending on the design andcharacteristics of the stepper motor and the motor performance desired, some waveforms work betterthan others. Although there are a few options to choose from when selecting a waveform to drive a two-phase PM stepper motor, such as full-stepping or micro-stepping, this application note focuses on onecalled half-stepping. A graph of the waveform is given inFigure4.InFigure4a),foursignalsareshown.Thesesignalscanbeproducedbyadedicatedstepperdriveroramicrocontroller.Eachsignal(a,a,b,b)isappliedtoacoilterminal.Becauseeachcoilhastwoterminals,two signals must work together to drive a single coil. If we consider terminal a as a positive reference,thenthecombinationofsignalsaandacausethecoiltoseeaneffectivesignalA,showninFigure4b).Likewise, signal B inFigure4b) is produced by combining signals b andb fromFigure4a). Itisworthnotingthattheindividualwaveforms(a,a,b,b)directlyfromthemicrocontrollerpinstothecoilterminals only vary from 0V to +5V. However, the effective signal (A, B) applied to the coil varies from–5V to +5V, and has positive and negative duty cycles. Two of these effective waveforms shown inFigure4b), 90 degrees out of phase can be used to drive the PM stepper motor. Both waveforms areapplied to the motor simultaneously. Each transition in one of the waveforms corresponds to a statechange (movement) in the motor. Altogether,Figure4a) and b) show eight different states for half-stepping.Astepbystepdescriptionofhowtheseparticularwaveformsworktogethertomovethemotorshaft follows.WhencoilsignalAispositiveandcoilsignalBiszero,currentflowsintocoilAthroughterminalaandoutof terminala. This generates a north-pole electromagnetic field toward the magnetic disk, which repelsthenearestnorth-polesectiononthediskandattractsthenearestsouth-polesection.Theseforcescausethe motor to rotate in a direction that will align opposite poles. Coil B is not energized. NOTE The orientation of the rotor prior to energizing a single coil may be unknown.Itispossiblethat,forexample,therotorcouldbepositioned,as shown in Figure7 c), when attempting to align itself, as in Figure7 a). Figure7 c) is the worst case starting position for the desired alignment,shown in Figure7 a). It is even possible that initially the rotor may not turn because the magnetic forces of the coil could be equally divided over pushingandpullingthenorthandsouthpoleofthePMdisk.Ifthishappens,thenmovingtothenextsequentialstepbyenergizingbothcoilsshouldhelp  jolt the rotor free.