Brushless DC Motor Controller Based on a Dedicated Microcontroller
2026-04-06 05:44:13··#1
1. Overview [1,2] The position detection method used in the sensorless brushless DC motor controller is the back EMF third harmonic detection method. It receives two signals: one is the A-wave back EMF zero-crossing signal, and the other is the rotor flux third harmonic zero-crossing signal. These two signals are used to control the permanent magnet synchronous motor to operate in a self-synchronous state. Therefore, this control system differs from the traditional back EMF fundamental wave method (also called the terminal voltage method), which uses three back EMF zero-crossing signals. Because the third harmonic detection method is quite sensitive and does not require a low-pass filter with a large attenuation rate during signal processing, the rotor position can be correctly detected at relatively low speeds. Since the processing of the third harmonic signal can use a 90° integrator circuit that remains stable across the entire frequency range, the detection accuracy is high. This directly results in high motor operating efficiency and large output torque. Therefore, this paper studies a controller suitable for the third harmonic detection method. 2. Component Circuits of the Controller [1-4] The task of the brushless DC motor controller is to complete position closed-loop control, speed closed-loop control, and starting control. The position closed-loop is to make the motor run in a self-synchronizing state, while the speed closed-loop is for speed regulation. Since the third harmonic detection method also cannot detect the position of the motor rotor at zero speed, a relatively complex starting control is also required. 2.1 Implementation of Position Closed- Loop In this controller, the position closed-loop is completed using an interrupt method. The three-phase 6-step corresponding three-phase synchronization signal sequence is pre-programmed in the controller's control program. Each transition of the third harmonic triggers an interrupt, and the controller outputs the next synchronization signal sequence. Each rising edge of the back EMF triggers an interrupt, causing the controller to point to the first synchronization signal sequence. The implementation of the position closed-loop mainly consists of a decoding circuit and a third harmonic edge pulse generation circuit. The decoder circuit decodes the three-phase synchronization signal output by the microcomputer into the conduction signals of the six power devices of the inverter. Its function is the same as that of the decoder used in the traditional terminal voltage method. The controller studied in this paper is implemented using a GAL16V8 programmable logic device. In brushless motor operation, each transition of the third harmonic position signal corresponds to a commutation moment. Only a rising edge of the external signal can trigger an external interrupt, thus requiring an edge pulse generation circuit to convert both the rising and falling edges of the input third harmonic signal into narrow pulses with rising edges. This can be accomplished using two rising edge monostable multivibrators. The edge pulse generation circuit is shown in Figure 1, where the pulse width is determined by the RC delay network of the monostable multivibrator. This pulse width must not exceed the pulse width of the third harmonic position signal at maximum speed; otherwise, one commutation moment will be missed in each cycle at maximum speed, causing the motor to operate in an unstable state. 2.2 Implementation of Speed Closed-Loop The implementation of the speed closed loop includes speed measurement, control quantity setting, and PWM wave duty cycle adjustment. Because the frequency of the third harmonic position signal is proportional to the motor speed, for a motor with P=2, the third harmonic signal undergoes 12 transitions per rotor revolution. Therefore, the speed can be measured by measuring the third harmonic signal. However, since the third harmonic frequency is relatively low, using frequency measurement to measure speed would result in a large error if the motor speed were to be measured in a short time. Therefore, this controller uses a period measurement method. Because the 80C196KB has a high-speed input port, the moment each transition of the input signal occurs is recorded by the high-speed input port, which greatly facilitates the implementation of the period measurement method. The third harmonic signal is input to the microcontroller through HSI.1. The high-speed input port is set to record each transition, and the FIFO is set to hold register interrupt mode, meaning that one interrupt is triggered for each event. The time difference between two events is calculated in the interrupt handler to calculate the motor speed. The control parameters include the speed setpoint, the starting load setpoint, the forward/reverse switch, and the start/stop switch. The speed setpoint and starting load setpoint can be digitally set using a Philips remote control and an infrared receiver. The infrared receiver's input signal can be connected to the microcontroller's high-speed input port. The FIFO interrupt handler identifies the key value input from the remote control and sets the input value accordingly. Alternatively, a potentiometer can be used to simulate the setpoint, which is then converted into a digital value by the 80C196KB's A/D converter. The forward/reverse switch and start/stop switch only require a standard input signal to the microcontroller via port P1. The controller's main program continuously queries the switch status and processes it accordingly. The 80C196KB includes an 8-bit PWM channel, requiring no further expansion. This PWM channel, with a 12MHz crystal oscillator, can output a PWM frequency of 23.6kHz, exceeding the audio range and preventing system noise. Changing the PWM duty cycle simply requires modifying the PWM duty cycle register, making it highly reliable and convenient. The only drawback is its duty cycle resolution of only 8 bits, or 1/256 (0.39%). For applications requiring high speed control accuracy, a high-resolution PWM wave generator needs to be added. 2.3 Implementation of Startup Control In the control system based on the third harmonic detection method, the three-stage startup method used in the terminal voltage method control system can also be adopted. That is, the entire startup process is divided into three stages: rotor positioning, acceleration, and switching. For the third harmonic detection method using the terminal voltage method, its detection sensitivity is greatly improved. The high sensitivity of the third harmonic detection method eliminates the need for the complex starting process of a motor, unlike the terminal voltage method. Initially, the motor only inputs and outputs a positioning signal for rotor positioning. Then, it outputs the next signal sequence, causing the stator magnetic field to jump forward 60°. During the motor's rotation from the positioning position to the next position, the third harmonic signal is already effective, sending a commutation interrupt to the microcomputer. This causes the armature magnetic field to jump forward another 60°, and the rotor rotates forward under the influence of electromagnetic torque. Upon reaching the commutation position, the rotor position signal detected by the third harmonic sends another commutation interrupt to the microcomputer, causing the armature to jump forward again. This cycle continues, gradually bringing the motor to a stable state. Experiments have proven that this simplified starting method is entirely feasible. 3. Control System Schematic Diagram [4] Due to the powerful functions of the 80C196KB, functions that previously required external hardware expansion circuits, such as phase difference detection circuits, A/D conversion circuits, steering control circuits, and PWM wave generation circuits, can now be accomplished using the hardware devices or control software built into the 80C196KB itself. This greatly simplifies the CPU's peripheral circuits, reduces electromagnetic interference between components, and significantly improves reliability. Based on the functional implementation circuits and implementation methods analyzed above, the control system schematic diagram shown in Figure 2 can be constructed. In this system, the P3 and P4 ports of the 80C196KB are used as the system bus, the P2 port is used as a special function port, the P1 port is used as an I/O port, and the P0 port is used for A/D conversion and input. 4. Implementation of Control Software The main task of the main program is to initialize the values of various variables and flags, set the control words of each CPU device, initialize the state of each port and enable the corresponding interrupts, and adjust the motor speed. Its flow is shown in Figure 3. The HSI FIFO holding register valid interrupt has two main tasks. One is to detect the phase difference between the synchronization signal and the position signal during synchronous machine operation. Once the phase difference meets the specified conditions, it switches to brushless machine operation. The other task is to detect the motor speed using the periodic measurement method after switching to brushless machine operation. 5. Experimental Results This paper conducts a speed negative feedback control experiment on a 250W prototype. Figure 4 shows the steady-state speed of the motor when the load changes from no-load to rated load, with setpoints of 1500 r/min and 2500 r/min. The experimental results show that the system can work reliably. The steady-state error of the motor speed is less than 32 r/min. The main reason for this error is that the PWM generator's duty cycle resolution is only 8 bits. The control system designed in this paper meets the performance requirements if used in applications such as compressor motors. References: [1] JCMoreira. Indirect Sensing for Rotor Flux Position of Permanent Magnet AC Motors Operating Over a Wide Speed Range[J].IEEE Trans.Ind.Appl.,1996,32(6),1394-1401. [2] Vukosavic United States Patent Patent Number[D].4912378,1990. [3] Sun Hanfang. Intel 16-bit Microcontroller [M]. Beijing University of Aeronautics and Astronautics Press,1999. [4] Lu Yunbo. Research on Microcomputer Control System of Brushless DC Motor [D]. Xi'an: Xi'an Jiaotong University,2001