June, 2008 Hands-on Workshop: Motor Control Part 4 Brushless DC Motors Made Easy AZ114 Eduardo Viramontes Applications Engineer TM Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. Agenda Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. TM 1 Motor Anatomy Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. TM 2 Motor Anatomy Brushed DC Rotor Commutator Stator ►The • first electric motor was the Brushed DC Motor Basic idea is to repel rotor from stator Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. TM 3 Motor Fundamentals N S Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. TM 4 Motor Fundamentals N + _ N S + S _ V Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. TM 5 Motor Fundamentals N + _ N S + S _ V Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. TM 6 Motor Fundamentals S N N S _ _ + + V Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. TM 7 Motor Fundamentals S + S N N _ + _ V Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. TM 8 Electric Motor Type Classification Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. TM 9 Electric Motor Type Classification ELECTRIC MOTORS DC AC ASYNCHRONOUS Induction SYNCHRONOUS Sinusoidal VARIABLE RELUCTANCE Brushless Permanent Magnet Surface PM Interior PM Wound Field Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. SR Stepper Known as Universal DC motors or Brushed DC Motors •AC power Tools •Washers, Dryers •Garage Openers •Blenders •Vacuum Cleaners •HVAC •Toys TM 10 Brushed DC Motors • Rotation due to electromagnetic force • Continues rotation with multiple coils • Undesirable effects due to friction and current reversing Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. TM 11 Electric Motor Type Classification ELECTRIC MOTORS DC AC ASYNCHRONOUS Induction SYNCHRONOUS Sinusoidal Brushless VARIABLE RELUCTANCE Reluctance Permanent Magnet Surface PM Interior PM Wound Field Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. SR Stepper •Robots •Traction Control •Servo Systems •Hard Drives •Fans •Sewing Machines •Treadmills •Industrial Machines TM 12 Brushless DC (BLDC) Motors The confusion arises because a BLDC Motor does NOT directly operate off a DC voltage source • Reverse design of brushed motors: • Magnet is on the rotor Inductors are on the stator Benefits vs. Brushed No mechanical commutator (higher speeds) Better torque/inertia ration (higher acceleration) Easier to cool (Higher specific outputs) Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. TM 13 Brushed and Brushless Motors Comparison Feature Brushed DC motor BLDC Motor Commutation Brushed commutation Electronic commutation based on Hall position sensors Maintenance Periodic maintenance is required Less required due to absence of brushless Life Shorter Longer Speed/Torque Moderately Flat. Higher speeds produces higher friction and this reduces torque. Flat Speed range Lower – Mechanical limitations by the brushes Higher – No mechanical limitation Building Cost Lower Higher – Permanent magnets Control Simple Complex and expensive Control Requirements A controller is required only when variable speed is desired A controller is always required Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. TM 14 Electric Motor Type Classification ELECTRIC MOTORS DC AC ASYNCHRONOUS Induction SYNCHRONOUS Sinusoidal Brushless VARIABLE RELUCTANCE Reluctance Permanent Magnet Surface PM Interior PM Wound Field Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. SR Stepper •Washing Machines •Vacuum Cleaners •Machine tools •Food Processors •Fans •Small Appliances TM 15 Switched Reluctance ►Both the rotor and stator have salient poles ►The stator winding is comprised of a set ►of coils, each wound to the stator Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. TM 16 Electric Motor Type Classification ELECTRIC MOTORS DC AC ASYNCHRONOUS Induction SYNCHRONOUS Sinusoidal Brushless VARIABLE RELUCTANCE Reluctance Permanent Magnet Surface PM Interior PM Wound Field Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. SR Stepper • Cruise Control •Air Vents •Medical Scanners •Gauges •Office Equipment •Printers •Instrumentation TM 17 Stepper Motor ►These motors turn as different voltages ►are applied to the different windings ►Field rotates in one direction while rotor ►moves in opposite direction of field ►In this example, field rotates 60°while rotor only moves 30° ►It takes four complete cycles of the control system to rotate motor through one cycle. This is because the Rotor has 4 poles Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. TM 18 Electric Motor Type Classification ELECTRIC MOTORS DC AC ASYNCHRONOUS Induction SYNCHRONOUS Sinusoidal Brushless VARIABLE RELUCTANCE Reluctance SR Stepper Permanent Magnet Surface PM •Get name from sinusoidial windings Interior PM Wound Field Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. TM 19 Brushless DC Motor Control ►BLDC • Motor versus PMSM Motor Both motors have identical construction. The difference is in stator winding only. The BLDC has distributed stator winding in order to have trapezoidal Back-EMF. The PMSM motor has distributed stator winding in order to have sinusoidal Back-EMF. Phase A A Phase Phase B B Phase Phase C C Phase Trapezoidal Back-EMF voltage Sinusoidal winding distribution Source: Hendershot J. R. Jr, Miller TJE: Design of brushless permanent-magnet motors Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. TM 20 Electric Motor Type Classification ELECTRIC MOTORS DC AC ASYNCHRONOUS Induction SYNCHRONOUS Sinusoidal Brushless VARIABLE RELUCTANCE Reluctance Permanent Magnet Surface PM Interior PM Wound Field Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. SR Stepper •Large Appliances •HVAC •Blowers •Fan Pumps •Industrial Controls •Lifts •Inverters TM 21 Induction Machines Invented over a century ago by Nikola Tesla • Stator same as BLDC • Difference in rotor construction If properly controlled • Provides constant torque • Low torque ripple No permanent magnets Think of it as a rotating transformer. •Stator is the primary •Rotor is the secondary Rotor current is “induced” from stator current Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. TM 22 AC Induction Motor Slip ►Basic Principle: The stator is a classic three-phase stator with the winding displaced by 120° The rotor is a squirrel cage rotor in which bars are shorted together at both ends of the rotor by cast aluminum end rings The rotor currents are induced by stator magnetic field. rotating Field ( ωs) Indu ced Torque curr ent ωr The motor torque is generated by an interaction between the stator magnetic field and induced rotor magnetic field NO BRUSHES, NO PERMANENT MAGNETS Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. TM 23 Electric Motor Type Classification ELECTRIC MOTORS DC AC ASYNCHRONOUS Induction SYNCHRONOUS Sinusoidal Brushless VARIABLE RELUCTANCE Reluctance SR Stepper Permanent Magnet Surface PM •Unpractical for large motors yet practical in small sizes Interior PM Wound Field Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. TM 24 Reluctance ►If the rotating field of a motor is de-energized, it will still develop 10 or 15% of synchronous torque ►If slots are cut into the conductor-less rotor of an induction motor, corresponding to the stator slots, a synchronous reluctance motor results ►Starts like an induction motor but runs with a small amount of synchronous torque Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. TM 25 Freescale Roadmap for Motor Control TM BLDC In Depth: BLDC Motor Configurations Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. TM 27 Windings Electrical Connection - Star A A + A - B C B B C C Star connection Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. TM 28 Windings Electrical Connection - Delta C A A + - C A B B C B Delta connection Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. TM 29 BLDC motor configuration 4 pole pairs N N S H3 B C H2 S S A A C B N N H1 S H1 H2 H3 1 0 1 Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. TM 30 BLDC motor configuration N S S S N H2 H1 N 3 pole pairs H3 9 coils Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. TM 31 External Rotor – Different Motor Configurations 4 pole pairs 2 pole pairs 1 pole pairs S H3 N N N H1 H3 B S S S A C B A C B B H1 C H2 S H2 A S N H2 B C A C A H1 S N H1 H2 H3 1 0 1 H1 H2 H3 1 0 1 H1 H2 H3 1 0 1 Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. N N H3 TM 32 Internal Rotor – Different Motor Configurations 1 pole pair 2 pole pairs H3 B H3 H1 A A C N C S S N N H2 S H2 S S H2 H1 H2 H3 1 0 1 N H1 B C H3 Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. H1 H2 H3 1 0 1 S H1 H2 H3 1 0 1 B A N N C C S N A 4 pole pairs B B A H1 TM 33 Six Step BLDC Motor Control • • • • Voltage applied on two phases only It creates 6 flux vectors Phases are power based on rotor position The process is called commutation Phases voltage Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. Power Stage TM 34 Brushless DC Motor Control ►Commutation example • Stator field is maintained 60°, 120°relative to rotor field Before commutation Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. After commutation TM 35 Brushless DC Motor Control ►Six Step BLDC Motor Control cont’d 1 Controller 2 R S b 3 4 T a c 5 6 1 1 0 Source: Eastern Air Devices, Inc. Brushless DC Motor Brochure Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. TM 36 Brushless DC Motor Control ►Six Step BLDC Motor Control cont’d Hall a Hall b Hall c PWM 1 PWM 3 PWM 5 PWM 2 PWM 4 PWM 6 0 60 120 180 240 300 360 Rotor Electrical Position (Degrees) Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. TM 37 Brushless DC Motor Control ►Example of commutation table Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. TM 38 Brushless DC Motor Control ►Sinusoidal BLDC motor control iS iSb All three phases are powered by sinewave shifted by 120° iSa iSc We are able to generate stator field to any position over 360° Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. TM 39 Brushless DC Motor Control Summary ►Six step control versus sinusoidal control Six step control Sinusoidal control + Simple PWM generation More complex PWM generation (sinewave has to be generated) Ripple in the torque (stator flux jumps by 60°) + Smooth torque (stator flux rotates fluently) A little noise operation (due to ripple in the torque) + Very quiet + Simple sensor Requires sensor with high resolution Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. TM 40 Sensor Example: Hall Effect Sensor ►Hall effect sensor is a transducer that varies its output voltage in response to changes in magnetic field ►Hall sensors are used for proximity switching, positioning, speed detection and current sensing applications ►In this case, hall sensors are used in On/Off mode Hall Sensor Everytime a magnetic field is sensed, a change in voltage can be detected Permanent Magnet Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. TM 41 Putting All Together Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. TM 42 Lab1 Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. TM 43 How to Set Up the Boards AC16 board 6. Jumper J13 APMOTOR board 7. 8 LED array 3 2 2. BDM 1 3. BLDC Motor 1. Power Supply (9V DC) Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. J13 TM 44 Create a New CodeWarrior Project 1. Click on the Open Icon 2. Select the MC9S08AC16 MCU 3. Select P&E Multilink/Cyclone Pro 4. Click next Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. TM 45 Name Your CodeWarrior Project 1. Set new name for your project 2. Select Project Path 3. Click next Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. TM 46 Add Additional Files 1. Select AC16DaugherCard.h 2. Add To Project Files 3. Click next Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. TM 47 Processor Expert 1. Click next Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. TM 48 C Options 1. Click next Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. TM 49 PC-Lint Options 1. Click Finish Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. TM 50 New Project Set Up 1. Click On Make Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. TM 51 Commutation Table & Knowing Position with Hall Effect sensors Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. TM 52 Necessity of Knowing the Position ►To • • • Signal sequence diagram for the hall sensors spin 3-phase BLDC motor: Detect position/commutation Read commutation table Mask and swap phases 60° H1 H2 H3 It is important to know the rotor position in order to maintain the rotating magnetic field 120° 180° 240° 300° 360° 1 0 1 0 1 0 Supplied motor voltage + A-B _ + B-C _ + C-A _ Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. TM 53 3-Phase Inverter Vb Q1 Q2 Q3 A B With the 3-phase inverter, you can control which phases need to be fed in order to turn the motor C Q4 Q5 Q6 0v Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. Q1, Q2 and Q3 is where the current goes in the motor and Q4, Q5 and Q6 is where the current goes out of the motor TM 54 Control of 3-Phase Inverter Determined on the Hall Sensor Position A C N S B’ A’ C’ A B BLDC Motor C B Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. TM 55 Control of 3-Phase Inverter Determined on the Hall Sensor Position A C A C’ N S B’ B BLDC Motor C B A’ H1 H2 H3 Phase A Phase B Phase C 1 0 1 +VDCB -VDCB NC 1 0 0 +VDCB NC -VDCB 1 1 0 NC +VDCB -VDCB 0 1 0 -VDCB +VDCB NC 0 1 1 -VDCB NC +VDCB 0 0 1 NC -VDCB +VDCB Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. TM 56 Control of 3-Phase Inverter Determined on the Hall Sensor Position A C’ B N B’ S A C BLDC Motor C B A’ H1 H2 H3 Phase A Phase B Phase C 1 0 1 +VDCB -VDCB NC 1 0 0 +VDCB NC -VDCB 1 1 0 NC +VDCB -VDCB 0 1 0 -VDCB +VDCB NC 0 1 1 -VDCB NC +VDCB 0 0 1 NC -VDCB +VDCB Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. TM 57 Control of 3-Phase Inverter Determined on the Hall Sensor Position A A C’ B N S B’ C BLDC Motor C B A’ H1 H2 H3 Phase A Phase B Phase C 1 0 1 +VDCB -VDCB NC 1 0 0 +VDCB NC -VDCB 1 1 0 NC +VDCB -VDCB 0 1 0 -VDCB +VDCB NC 0 1 1 -VDCB NC +VDCB 0 0 1 NC -VDCB +VDCB Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. TM 58 Control of 3-Phase Inverter Determined on the Hall Sensor Position A B’ C A C’ N S B BLDC Motor C B A’ H1 H2 H3 Phase A Phase B Phase C 1 0 1 +VDCB -VDCB NC 1 0 0 +VDCB NC -VDCB 1 1 0 NC +VDCB -VDCB 0 1 0 -VDCB +VDCB NC 0 1 1 -VDCB NC +VDCB 0 0 1 NC -VDCB +VDCB Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. TM 59 Control of 3-Phase Inverter Determined on the Hall Sensor Position A B’ A C’ N B S C BLDC Motor C B A’ H1 H2 H3 Phase A Phase B Phase C 1 0 1 +VDCB -VDCB NC 1 0 0 +VDCB NC -VDCB 1 1 0 NC +VDCB -VDCB 0 1 0 -VDCB +VDCB NC 0 1 1 -VDCB NC +VDCB 0 0 1 NC -VDCB +VDCB Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. TM 60 Control of 3-Phase Inverter Determined on the Hall Sensor Position A C N S B’ A C’ B BLDC Motor C B A’ H1 H2 H3 Phase A Phase B Phase C 1 0 1 +VDCB -VDCB NC 1 0 0 +VDCB NC -VDCB 1 1 0 NC +VDCB -VDCB 0 1 0 -VDCB +VDCB NC 0 1 1 -VDCB NC +VDCB 0 0 1 NC -VDCB +VDCB Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. TM 61 Lab 1 ►Make a program that • On/Off transistors moves the motor in the clockwise direction TO DO: •Enable Switch1 to enable commutations •Enable 3-Phase Inverter •LEDs will still reflect HALL Effect sensors •Each time Switch1 is pressed, we will advance one step in the commutation table •Commutation table will tell us which transistors to turn on •When Switch1 is not pressed, turn OFF transistors Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. TM 62 Import Table Add Variables, Enable Switch1, Enable Inverter extern unsigned char table_rotate[8]; unsigned char value; unsigned char commutation; void main(void) { EnableInterrupts; /* enable interrupts */ /* include your code here */ ENABLESWITCH(1); ENABLELED(1); ENABLELED(2); ENABLELED(3); ENABLE3PHASEINVERTER(); for(;;) { Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. TM 63 Wait for Switch1 to be Pressed for(;;) { __RESET_WATCHDOG(); /* feeds the dog */ LED1_PIN = HALL_1; LED2_PIN = HALL_2; LED3_PIN = HALL_3; if(!SW1_PIN) { } Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. TM 64 Once Pressed, Advance Counter, Commutate for(;;) { __RESET_WATCHDOG(); /* feeds the dog */ LED1_PIN = HALL_1; LED2_PIN = HALL_2; LED3_PIN = HALL_3; if(!SW1_PIN) { value++; if(value>=7) value = 1; commutation = table_rotate[value]; if(commutation & Q1_MASK) Q1 = 1; if(commutation & Q4_MASK) Q4 = 1; if(commutation & Q2_MASK) Q2 = 1; if(commutation & Q5_MASK) Q5 = 1; if(commutation & Q3_MASK) Q3 = 1; if(commutation & Q6_MASK) Q6 = 1; } Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. TM 65 Wait for Switch to be Released if(commutation & Q3_MASK) Q3 = 1; if(commutation & Q6_MASK) Q6 = 1; while(!SW1_PIN) { __RESET_WATCHDOG(); LED1_PIN = HALL_1; LED2_PIN = HALL_2; LED3_PIN = HALL_3; } } TURNOFFTRANSISTORS(); IT IS IMPORTANT TO TURN OFF TRANSISTORS! Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. TM 66 Download and Run Code 1. Click On Run 4. Click On Run 2. Click On Connect on the Debugger 3. Click On Yes To Reprogram the MCU Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. TM 67 Lab2 Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. TM 68 Lab 2 ►Make a program that • On/Off transistors move the motor in clockwise direction TO DO: Enable Switch5 to enable commutations • Check Hall Effect sensors to evaluate which commutation state motor is in • When Hall Effect sensors changes state, transistors will commutate • Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. TM 69 Add Variables, Enable Switch5 unsigned char pasthallsensors; unsigned char hallsensors; void main(void) { EnableInterrupts; /* enable interrupts */ /* include your code here */ ENABLESWITCH(5); ENABLESWITCH(1); ENABLELED(1); ENABLELED(2); ENABLELED(3); ENABLE3PHASEINVERTER(); for(;;) { Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. TM 70 Wait for Switch5 to be On for(;;) { __RESET_WATCHDOG(); /* feeds the dog */ LED1_PIN = HALL_1; LED2_PIN = HALL_2; LED3_PIN = HALL_3; while(SW5_PIN) { } TURNOFFTRANSISTORS(); Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. TM 71 Once On, Display and Check Hall Effect Sensors while(SW5_PIN) { __RESET_WATCHDOG(); /* feeds the dog */ LED1_PIN = HALL_1; LED2_PIN = HALL_2; LED3_PIN = HALL_3; hallsensors = 0; if(HALL_1) hallsensors |= 0x04; if(HALL_2) hallsensors |= 0x02; if(HALL_3) hallsensors |= 0x01; if(pasthallsensors != hallsensors) { /* Do something */ } } Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. TM 72 Once On, Display and Check Hall Effect Sensors if(pasthallhensors != hallsensors) { pasthallsensors = hallsensors; value++; if(value>=7) value = 1; commutation = table_rotate[value]; IT IS IMPORTANT TO TURNOFFTRANSISTORS(); TURN OFF if(commutation & Q1_MASK) Q1 = 1; TRANSISTORS! if(commutation if(commutation if(commutation if(commutation if(commutation & & & & & Q4_MASK) Q2_MASK) Q5_MASK) Q3_MASK) Q6_MASK) Q4 Q2 Q5 Q3 Q6 = = = = = 1; 1; 1; 1; 1; } Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. TM 73 Download and Run Code 1. Click On Run 4. Click On Run 2. Click On Connect on the Debugger 3. Click On Yes To Reprogram the MCU Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. TM 74 Sensorless Sensing ►Sensors are expensive and take up space ►Several techniques can be used to determine the motor position/speed without an external device ►These techniques are based on the electrical characteristics of motors, mainly on their inductance characteristics: ►Based on BEMF • Speed range from 5-10% up to 100% of nominal speed The BEMF must be high enough ►Based on Motor Inductance Saliency • Speed range from standstill to about 20% of nominal speed Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. TM 75 BEMF - - BEMF is just an acronym for Back Electromagnetic Force Back electromagnetic force is a fancy term for the generator characteristics of a motor As has been shown not all phases of the motor are on at the same time BEMF voltage can be measured on the inactive phases of the motor The characteristics of the voltage curve generated by BEMF can tell the position/speed of the motor The method that will be exposed is the zero crossing method. When BEMF voltage equals zero, the motor is in a specific position By measuring the zero crosses against time, the speed of the motor can be determined Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. TM 76 BLDC Motor Back-EMF Shape Phase A-B Voltage Phase B-C Voltage Phase A Phase C-A Voltage Phase B Phase C A CH4 0V C B Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. TM 77 Sensorless BLDC Motor Control with BEMF Zero-Crossing Detection Appropriate Phase Comparator Output selected Zero Crossing event detected Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. TM 78 Sensorless Commutation and BEMF 0 60 120 180 240 300 360 Rotor Electrical Position (Degrees) Phase R Phase S Phase T Zero crossings PWM 1 PWM 3 PWM 5 PWM 2 PWM 4 PWM 6 Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. TM 79 BLDC Central Point is Not Accessible ►3-phase inverter and DC bus current measurement Inverter Stage Udcbus Rshunt HB2 V0 Idcbus B A HB1 BLDC Motor C HB3 Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. TM 80 Zero Crossing Sensing Reference HB1 • A V0 B HB2 HB3 HB3 + - C + - HB3 HB1 + - + - C + - • HB2 B + - + - V0 + - Udcb A A HB1 V0 HB2 B + - ½ UDCB reference • GND reference Virtual CP reference Udcbus Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. HB1 HB3 V0 Idcbus HB2 A Rshunt C Motor central point is not accessible B ►BLDC BLDC Motor TM 81 Zero Crossing Sensing using ADC ½ UDCB reference HB1 ADC2 ADC3 ADC3 ADC4 C ADC2 HB3 GND reference HB1 Udcb ADC1 A HB2 B HB2 B B HB2 HB1 ADC1 V0 A ADC1 • A • V0 Virtual CP reference ADC2 HB3 ADC3 C • principle is the same as the HW topology, but more flexible V0 ►The HB3 ADC4 Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. TM 82 Application Details ►ADC Measurement – Back-EMF evaluation Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. TM 83 Back-EMF Detection Window 0 30 60 90 120 150 180 210 240 270 300 330 360 390 uVA uSa - “visible” Back-EMF detectable zero crossing Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. TM 84 Lab3 Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. TM 85 Sensorless BLDC Motor Control using MC9S08AC ►Application AC microcontroller PH A,B,C 6 3-phase inverter 6 PWM 4 ADC inputs 3 3.3V 3 inputs BDM 3 DC current sensing Zero-cross detection circuit 3 outputs Diagram Power supply Fault LED Direction LED Run/Stop status 3 BLDC motor APMOTOR board 9 Vdc PB_A PB_B SW Freemaster on PC Read/set variables Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. TM 86 Sensorless BLDC Motor Control using MC9S08AC ►MC9S08AC • Timer 1 • 6 channels: PWM modulation for BLDC motor (complementary bipolar) Timer 2 • Peripheral Utilization Time base for commutation period measurement Channel 0: commutation Channel 1: timing of application A/D Converter DC bus current, phase voltages (zero-cross detection) Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. TM 87 PI Control ►Proportional • • Control Error multiplied by constant Deals with present behavior Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. TM 88 PI Control ►Integral • • • Control Ads long-term precision Takes longer to settle, but provides better precision Deals with past behavior Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. TM 89 PI controller on AC MCU These variables are used To tune the system Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. This is the control Algorithm inplemented In AC16 MCU for Motor control TM 90 PWM and manual dead time insertion ►PWM Generation ► TIMER set to center aligned mode (TPM1SC:CPWMS=1) ► Example: • • • • • • PWM0: switching (duty cycle (50 - 100%) + dead time), negative polarity (TMP1CxSC:ELSnB =x,TMP1CxSC:ELSnA =1) PWM1: switching (duty cycle (50 - 100%) - dead time), positive polarity (TMP1CxSC:ELSnB =1,TMP1CxSC:ELSnA =0) PWM2: switching (duty cycle (50 - 100%) - dead time), positive polarity (TMP1CxSC:ELSnB =1,TMP1CxSC:ELSnA =0) PWM3: switching (duty cycle (50 - 100%) + dead time), negative polarity (TMP1CxSC:ELSnB =x,TMP1CxSC:ELSnA =1) PWM4: OFF PWM5: OFF Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. TM 91 Dead Time Q1 Q4 a) Center aligned PWM, Q1 and Q4 change in the same instant, it can short circuit between Vb and GND Q1 Q4 b) Center aligned PWM, Q1 and Q4 triggered with different PWM duty cycle avoiding that both transistors turn on at the same time. Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. TM 92 Application Details ►ADC • • • • Measurement DC bus current, Back-EMF voltage Single result register only 3.5 us conversion time ADC measurement has to be synchronized with PWM Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. TM 93 Application Details ►ADC Measurement – PWM -> ADC Synchronization Overflow interrupt is used for PWM->ADC synchronization Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. TM 94 Application Details ►ADC Measurement – Back-EMF evaluation Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. TM 95 FlexTimer in the MCF51AC This part pending because dev board was delivered on April 29 Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. TM 96 FlexTimer advantages ► Supports up to 8 channels which can be synchronized in pairs for complementary signal generation. ► Dead time insertion supported by software. ► FTM can trigger ADC conversions automatically. ► Fault input supported by hardware (automatically turns of PWM pin outputs). ► Synchronized reloading of PWM duty cycle from several sources (ADC, analog comparator, software). ► Polarity for PWM output can be configured. ► Edge and center alligned PWM generation. Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. TM 97 Dead time insertion ► Used to avoid to power devices to be turned on at the same time. • • No CPU load generated to make dead time insertion. To configure simply enable dead time insertion bit and configure the number of timer counts of dead time, the rest is done by timer module. Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. TM 98 ADC Synchronization ► Reduces CPU load by saving time needed to start conversions (to detect zero-crossings or instantaneous current. ► When doing back-EMF sensing measurements need to be made in certain timing windows. If measurements are always taken at the same times, control algorithm is more precise. Timer Channel ISR Timer Channel ISR t1 1 Manual start of ADC conversion Automatic start of ADC conversion t2 t1 ADC conversion ADC conversion ADC Channel ISR ADC Channel ISR t3 1 Process ADC data ► Without hardware ► T = t1 + t2 + t3 trigger Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. t3 Process ADC data With hardware trigger T = t1 + t3 TM 99 Related Session Resources Sessions (Please limit to 3) Session ID Title AZ131 Motor Control Part 1 – Fundamentals and Freescale Solutions AZ121 Motor Control Part 2 – Solutions for Large Appliances and HVAC AZ120 Motor Control Part 3 – Solutions for Small Appliances and Health Care Applications Demos (Please limit to 3) Meet the FSL Experts (Please limit to 3) Pedestal ID Title Demo Title 312 Large Appliance Demo 214 3-Phase PMSM Vector Control demo with Encoder 706 Air Hockey Demonstration featuring the Flexis AC Products Freescale Semiconductor Proprietary Information. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. Time Location TM 100 TM