introduction
In the early 1980s, brushless DC motors entered the practical application stage, with square wave and sine wave brushless DC motors being successfully developed. The concept of "brushless DC motor" has evolved from the initial DC motor with electronic commutator to encompass all electronically commutated motors possessing the external characteristics of traditional DC motors. Today, brushless DC motors integrate the motor, speed control mechanism, detection elements, control software, and hardware into a single unit, forming a new generation of electric speed control systems. Brushless DC motors possess superior speed control performance, primarily manifested in: convenient speed adjustment (stepless speed regulation), wide speed range, excellent low-speed performance (high starting torque, low starting current), smooth operation, low noise, and high efficiency. Their applications are extremely wide-ranging, from industrial to civilian use, including electric bicycles, electric cars, elevators, range hoods, soy milk makers, small cleaning machines, CNC machine tools, robots, and more. Due to these advantages, the 2004 International Electrical Engineering Conference proposed that brushed motors would be replaced by brushless motors, indicating a growing trend. The United States, Japan, the United Kingdom, and Germany have already achieved the conversion of brushless DC motors to brushed motors in the field of industrial automation.
DC motors are widely used in production machinery with high speed control requirements due to their advantages such as wide speed range, easy and smooth speed adjustment, large starting, braking and overload torque, ease of control, and high reliability. The most common method for adjusting the speed of a DC motor is to change the voltage at the armature terminals, i.e., adjusting the resistance R to change the terminal voltage and achieve speed regulation. However, because the connected resistor consumes some voltage, this traditional speed control method is very inefficient.
With the development of power electronics technology, many new armature voltage control methods have emerged, among which PWM (Pulse Width Modulation) control is a commonly used speed regulation method. PWM control refers to the technique of regulating the motor speed by adjusting the pulse width by adjusting the switching time while keeping the period T constant. In the pulse width speed regulation system, the voltage across the motor armature is a pulse voltage with adjustable pulse width. When the output pulse frequency is fast enough, due to the existence of inertia, as long as the switching time is changed according to a certain rule, the motor speed can reach and maintain a stable value [2]. For DC motors, the stepless speed regulation system constructed by PWM control technology has no impact on the DC system during start-up and stop, and has the characteristics of low starting power consumption and stable operation. This paper designs a DC motor speed regulation device based on a microcontroller. The AT89C2051 microcontroller, which is relatively inexpensive, is used as the core. Together with the keyboard and motor drive circuits, it forms a speed regulation device to realize the stepless speed regulation of the DC motor.
2. Hardware Design and Implementation
2.1 Basic Hardware Design Scheme
Based on the design requirements of a DC motor speed control device based on the AT89C2051 microcontroller, the AT89C2051 microcontroller is used as the core to generate PWM pulse width signal output, and the peripheral circuits are a power supply circuit, a keyboard, and a motor drive circuit. The system design framework diagram is shown in Figure 1.
Figure 1 System Design Framework Diagram
2.2 Power Supply Section
The power supply section outputs a 5V voltage after being isolated by a 220V-7.5V transformer, rectified by a rectifier bridge, filtered by a filter capacitor, and regulated by a 78M05 three-terminal voltage regulator integrated circuit, which powers the entire device (its Protel schematic is shown in Figure 2).
Figure 2 Power supply circuit diagram
2.3 Motor Drive Section
The PWM pulse width signal is output by the AT89C2051 microcontroller, but since the DC output current of the microcontroller is 25mA[3], it cannot be directly used to drive a small DC motor. The output pulse width signal must be amplified. The pulse width signal of the microcontroller's P3.2 port is sent to the power transistor in TIP127 through R1 to complete the power amplification. The amplified signal can drive the DC motor and make it work. Among them, capacitor C1 is a filter capacitor, which can make the voltage of the input DC motor tend to be smooth, and also has the function of freewheeling after the transistor is turned off. The circuit schematic is shown in Figure 3.
Figure 3 Circuit diagram of the motor drive section
3. Software Design and Implementation
Figure 4 shows the flowchart of a DC motor speed control device based on the AT89C2051. After power-on, initialization is performed first; after initialization, a PWM signal with a duty cycle of 0 is output; then the keyboard scanning program is executed, and the microcontroller will start scanning the keyboard.
Figure 4 Program Flowchart
If the accelerator button is pressed: each time this button is pressed, the duty cycle of the PWM signal increases by 1/50 and then locks the duty cycle.
If the deceleration button is pressed: pressing this button once reduces the duty cycle of the PWM signal by 1/50 and locks the duty cycle.
After the duty cycle increases (decreases), the duty cycle value is judged. If the duty cycle is less than 1 but greater than 0, the PWM signal is output. If the duty cycle is greater than 1, a PWM signal with a duty cycle of 1 (full pass) is output. If the duty cycle is less than 0, a PWM signal with a duty cycle of 0 is output, and an LED is lit as a reminder.
If no key is pressed, the program will jump back to the keyboard scanning program while maintaining the original duty cycle output, and perform keyboard scanning again. The motor speed is determined by the PWM pulse width output by the AT89C2051 microcontroller. In the program, a timer interrupt is used, and the key is used to modify the initial value of the timer, thereby obtaining pulse signal outputs with different duty cycles. The flowchart of the program for modifying the initial value of the timer is shown in Figure 5 (P3.2 port is the PWM pulse output port).
The program uses timer/counter 0 for timing. Under 12MHz crystal oscillator conditions, the specific register settings are as follows:
TMOD=0x01: Select Timer 0 to start automatically, and set its operating mode to Mode 1 (16-bit mode). The value range is 0 to 65535, which corresponds to the duty cycle of 0 to 1. For every 1000 change in value, the high-level time increases by 1ms and the duty cycle increases by 1/50.
EA=1: Enable global interrupt; ET0=1: Enable timer T0 interrupt; TR0=1: Enable timer T0.
Figure 5 Flowchart of the timer initial value modification program
4. Conclusion
This system uses the AT89C2051 microcontroller as its control core and employs PWM (Pulse Width Modulation) to amplify the output PWM signal using a medium-power transistor (TIP127) to drive a 6V, 0.3W miniature DC motor. The design prioritizes hardware simplicity, utilizing a limited number of components to achieve open-loop speed control of the DC motor. The method described in this paper has been applied to a light-load DC motor speed control system, demonstrating stable and reliable operation.
For more information, please visit the Machine Tool Channel.