Implementing Embedded Speed Control for Brushless DC Motors: Part 3
To summarize, Hall sensors are an integral part of 120-degree, six-step trapezoidal control. These sensors are used to detect rotor position and to make appropriate state changes (known as the commutation sequence). Using position and timing information, we can measure speed and implement appropriate control. Thus, Hall sensors provide all of the necessary feedback information for the rotor.
This method of control has several advantages. It is easy to use, the required code is simple, and switching is straightforward. The switching has built-in dead time and does not require a special timer. Commutation or switching can be directly connected to the Hall signals for simplicity. Moreover, this method implements effective speed control.
However, Hall-sensor based control does have its disadvantages. Hall sensors increase the cost of the motor and require that five more wires be connected. Also, the sensors add another source of EMI to the motor. Their behavior is noisy, too. They are susceptible to corrosion and are usually the first component in the system to fail. If the motor is a hermetically sealed system, Hall sensors will require extra seals.
As shown in Figure 21, below, using an R8C/13 series MCU, the 120-degree Hall-sensor control method incorporates a Timer C, which performs the modulation function at 20 kHz frequency. The R8C MCU has an internal structure that allows firmware to multiplex on the output pins as necessary to generate modulation. Firmware can connect the timer C output directly to a pin, or it can disconnect timer C from that pin and set the pin's state to either high or low. That is, the firmware can change the output to high, low, or modulation.
|Figure 21. R8C/13 based system configuration for six step control of a BLDC motor.|
Looking at Figure 21 above, notice that firmware also can connect the upper three pins, the lower three pins, or one pin at a time. Six outputs are directed to the integrated power module (IPM), which in turn connects to the three phases of the motor. Three Hall signals are received on three interrupt pins—INT1, INT0, and KI3—on the rising or falling edges.
Timer X, used as the speed measurement counter, measures time between two consecutive Hall signals and provides CountMeas for the speed-control loop. The INT3 pin is used as an emergency-shut-down interrupt when a high-current or a high-temperature alarm signal is received from the IPM.
The R8C MCU has eight ADCs that can be used to implement tasks such as measuring temperature, bus voltage, pressure, and current. Current measurement is particularly important, because measuring average current through several electrical cycles lets us compute torque and speed fairly accurately.
By combining speed measurement and current measurement, firmware can determine the point on the torque speed curve at which the motor is operating. Since the R8C MCU has several GPIO pins, the firmware can use an LED on/off scheme to alert us to the internal state of the algorithm and the performance of the motor.
Because the 16-bit R8C MCU runs at a 20 MHz CPU frequency and includes on-chip flash and SRAM, designers can use this device to create single-chip solutions. The MCU's peripherals include eight channels of ADC, three 8-bit timers with pre-scalars, and a flexible 16-bit input-capture and output-compare timer that can generate up to six PWM outputs.
The device also has a watchdog timer with ring oscillator, two serial interfaces, a power-on reset function, a low-voltage detect function (generally known as brown-out detect), and an internal clock-generation circuit. Additionally, the MCU has up to 22 I/O pins and 8, 12, or 16KB of flash plus 512 bytes, 768 bytes, or 1KB of on-chip RAM.
Data flash is an especially important feature of the MCUs in the R8C/13 family. The two extra 2KB blocks of data flash have high-endurance write/erase capability and can eliminate the need for external EEPROM for a true single-chip solution. An R8C-based BLDC motor control power board is shown in Figure 22 below with motor interfaces and IPM placement.
|Figure 22. R8C MCU and integrated power module based motor control reference platform.|
Sensorless BLDC control
As noted earlier, a significant disadvantage of Hall sensors is their cost. One way to reduce the overall cost of the motor is to eliminate them.
The 120-degree modulation, six-step method of control does allow the use of back-EMF signals to detect the rotor position. Recall that only two of the power switches are turned on at each state change; one is left off. In fact, one entire set of up-and-down switches is not powered on. This is best understood by looking at the Up and Un sequence shown in Table 1 and also looking at Figure 23, below.
First the Up switch is turned on for 120 degrees of rotation. Then for 60 degrees there is no power in the U phase. The Un switch is turned on for the next 120 degrees and again, there is no power for next 60 degrees. Thus, every 120 degrees there is a time period of 60 degrees during which we can observe the back-EMF generated by the rotating magnet.
When Up is energized, current is high in the U coil. When Un is energized, current is low in the U coil. At this point the current changes direction from positive to negative, thus creating a zero crossing. Detecting a zero crossing is equivalent to detecting the rotor position. However, instead of detecting 60 degrees, 90 degrees are detected.
Thus, we can use zero-cross detection to identify the rotor position and then wait until the proper angle is reached to change the state. For example, when a zero crossing is detected at 90 degrees, the firmware can wait another 30 degrees of rotation to perform a state change. The speed-control algorithm remains the same, but a wait period has been added.
|Figure 23. BLDC motor control without position sensor.|
Now let's compare the Hall-sensor based algorithm to the back-EMF based algorithm. Both methods use the 120-degree six-step method and perform a state change every 60 degrees. Both methods use the same trapezoidal technique to control speed. The difference between two methods lies in which signal is used for commutation.
The sensor-based method uses the Hall signal for commutation. As soon as the signal arrives, the state must be changed. The back-EMF method detects a zero crossing, waits for another 30 degrees of rotation, and then makes the state change. Again, in both methods, the speed-control algorithm and pattern recognition technique are the same.
|Figure 24. Back EMF detection for symmetric modulation of power switches.|
Since both methods use the same type of modulation and the same sequence for energizing phases, both have torque ripple, low efficiency, and high noise. Noise is particularly noticeable when a low carrier frequency is used. The response for speed control is acceptable when the sensor-based algorithm is used, but it is slow for the sensorless algorithm and in some cases inadequate.
Further, there are issues with zero-crossing detection. Zero crossing happens in between modulations, when a particular phase is not energized. As Figure 24, above shows, the MCU output is modulating each switch 60 degrees. Output for the inverter shows modulation from rail to rail on the voltage. When this voltage is compared to 1/2 Vcc, the zero crossing becomes visible and then is detected by the interrupt.
Proper implementation with comparators using an R8C/1A MCU is shown in Figure 25, below. Back-EMF is detected from the phase voltage, which is high. Thus, a resistor ladder is used to scale down the input into the MCU. Comparators are used to input high or low voltages in interrupt pins as they did in the Hall-sensor example.
In this case, when the interrupt is received, the timer X is read and its count is divided by 2. A second counter is then started that will be reset when it reaches one half the timer X count. When that reset occurs, the state change is made.
The example shown here uses Timer Y for this purpose. This construct is required because the state change must be delayed for a 30-degree rotation period. Since we have measured the 60-degree rotation time, it's easy to calculate the 30-degree period. Note that because this R8C MCU uses comparators instead of an ADC, it is an extremely cost-effective solution.
|Figure 25. R8C/1A based sensorless implementation with Back EMF detection.|
There is little difference between sensor and sensorless control in terms of MCU processing. The pattern calculation and speed processing are essentially the same. See Figure 26, below. When output stage calculations are done with zero-crossing detection rather than Hall sensors, however, one more timer is required to accommodate the waiting period. This may also change the input masks, which are similar to those used for the Hall 120-degree and 60-degree control methods.
Calculations for duty cycle and the bus voltage measurement and corrections are unchanged. Experience shows that proper signal conditioning is required for signals going into the comparators. Otherwise, errors can occur in detecting zero crossings, resulting in poor speed control and high torque ripple.
|Figure 26. Control flow for sensorless (Back EMF detection) implementation.<.b>|
Like the Hall-sensor method, the back-EMF based sensorless control approach has advantages and disadvantages. Back-EMF methods eliminate Hall sensors and thus reduce implementation costs. The motor is cheaper to build. However, the cost of new sensors is coming down and decreasing the economic advantage of sensorless motor controllers.
Furthermore, sensorless control has various implementation issues. The process of detecting zero crossings introduces extra noise and may cause poor state changes. Sensorless control methods also introduce more torque ripple. Worse, the speed control performance achieved is not acceptable in some applications.
|Figure 27. Aligning the rotor using Vp, Wn, Un coils.|
It's important to note that before a BLDC motor is commanded to attain a certain speed, its rotor must be aligned properly for smooth operation. This alignment can be done in various ways. One of the simplest is to command the Vp, Un, and Wn for a certain time period, giving a predetermined number of pulses to the rotor.
This procedure aligns the south pole of the rotor with the Vp coil,
as shown in Figure 27, above,
which shows a motor that has one pole pair. After the rotor is aligned,
it will rotate with a fairly predictable amount of torque, starting
with step 1 for a smooth start. The benefit here is that when the rotor
is aligned properly, the motor will consume significantly less current
during start-up than it would if the rotor had not been aligned.
To read Part 2, go to Brushless motor control using Hall sensor signal processing
Next in Part 4: 180 degree modulation in motor control
Yashvant Jani is director of application engineering for the system LSI business unit at Renesas Technology America.References
1. Power Electronics and Variable Frequency Drives Technology and Applications, Edited by Bimal K. Bose, IEEE Press, ISBN 0-7803-1084-5, 1997
2. Motor Control Electronics Handbook, By Richard Valentine, McGraw-Hill, ISBN 0-07-066810-8, 1998
3. FIRST Course On Power Electronics and Drives, By Ned Mohan, MNPERE, ISBN 0-9715292-2-1, 2003
4. Electric Drives, By Ned Mohan, MNPERE, ISBN 0-9715292-5-6, 2003
5. Advanced Electric Drives, Analysis, Control and Modeling using Simulink, By Ned Mohan, MNPERE, ISBN 0-9715292-0-5, 2001
6. DC Motors Speed Controls Servo Systems including Optical Encoders, The Electro-craft Engineering Handbook by Reliance Motion Control, Inc.
7. Modern Control System Theory and Application, By Stanley M. Shinners, Addison-Wesley, ISBN 0-201-07494-X, 1978
8. The Industrial Electronics Handbook, Editor-in-Chief J. David Irwin, CRC Press and IEEE Press, ISBN 0-8493-8343-9, 1997
This article is excerpted from a paper of the same name presented at the Embedded Systems Conference Boston 2006.
Currently no items