Research on a DSP-based speed control system for permanent magnet brushless DC motors
2026-04-06 07:22:37··#1
Abstract: This paper first designs a DSP-based brushless DC motor speed control system. Secondly, it designs a fully digital dual-closed-loop speed control system for the brushless DC motor. Finally, addressing various errors in the actual system, it proposes a method combining advanced fuzzy control strategies with traditional PID control, which can further improve the dynamic performance and steady-state accuracy of the system. Simulations were performed using Matlab/Simulink software. 1 Introduction With the development of computer and microelectronics technology and the continuous emergence of new power electronic devices, the control strategies for electric motors have undergone profound changes. Traditional analog control methods have gradually been replaced by digital control methods based on microcontrollers. This paper introduces the fuzzy control simulation research of a DSP-based permanent magnet brushless DC motor servo system. 2 Hardware System Design In this system, a fully digital dual-closed-loop control of a permanent magnet brushless DC motor is implemented using a DSP. A deviation is formed between the given speed and the speed feedback quantity. After speed adjustment, a current reference quantity is generated. The deviation between this current reference quantity and the current feedback quantity is adjusted by the current to form the control quantity of the PWM duty cycle, thereby realizing the speed control of the motor. Current feedback is achieved by detecting the voltage drop across resistor R. Speed feedback is calculated from the position output of the Hall position sensor, which is also used for commutation control. The system's block diagram is shown in Figure 1. Figure 1 System Block Diagram. In this system, the controller is the core component. It not only processes external signals and provides motor drive signals, but more importantly, it implements the overall system control strategy. This system uses the TMS320LF2407A device as the control core, fully utilizing its high-speed signal processing capabilities and optimized peripheral circuitry for motor control. It boasts advantages such as high control accuracy, strong anti-interference ability, and low cost, providing reliable and efficient signal processing and hardware control for high-performance drive control. The DSP-based control system block diagram is shown in Figure 2. Figure 2 DSP-based Control System Block Diagram. 3 Design of a Fully Digital Dual Closed-Loop Speed Control System Figure 3 shows the control and drive circuit for speed regulation of a permanent magnet brushless DC motor implemented using the TMS320LF2407A DSP. Three Hall sensors H1, H2, and H3, spaced 120 degrees apart, are connected to the three capture pins CAP1, CAP2, and CAP3 of the TMS320LF2407A after being shaped and isolated by a shaping circuit. These sensors generate capture interrupts to provide the commutation time and position information. [align=center]Figure 3 DSP Control and Drive Circuit[/align] Since the motor only has two phases energized at a time, one in the forward direction and the other in the reverse direction, forming a loop, only one current needs to be controlled at a time. Using a resistor R as a current sensor, placed at the power supply to ground, current feedback can be easily achieved. The current feedback output is connected to the ADC input terminal ADCIN00 of the TMS320 LF2407A via a filter and amplifier circuit. The current is sampled once in each PWM cycle to control the speed (PWM duty cycle). The TMS320LF2407A is connected to six switching transistors V1 to V6 via PWM1 to PWM6 pins through an inverting drive circuit to achieve fixed-frequency PWM and commutation control. 3.1 Current Detection The current sensor is a crucial component in a servo system. Its accuracy and dynamic performance directly affect the system's low-speed and high-speed performance. Current detection methods include resistance detection and photoelectric detection. This system employs a Hall element method based on the magnetic balance principle to detect current. The device used is a Hall effect magnetic field compensated current sensor. It is internationally recommended as a key current detection device in power electronic circuits. It integrates the concepts of current transformer, magnetic amplifier, Hall element, and electronic circuitry into one unit, providing measurement, feedback, and protection functions. It is essentially an active current transformer. Its advantage is "magnetic field compensation," where the measured primary magnetic field and the measured magnetomotive force in the measuring winding are compensated to zero in real time. This means there is virtually no magnetic flux in the iron core, allowing for a very small size without fear of core saturation or frequency/harmonic interference. The reason the magnetomotive forces are fully compensated is due to the Hall effect. If the two are unbalanced, a Hall electromotive force will be generated on the Hall element. It serves as the input signal for a differential amplifier powered by ±15V. The amplifier's output current is the sensor's measured current, automatically and quickly restoring magnetomotive force balance, meaning the Hall output always remains zero. Thus, the current waveform faithfully reflects the waveform of the measured current on the primary side, only differing in turns ratio. 3.2 Position Detection In this system, the position signal is obtained through three Hall sensors. Each Hall sensor generates an output signal with a 180° pulse width, as shown in Figure 4. The output signals of the three Hall sensors differ by 120° phase. This results in six rising or falling edges in each mechanical rotation, corresponding to six commutation moments. These six moments can be obtained by setting the TMS320LF2407A to dual-edge trigger capture interrupt function. [align=center] Figure 4 Output waveform of Hall sensor[/align] It should be noted that knowing only the commutation moment is insufficient for correct commutation; it is also necessary to know which phase should be commutated. By setting the capture ports CAP1-CAP3 of the TMS320 LF2407A as I/O ports and detecting the level status of these ports, it is possible to determine which Hall sensor's edge triggered the capture interrupt. 3.3 Speed Calculation: The motor speed is calculated by the DSP using the detection signal from the photoelectric encoder. The speed value can be easily calculated based on the A-phase and B-phase signals captured by the DSP's CAP/QEP pins, according to the time values corresponding to the rising and falling edges of any one phase signal. Alternatively, the motor speed value can be obtained by dividing the number of pulses detected within a fixed time period by the fixed time interval. The parameters used for speed calculation and speed adjustment are stored in six units starting from data area 300H, with AR2 serving as the data address pointer. The variables stored in each unit are listed in Table 1. Table 1. Variables stored in the 6 units starting from 300H. 4. Design and System Simulation of Adaptive Fuzzy PID Controller In this design scheme, the idea of PID parameter self-tuning is to first find the fuzzy relationship between the three parameters KP, KI, and KD of the PID controller and the absolute value of the error |E| and the absolute value of the error rate of change |EC|. During operation, by continuously detecting |E| and |EC|, the three parameters are modified online according to the fuzzy control rules to meet the different requirements of different |E| and |EC| on the controller parameters, so that the controlled object has good dynamic and static performance. The block diagram of the adaptive fuzzy PID parameter control system is shown in Figure 5. [align=center] Figure 5 Simulation block diagram of the adaptive fuzzy PID control system[/align] The adaptive fuzzy PID control system shown in Figure 5 is edited in the Simulink environment to obtain the system simulation block diagram shown in Figure 6. During system simulation, after analysis, the transfer function of the controlled object can be obtained as: G(s) = 1/(2s² + 3s + 1). A step signal is applied to the system input, and then the simulation calculation is performed according to the correct Simulink simulation steps, selecting the calculation step size, X/Y axis parameters of the analog oscilloscope, etc. The final step response curve is shown in Figure 7. [align=center] Figure 6 Simulation block diagram of the adaptive fuzzy PID control system Figure 7 System step response curve[/align] 5 Conclusion As can be seen from the simulation curves, the combination of DSP and adaptive fuzzy PID control strategy makes the system's response speed faster, its adjustment accuracy higher, its steady-state performance better, and it has no overshoot or oscillation, exhibiting strong robustness.