Brushless DC Motor Control Using PIC18Fxx31 Microcontrollers

Brushless DC (BLDC) Motor Control using PIC18Fxx31 Microcontrollers
© 2003 Microchip Technology Incorporated. All Rights Reserved. Brushless DC Motor Control Using PIC18Fxx31 Microcontrollers

1

© 2003 Microchip Technology Inc.

1

Finally we will see how a sensorless control of BLDC motor can be implemented using PIC18Fxx31 • At the end of this discussion. Brushless DC Motor Control Using PIC18Fxx31 Microcontrollers 2 The agenda for this discussion is: • First we will discuss an overview of motor control solutions from Microchip • PIC18Fxx31 has many peripherals that are useful for motor control application. We will discuss the major peripherals that are helpful in developing motor control application.Brushless DC Motor Control Using PIC18Fxx31 Microcontrollers Agenda G G G Overview of motor control solutions from Microchip PIC18Fxx31 peripherals for motor control BLDC motor control using PIC18Fxx31 G G G G Open loop control Closed loop control using Hall sensors Closed loop control using Quadrature encoder Sensorless control © 2003 Microchip Technology Incorporated. we will show few references that would be helpful for you to understand BLDC motors and controls using PIC18Fxx31 © 2003 Microchip Technology Inc. 2 . closed loop with Hall sensors and closed loop with Quadrature Encoder or also known as optical encoder. All Rights Reserved. • Then we will discuss the Brushless DC motor control using PIC18Fxx31 devices in open loop.

With our sophisticated development systems and technical documentation. variable speed brushless DC motor. PIC18 and dsPIC® devices Microchip Op Amps and International Rectifier drivers Provide everything a design engineer needs: G Low-risk product development G Lower total system cost G Faster time to market G Outstanding technical support G Dependable delivery & quality Visit us at www. analog op amps and comparators for sensors or feedback and power electronics from Microchip and International Rectifier.microchip. All Rights Reserved. Brushed DC. lower total system cost. 3 Microchip Technology offers a broad product portfolio that provides a complete system solution for your brushed DC motor. Microchip makes it easy for designers of all experience levels to complete a high performance electronic motor control design quickly and cost effectively. switched reluctance motor and stepper motor applications. outstanding technical support and dependable delivery and quality.microchip. BLDC. visit the Motor Control Design Center at www.com/motor. © 2003 Microchip Technology Inc. For access to Microchip’s complete motor control design resources. ACIM & SR motors utilizing PIC16.Brushless DC Motor Control Using PIC18Fxx31 Microcontrollers Motor Control from Microchip G G G G Complete solutions for Stepper. This includes the microcontroller with firmware to drive the motor. faster time-to-market.com/motor Brushless DC Motor Control Using PIC18Fxx31 Microcontrollers © 2003 Microchip Technology Incorporated. Microchip provides everything a motor control design engineer needs: low-risk product development. 3 . AC induction motor.

Brushless DC Motor Control Using PIC18Fxx31 Microcontrollers 4 PIC18Fxx31 family of microcontrollers have 4 parts. with 2 Sample and Hold circuits • Simultaneous and sequential conversion capabilities with multiple channel selection • 4 word deep FIFO with flexible interrupt settings Main features of Motion Feedback Modules are: •Multiplexed Input Capture and Quadrature Encoder Interface (QEI) modules •In QEI. Main features of high-speed ADC include: • Up to 9 channels input. All Rights Reserved. B and Index signals interface for measuring.Brushless DC Motor Control Using PIC18Fxx31 Microcontrollers PIC18Fxx31 overview © 2003 Microchip Technology Incorporated. having 28-pin and 40-pin packages with 8Kbytes and 16Kbytes of program memory. A. High-speed Analog-to-Digital Converter and Motion Feedback module. The main features of PCPWM include: • Up to 8 channels output with independent or 4 pairs complimentary outputs • Up to 14 bits PWM of resolution • Center aligned or edge aligned PWM operation. Also known as symmetrical PWM or asymmetrical PWM operation • Programmable dead band control for complementary outputs • Hardware Fault interface pins for fast PWM shut down in the event of fault. These peripherals simplify the motor control algorithm to a great extent. The major peripherals that are useful in motor control are Power Control PWM or PCPWM. © 2003 Microchip Technology Inc. 4 . position velocity and direction of rotation •3 Input Capture pins with multiple modes for pulse width and frequency measurements Interrupt on change feature used for Hall sensor interface.

5 PIC18Fxx31 family of microcontrollers have 4 parts.QEA. All Rights Reserved. Main features of high-speed ADC include: • Up to 9 channels input. 5 © 2003 Microchip Technology Inc. The major peripheral that are useful in motor control are Power Control PWM or PCPWM. B and Index signals interface for measuring. These peripherals simplify the motor control algorithm to a great extent. . Index G Position and velocity measurement modes 3 Input Capture (IC) pins G Pulse width and frequency measurement modes Brushless DC Motor Control Using PIC18Fxx31 Microcontrollers G High-speed ADC G G G Motion feedback module G G © 2003 Microchip Technology Incorporated. Main features of PCPWM include: • Up to 8 channels output with independent or 4 pairs complimentary outputs • Up to 14 bits PWM of resolution • Center aligned or edge aligned PWM operation.Brushless DC Motor Control Using PIC18Fxx31 Microcontrollers PIC18Fxx31 peripherals G Power control PWM G G Up to 8 channels with up to 14-bit resolution Center aligned and edge aligned operations Up to 9 channels with up to 200 Ksps 4 word FIFO buffer with flexible interrupts Quadrature Encoder Interface (QEI) . highspeed Analog-to-Digital Converter and Motion Feedback module. having 28-pin and 40-pin packages with 8Kbytes and 16Kbytes of program memory. A. position velocity and direction of rotation •3 Input Capture pins with multiple modes for pulse width and frequency measurements Interrupt on change feature used for Hall sensor interface. QEB. Also known as symmetrical PWM or asymmetrical PWM operation • Programmable dead band control for complementary outputs • Hardware Fault interface pins for fast PWM shut down in the event of fault. with 2 Sample and Hold circuits • Simultaneous and sequential conversion capabilities with multiple channel selection • 4 word deep FIFO with flexible interrupt settings Main features of Motion Feedback Modules are: • Multiplexed Input Capture and Quadrature Encoder Interface modules •In QEI.

© 2003 Microchip Technology Inc. All Rights Reserved. Normally 3 Hall effect sensors mounted on the stator are used to determine the rotor position. automotive. to run a BLDC motor an electronic drive is required. (3) (6) L2 Phase C L3 Brushless DC Motor Control Using PIC18Fxx31 Microcontrollers 6 A brushless DC motor is a synchronous motor that finds numerous applications in motion control. . automation are few industries to list. These come with different torque and voltage ratings. Appliance. With this combination. industrial automation.H2.Brushless DC Motor Control Using PIC18Fxx31 Microcontrollers Drive topology VDC+ H1 H2 Phase B (5) (2) (1) (4) H3 Phase A L1 VDC© 2003 Microchip Technology Incorporated. The Hall effect sensors give a combination of high and low signals when they pass next to the rotor poles. A BLDC motor has windings on stator and alternate permanent magnets on rotor. In coming slide we will see how these stator windings are energized in synchronous with the Hall sensor inputs. This means. Stator windings A. B and C are connected in star to the inverter. A typical control circuit with 3 phase winding connection is shown in the figure H1. BLDC motors are electronically commutated based on the rotor position with respect to the stator winding. the commutation sequence is determined. aerospace. H3 and L1.L3 make 3 phase voltage source inverter connected across the power supply indicated by VDC+ and VDC-. L2.

This will turn the rotor by 60 degree electrical in the given direction. This will make the Hall sensor to make another transition triggering the next point on the sequence table and so on. motor will run at rated speed. The phase current waveform looks trapezoidal in shape with each phase current having 120 degrees phase shift to each other. If the sequence is followed with rated motor voltage across the motor windings.Brushless DC Motor Control Using PIC18Fxx31 Microcontrollers Switching Sequence Step (1) (2) (3) (4) (5) (6) (1) (2) (3) (4) (5) (6) Hall sensor 101 001 011 010 110 100 101 001 011 010 110 Hall A Phase A Hall B Phase B Hall C Phase C Hall Hall Hall Phase Phase A B A B High switch H3 H1 H1 H2 H2 H3 H31 H10 H1C H2NCH2 Vdc1 Low switch L2 L2 L3 L3 L1 L1 L21 L20 L30 L3 L1 VdcVdc+ 1 0 0 0 1 1 1 0 0 0 1 1 Vdc+ NC VdcVdcNC Vdc+ Vdc+ NC 7 Sequence table example © 2003 Microchip Technology Incorporated. So to complete one rotation on the shaft. The electrical cycle repeats with every rotor pole pairs. © 2003 Microchip Technology Inc. Phase C is connected to positive DC bus and phase B is connected to negative DC bus and phase A is left open. With this every electrical cycle has 6 steps to complete one full cycle. . Every sequence has two windings connected across the power supply and third winding left open. All Rights Reserved. The electrical cycle and shaft rotation have a definite relation. The Hall sensor inputs are at 120 degrees phase shift to each other. by PWMing each switch according to the speed required. Speed can be controlled using PWMs. In order to achieve this switch H3 and L2 should be closed and all other switches should be open. A typical switching sequence is shown on the table here. Phase C Vdc+ NC VdcVdcNC Vdc+ Brushless DC Motor Control Using PIC18Fxx31 Microcontrollers With 3 Hall sensors on the motor. Considering the first step where the Hall sensor input is 101. The energizing sequence will have 6 combinations of turning ON and Off of the 6 switches that we saw in the previous slide. a Hall sensor makes transition either from low to high or from high to low. every 60 degrees of electrical cycle. these 6 steps should be repeated as many times as rotor pole pairs.

position and direction of rotation.Brushless DC Motor Control Using PIC18Fxx31 Microcontrollers Control using Hall Sensors AC in + /MCLR AN0 1 2 3 4 28 27 26 25 RB7/PGD RB6/PGC PWM4 PWM5 PWM3 PWM2 PWM1 PWM0 Vdd Vss RC7/RX/DT RC6/TX/CK RC5/INT2 RC4/INT1 . 8 . Optionally. © 2003 Microchip Technology Inc. Hall sensors are used for commutation. This gives a low resolution speed measurement. Hall sensors can be connected to either Interrupt on change pins that are on port C or they can be connected to Input capture pins on Motion feedback module. All Rights Reserved. For the applications where high resolution of speed measurement is required. Brushless DC Motor Control Using PIC18Fxx31 Microcontrollers 8 This slide shows the hardware interface used for controlling a BLDC motor. Timer5 can be captured on each transition. The input capture module has a mode in which the module generates an interrupt on transition on each pin.DC bus Potentiometer AN1/IC1 AN2/IC2 AN3/IC3 B-Low B-High Y-High Y-Low R-High R-Low Hall sensors Motor current AN4 AVdd AVss OSC1 OSC2 RC0 5 6 7 8 9 10 11 12 13 14 PIC18F2431 24 23 22 21 20 19 18 17 16 15 3 phase Inverter bridge Motor current Motor current /FLTA/CCP2 Reference + /FLTB/CCP1 RC3/INT0 BLDC Motor Hall sensors © 2003 Microchip Technology Incorporated. making it ideal for Hall sensor interface. The QE gives speed. quadrature encoder is used. This Timer5 value can be used for determining the speed at which motor is running.

9 . When the corresponding value in OVDCOND is set to 1. Speed variation is achieved by varying the duty cycle of each PWM.H1 PWM0 . PWM0 to PWM5 control on and off of 6 switches.Brushless DC Motor Control Using PIC18Fxx31 Microcontrollers OVDCOND v/s PWM output Step Hall sensor OVDCOND (1) 101 (2) 001 (3) 011 (4) 010 (5) 110 (6) 100 00100100 00000110 00010010 00011000 00001001 00100001 PWM5 . The PWMs are passed and inhibited according to the sequence discussed earlier.H2 PWM2 . the PWM output becomes active and vise versa. Brushless DC Motor Control Using PIC18Fxx31 Microcontrollers 9 Now let us see how to control the speed using PCPWM module. the active part on duty cycle needs to be increased and to reduce the speed.H3 PWM4 . thus controlling the motor speed. when required as per the sequence.L2 PWM1 . All Rights Reserved. This slide shows the relationship between the OVDCOND register and the PWM output. By doing this the average voltage supplied across the motor winding varies. the active time is reduced. PCPWM module has a feature of over riding the PWM outputs based on the value in OVDCOND register.L1 © 2003 Microchip Technology Incorporated. and inhibit when not required. With this we can efficiently allow the required PWM to appear on the pin.L3 PWM3 . © 2003 Microchip Technology Inc. To increase the speed.

. On every transition on Hall sensor input. new step from the sequence is loaded to the OVDCOND register. based on the Hall sensor states.Brushless DC Motor Control Using PIC18Fxx31 Microcontrollers Control Flow Chart Initialization Load new step sequence Hall sensor change? No Yes to the OVDCOND register from Table Change Speed? No Yes Calculate new PWM duty cycle Key scan/ Other application? Hall A 1 1 1 0 0 0 Hall B 0 0 1 1 1 0 Hall C 1 0 0 0 1 1 Phase A NC Vdc+ Vdc+ NC VdcVdc- Phase B VdcVdcNC Vdc+ Vdc+ NC 10 Phase C Vdc+ NC VdcVdcNC Vdc+ © 2003 Microchip Technology Incorporated. All Rights Reserved. The sequence table dictates the PWM channels that should be in active or inactive states. Brushless DC Motor Control Using PIC18Fxx31 Microcontrollers This shows a simplified control flow chart for BLDC motor control. Any change in the speed command is read either using a potentiometer connected to one of the AD channel or a digital value from another controller calculate a new PWM duty cycle and load to the appropriate registers. © 2003 Microchip Technology Inc.

Brushless DC Motor Control Using PIC18Fxx31 Microcontrollers Control using Quadrature Encoder Potentiometer /MCLR 1 AN0 2 INDX 3 QEA 4 QEB 5 AN4 6 AN5 7 AN6 8 AN7 9 AN8 10 Vdd 11 Vss 12 OSC2 13 OSC1 14 RC0 15 FLTA/CCP2 16 FLTB/CCP1 17 INT0/RC3 18 RD0 19 RD1 20 4 0 RB6/PGC 39 PWM4 B-Low 38 B-High PWM5 37 RB7/PGD AC in + . sensor 35 36 PWM3 PWM2 Y-High Y-Low Motor current Reference + 34 PWM1 R-High R-Low 33 PWM0 32 Vdd 31 Vss 30 RD7 29 RD6 28 RD5 27 RD4 26 RC7/RX/DT 25 RC6/TX/CK 24 RC5/INT2 23 RC4/INT1 22 RD3 INT0 21 RD2 3 phase Inverter bridge Motor current Power factor correction Hall sensors BLDC Motor QE 11 © 2003 Microchip Technology Incorporated. © 2003 Microchip Technology Inc. Hall sensors connected to INT pins. and QE connected to motion feedback module. 11 .DC bus QE interface PIC18F4431 Motor current Temp. position and direction feedback and Hall sensors for commutation can be interfaced as shown here. Brushless DC Motor Control Using PIC18Fxx31 Microcontrollers With QE for speed. All Rights Reserved.

most importantly lowered system cost. Brushless DC Motor Control Using PIC18Fxx31 Microcontrollers Sensorless control of BLDC motor gives many advantages. that opposes the power applied to the phase. All Rights Reserved. sensor PIC18F4431 36 PWM3 35 PWM2 Y-High Y-Low Motor current Reference + RC0 15 FLTA/CCP2 16 FLTB/CCP1 17 INT0/RC3 18 RD0 19 RD1 20 34 PWM1 R-High R-Low 33 PWM0 32 Vdd Vss 31 30 RD7 29 RD6 28 RD5 27 RD4 26 RC7/RX/DT 25 RC6/TX/CK 24 RC5/INT2 23 RC4/INT1 22 RD3 21 RD2 3 phase Inverter bridge BLDC Motor Motor current © 2003 Microchip Technology Incorporated.DC bus Back EMF ZC detect Motor current Temp. Every phase develops a voltage called Back EMF. rotor position can be determined. During the non energized phase of the sequence.Brushless DC Motor Control Using PIC18Fxx31 Microcontrollers Sensorless control Potentiometer /MCLR 1 AN0 2 IC1 3 IC2 4 IC3 5 AN4 6 AN5 7 AN6 8 AN7 9 AN8 10 Vdd Vss OSC2 OSC1 11 12 13 14 4 RB7/PGD 0 RB6/PGC 39 PWM4 B-Low 38 B-High 37 PWM5 AC in + . From the the zero cross over point. this may require additional hardware on the drive side and additional firmware overhead on the microcontroller. 12 Power factor correction Back EMF ZC detect + 12 . this back EMF crosses from positive voltage to negative voltage. This method eliminates the requirement of sensors for commutation. However. © 2003 Microchip Technology Inc. and used for commutation.

© 2003 Microchip Technology Inc. The BEMF generated in the non energized winding is compared with respect to the half of DC bus. All Rights Reserved. . Brushless DC Motor Control Using PIC18Fxx31 Microcontrollers 13 We will see three different methods of determining the Back EMF zero cross point. at low speeds. the BEMF developed is very low in amplitude. This makes it comparatively easy to determine the zero cross point at all measurable speeds. the cross over point may drift away. 1) Comparing WRT center point of DC bus: Every sequence has two windings connected across power supply and third winding left open. which makes it difficult to determine a zero cross over point. If the DC bus voltage is disproportionately high.Brushless DC Motor Control Using PIC18Fxx31 Microcontrollers Sensorless control schemes 1) Compare with DC bus/2 DC+ A + _ + _ Back EMF B DC/2 + _ To IC2 BZ_B To IC1 BZ_A To IC3 BZ_C 2) Compare with virtual neutral DC+ A + _ + _ Back EMF C DCB Virtual Neutral + _ To IC1 BZ_A To IC3 BZ_C DC. making it difficult to determine a workable commutation sequence at all speeds. 3) Using High speed ADCs: The BEMF signals are attenuated and read directly using an on chip ADC on a PIC18Fxx31 can give a great flexibility in determining the zero cross over point.C To IC2 BZ_B AN0 A 3) Using ADC Channels C B Back EMF AN1 AN2 © 2003 Microchip Technology Incorporated. However. when the motor terminal voltage is approximately equal to the DC bus voltage. This gives a fairly good result. 2) Comparing with a virtual neutral: A virtual neutral point can be generated using resistor ladders as shown and the BEMF in the non-energized winding can be compared with this neutral point.

14 . Brushless DC Motor Control Using PIC18Fxx31 Microcontrollers 14 © 2003 Microchip Technology Inc.Brushless DC Motor Control Using PIC18Fxx31 Microcontrollers Summary G G G Overview of motor control solutions from Microchip PIC18Fxx31 peripherals for motor control BLDC motor control using PIC18Fxx31 G G G G Open loop control Closed loop control using Hall sensors Closed loop control using Quadrature encoder Sensorless control © 2003 Microchip Technology Incorporated. All Rights Reserved.

Brushless DC Motor Control Using PIC18Fxx31 Microcontrollers Resources G Application notes: G G G AN885 : Brushless DC motor fundamentals AN899 : Brushless DC motor control using PIC18Fxx31 AN857 : Brushless motor control made easy G Demo and development board G PICDEMTM MC G Completely isolated. All Rights Reserved.com/motor Brushless DC Motor Control Using PIC18Fxx31 Microcontrollers © 2003 Microchip Technology Incorporated.microchip. © 2003 Microchip Technology Inc. 15 . debug tools can be connected when the board is “live” G Low cost design G Web design center: www. 15 These are additional resources for more information on Microchip’s Motor Control solutions.

Sign up to vote on this title
UsefulNot useful