
R8C/25 Group
Six Step Trapezoidal Control of a BLDC Motor Using Back-EMF
Introduction
This document describes a method of commutating a 3-Phase Brushless DC (BLDC) motor using Back-EMF (BEMF)
signals.
This document is intended to supplement the understanding of 6-step BLDC motor control using BEMF detection as
one of many possible methods of commutation. The BEMF-detection method, as well as the Hall device method, are
implemented on the Renesas YMCRPR8C25 Motor Control Evaluation kit, which provides an excellent platform for
developing the algorithm for individual applications.
The reader should already have some understanding of six-step commutation methods, such as Hall commutation, to
provide background to the techniques described here. The reader is encouraged to first read the 6-Step Motor Drive
with HALL sensor Application Note referred to in the Reference section at the end of this document.
Target Devices
R8C/24 and R8C/25
Contents
1.Motor Back-EMF Signal Characteristics (2)
2.Detecting Back-EMF Signals for Commutation (3)
3.Driving BLDC Motor for Back-EMF Commutation (5)
4.Open-Loop Alignment and Rotation Starting (6)
5.How to deal with Inductive Effects (7)
6.Summary (8)
7.Reference (9)1. Motor Back-EMF Signal Characteristics
A 3-phase Permanent Magnet Brushless DC (PM-BLDC) motor generates 3-phase AC voltages (shown in Figure 1) called a Back Electro-Motive Force (also Back-EMF or BEMF) as it rotates. The amplitude and frequency of the generated voltage are proportional to the rotational speed. If the motor has a single pole pair on the rotor (one North and one South pole) then the Frequency of the BEMF voltage will be the same as the rotational speed of the rotor. If, however, it has multiple magnetic poles (as motors often do), then the frequency will be will be higher, in proportion to the number of pole pairs on the rotor. The voltage generated will be determined by the number of turns in the windings and the strength of the rotor magnet. There will be a relationship then that can be established with the motor where it will generate a particular AC voltage when it is spinning at a particular speed. This value can be expressed as a constant Ke, it equals the volts generated at some RPM, usually 1000 RPM. Motor manufacturers usually provide the value of this constant.
Figure 1 Voltage and frequency measured externally at rotating BLDC motor
In most BLDC motors, we normally only have access to the three windings, not to the center tap (neutral), so the voltages have to be seen between two phases where it is the difference of the voltages between those windings. If one voltage is near maximum, and the other is near minimum, then the voltage seen between them will be larger than if the two phases were both positive or were both negative, relative to the neutral. For the purpose of commutation with the BEMF signals, we want to know when a phase voltage crosses zero with respect to the neutral. As it happens, when one phase is crossing neutral, the other two phases are at equal and opposite voltages, so we can detect a zero crossing of one phase when its measured voltage is exactly between the other two. For purposes of this document, we will assume that BLDC motors are always constructed symmetrically, with similar BEMF, resistance and inductance in all three phases.
Figure 2 Rotating vector representation of motor phases
2. Detecting Back-EMF Signals for Commutation
The voltage present on the motor phases is a combination of those generated internally and of those being driven externally by our transistors with PWM voltages. So, detecting BEMF on an undriven motor is easy, but not so when we are also trying to force current into the windings to generate torque and cause it to spin. The internal voltages are due to the BEMF and to affects from the resistance and inductance of the motor which are functions of the current flowing in the windings. The PWM voltages that we use to drive the motor windings externally will likely be much higher than the BEMF voltages we are trying to detect. Despite this, we need some way of seeing the BEMF voltage near the time when the phase crosses zero, so we can decide when to commutate. In order to get a clean representation of the BEMF voltage, it is necessary to filter the high frequency PWM signals from the motor phase voltage, leaving only the lower frequency BEMF signal. After that, we can also deal with the voltages due to the resistive and inductive effects.
For example, if we use a common PWM carrier frequency of 12 kHz, the BEMF frequency will likely be much lower, around a few hundred Hz. The exact value of the BEMF frequency can be found as BEMF_Hz = RPM x (1 min/60 sec) x Number_of_Pole_Pairs. So, for a motor with 5 pole pairs, running at 3000 RPM, the BEMF frequency is 250 Hz. The difference between 12 kHz and 250 Hz allows us some room to create a low-pass filter that will pass the BEMF component, while attenuating the PWM component.
Figure 3 Raw and filtered motor voltage
Assuming the bus voltage is higher than the logic-level voltages, then the motor voltage should be also divided down to scale it to those that can be observed by the comparator logic. The circuits used to scale down and filter the motor phases voltages are shown below in Figure 4. The U, V and W are the motor lines, with PWM and BEMF components
up to 50V (divided by a factor of 10) and the V_U, V_V and V_W lines are the scaled and filtered BEMF signals which are fed into comparators.
V Figure 4 Filtering and Scaling of phase voltages to match the logic levels
Once we have the BEMF voltages filtered and scaled, we compare it with a reference point, derived from the bus voltage. We do this because the motor phases are modulated from the bus, and if the bus voltage varies by any amount, the reference and phase voltage will remain proportional. One difference from the motor filter and divider is that the bus reference is scaled at half the value. In this way, the bus reference will always be at a point where we can detect when the phase voltage is above or below the 50% value, which we will see, is a convenient way for detecting the zero crossing in the BEMF voltages.
Figure 5 Simplified BEMF comparator signals
The next step is to modulate the motor in such a way as to keep the motor neutral very close to half the bus voltage so that when a phase does a zero crossing, it can be detected by the comparator at the half-bus reference point.
W U
90.9k 0.015uF 10k 90. 9 k 0. 015uF 10 k
90. 9k
0 . 015 u F 10k V_U
V_V V_W
For complementary PWM, each comparator register in the PWM timer produces two PWM outputs, not just one. The two complementary signals are used in one phase of the three phase PWM, so there are a total of three comparator registers and six PWM outputs or three pairs. One of each pair is designated as the upper transistor driver, and the other is the lower. We use the convention that as the PWM compare value increases, the upper transistor duty for that phase becomes larger, and the lower duty becomes smaller. The two signals are complementary in that they are the logical inversion, or complement, of the other, so that the two signals are not active at the same time. In reality, the TimerRD also allows “deadtime” settings, which introduces a period of time when both pulses are inactive, to allow for switching time in the transistors. See the R8C/25 hardware manual for more detail on TimerRD used in Complementary PWM mode.
As mentioned above, we need to apply voltages which are centered about the middle of the bus in order to allow zero-crossings to be detected at the half-bus reference. We can do this type of voltage driving to the motor phases using voltages symmetric about the half-bus level. We use complementary PWM and a reference level of 50% PWM duty for both the higher and lower side voltages on two of the phases.
We set up the PWM output near a value of 50% for both driven phases, but increase one phase duty by some amount and lower the other phase the same amount. For example, if we drive phase U to 60% duty, then we can drive phase V at 40% duty, the difference is 20%, as will be seen by the motor phases, and the middle of the two will still be 50%, where we are detecting the zero-crossing on phase W. A look at the voltage present at phase W will still have the PWM components of the other two phases, but once filtered, the PWM components of phases U and V will be removed, leaving the correct representation of the phase W voltage. When the phase W signal crosses the middle of the bus, it is also the same angle where phase U and V are equal and opposite and also balanced around the middle of the bus, so our assumption of symmetry allows us to detect that phase W has crossed zero without measuring the neutral point directly. Voltage drops caused by the resistance in the other phases are cancelled, since the current through the other phases must also be equal.
In the software, this method of symmetrical modulation is easy to implement. For any given duty desired, we normalize it to the range of 50% duty, then add or subtract that value from a set value of 50% for two of the phases. So, if we have 1024 counts of PWM total (meaning that a value of 1024 will give us 100% duty PWM on the upper channel and 0% on the lower), then 50% (for both upper and lower, in complement) will be a timer compare value 512. For a motor needing apparent 50% duty, we actually add 25% to 50% for one phase and subtract 25% from 50% for the other, creating a total of 50%, but each only 25% offset from the 50% reference. We can now guarantee that the motor neutral will be very near the center of the bus when the undriven phase crosses zero on its BEMF output.
Of course, only two of the phases are being driven at one time, the floating phase is the one being observed for BEMF crossing. Once a decision is made to commutate and switch the transistors, the floating phase should be the one next approaching the zero crossing. We use the data from the present commutation state (or Step), along with the zero crossing detection to continue moving the motor to the next Step, and so on.
Since the BEMF detection is done by observing the phase voltage, which is a function of speed and of the driving voltage of our PWM, it is necessary to get the motor running at some speed before the BEMF voltage is large enough to be detected. So, for starting the motor from full stop, where no BEMF voltage exists, we have to force the motor to spin first before we can use BEMF detection to continue the commutation. For that, we use open-loop alignment and start-up techniques.
4. Open-Loop Alignment and Rotation Starting
The method of commutating by detecting BEMF voltages requires that the motor is already spinning and generating a reasonable amplitude BEMF signal before commutation can be done.
To make that happen, we first force the rotor into a known position in an alignment process. This can be done by setting the voltage on Phase U higher than V and W. That is done by setting PWM counts for U higher and the counts in V and W smaller. Though alignment can be done with only two phases, by applying the same voltage to two of the phases produces a natural damping effect to help the motor settle more quickly into the alignment position.
Figure 7 Concept of alignment current
We slowly increase this voltage (that is, the PWM duty), to not impart an impulse to the motor, which may cause it to oscillate. We do this process for up to several seconds, to allow the rotor to align with the currents, and to allow any spontaneous rotational oscillation to dampen out. Small motors with low inertia may align in less than a second, while large inertia loads require more time.
Once we are sure the motor is in a known alignment state, we begin sending a slowly accelerating stepped current into the motor phases to get the motor to spin in the desired direction. We commutate as in Figure 6 above, increasing and cycling through the Step count as we go. The initial duty cycle is selected to overcome the frictional forces and inertia of the motor. We increase the voltage sent to the phases as well as increase the step rate to force the motor to turn and accelerate, overcoming the motor friction, inertia and the increasing back-EMF. Because there is no commutation feedback during this stage to keep the currents aligned with the rotor, the open-loop currents must be larger than normal to maintain the torque. It is important, therefore, to set the alignment voltage and time, as well as the ramp rate and voltage to match the motor and load to ensure a reliable start.
The software should increase the open-loop commutation switch rate until such time that the BEMF is large enough to generate reliable signals into the comparators. That rotational speed can be found by examining the BEMF signals during hall commutation (if available) or empirically by selecting arbitrary speeds and checking results. Once the motor has accelerated in the open-loop to our switch point, it is just a matter of changing over to the BEMF modulation method, where the comparator output state determines the motor phase drive. Once BEMF commutation kicks in, the motor current can be reduced since the voltage fed will now align with the motor BEMF signal, increasing the torque. It is now possible to increase the ramp of applied voltage and accelerate the motor at a higher rate to the speed desired. Figure 8 shows a waveform of this as the motor begins with alignment current, accelerates with open-loop current, then when switched to BEMF commutation, the current required goes down significantly.
Figure 8 Speed and current waveforms
5. How to deal with Inductive Effects
Commutating a BLDC motor (where the windings always have some inductance) means that there will be inductive effects from changes in current on the voltage waveforms. The nature of inductance is to resist changes in current, and larger changes in current require large voltage to be applied. Likewise, when current is forced to change during the switching action of the transistors, large voltages can occur spontaneously in the windings, often called “inductive kick”. When a phase is switched to float, the remaining current will decay, during which time the inductive kick will force the voltage of a floating phase to discharge to one of the power rails (through diodes parallel with the transistors). The length of time that this current discharge happens is proportional to the amount of current to be dissipated, and inversely to the difference in voltage between the phase BEMF and the power rail.
Under low current conditions, the voltage pulse generated by the inductive kick is short in duration. Under larger current, as when the motor load is larger, the time for the voltage to decay is longer. It is important to note that this time must not be so long as to prevent the detection of the normal zero-crossing of the undriven phase, or BEMF commutation is not possible. Assuming the current discharge time is short enough, then a masking interval can be used to ignore the pulse at the output of the comparator. Selecting the right masking time is critical since if masking time istoo short, invalid commutation signals will cause currents to be switched to the wrong phase and decrease motor efficiency. If the masking time is too long, the commutation rate is limited therefore the motor speed will be limited. We use a timer in the software to mask the voltage pulses. This count is defined in software as a count on the PWM timer and can be changed for different motors and load conditions. Once the masking time interval has passed, we begin looking at the comparator output for a change which would indicate a valid change in step. Once that is detected, we begin the timer again to mask the next voltage pulse for the same period of time.
Figure 9 Filtered Back EMF and comparator output
Figure 9 shows a graph showing the comparator output, including the voltage pulse to be masked. The blue trace (bottom) is the filtered BEMF, and the red trace (top) is the comparator output with extra edges. The first edge is the valid one, the next two or three quickly following are the invalid edges, caused by the inductive pulse.
If we imagine the same comparator signals, but without the extra edges caused by the inductance, then what we find is that the three comparator signals are nearly identical to what we would expect from Hall device signals. So, we can use the comparator signals in much the same way we would with Hall signals, and use their state to determine the commutation state. This is exactly what we do in the sample motor code supplied with the YMCRPR8C25 kit. The BEMF code uses the three comparator edges, filters out the unwanted edges, and uses their state in a lookup table to decide which transistors are switched to high, low, or float.
6. Summary
In this application note we described a method of commutating a 3-Phase Brushless DC (BLDC) motor using Back-EMF (BEMF) signals. The Renesas YMCRPR8C25 Motor Control kit is an excellent vehicle for evaluating BEMF control using the R8C/Tiny Microcontroller devices. Offering a rich set of Motor Control peripherals, the R8C25 series is specifically suited for 3-phase motor control, including the BEMF method described here, as well as Hall-based commutation and AC Induction motor control.7. Reference
YMCRPR8C25 Kit
User Manual
Application Notes
REU05B0074-0100/Rev 1.00 Six-Step Trapezoidal Control of a BLDC Motor Using Hall Sensors REJ05B0845-0100/Rev.1.00 Timer RD in Complementary PWM Mode
REJ05B0486-0100Z/Rev.1.00 Solutions for Three-Phase Motor Control Programming Hardware Manual
R8C/24 Group, R8C/25 Group Hardware Manual Rev. 1.0
YMCRPR8C25 Motor Control Demo Kit
(Use the latest version on the home page: http://www.renesas.com)
Website and Support
Renesas Technology Website
http://www.renesas.com/
Technical Contact Details:
csc@renesas.com
Global:
Inquiries
http://www.renesas.com/inquiry
Revision Record
Description
Rev. Date Page Summary
1.00 Feb.05.08 — First edition issued
changed
1.01 Feb.0
2.09 10 Disclaimer
© 2008. Renesas Technology Corp., All rights reserved.
