Dec 03, 2018 Leave a message

DC motor PWM control technology based on 80C196KC and L298N

DC motor PWM control technology based on 80C196KC and L298N

DC motors are widely used in various fields due to their excellent speed regulation performance, large starting torque and strong overload capability. In recent years, the structure and control methods of DC motors have undergone great changes. With the computer entering the control field and the emergence of new power electronic power components, PWM (pulsewidthmodulaTIon) speed regulation has become a new way of DC motor speed regulation. And because of the high switching frequency, stable operation at low speed, excellent dynamic performance, high efficiency, etc., it is widely used in DC motor speed regulation.

2, based on the working principle of PWM speed control system

PWM or pulse width modulation refers to the use of the switching characteristics of high-power transistors to modulate a fixed voltage DC power supply, turn on and off at a fixed frequency, and change the length of the on and off times in a cycle as needed. The speed of the motor is controlled by changing the duty cycle of the voltage on the armature of the DC servo motor to change the magnitude of the average voltage. Therefore, it is often referred to as a switch drive device.

Changing the duty cycle usually has two modes: PWM and PFM (pulsefrequencymodulaion). PWM is by changing the on-pulse width, which is known as the fixed-frequency adjustment. PFM is a constant on-pulse width. The duty cycle is changed by changing the switching frequency. Since the mechanical resonance at a particular frequency often causes vibration and howling of the system, PWM is used in the control of the DC motor. The control method is mainly.

3. Hardware design of control system based on 80C196KC and L298N

The DC motor speed control system based on 80C196KC and L298N consists of the MCU minimum system, R/D converter, PWM power amplifier circuit, A/D and D/A conversion circuit, and receiving command interface circuit. The minimum system of the single-chip microcomputer adopts the 16-bit single-chip 80C196KC external expansion interface circuit, which is mainly used to realize the functions of data acquisition, PWM signal generation, etc.

3.1. Introduction to Power Integrated Circuit L298N

In order to improve system efficiency and reduce power consumption, the power amplifier driving circuit uses an integrated circuit L298N based on a bipolar H-bridge pulse width modulation method. L298N is a high-performance pulse width modulation power amplifier produced by SGS, which has the characteristics of small size and strong driving capability. It contains two H-bridge high-voltage and high-current bridge drivers. It can drive the whole bridge of the motor in a single chip and can drive motors up to 46V and below 2A.

3.2, DC motor control system hardware circuit

L298N can drive two DC motors. Because the speed control system is single-axis structure, in order to make full use of the load capacity of the power amplifier circuit, the system can start with maximum acceleration and brake with maximum acceleration. The output is used in parallel with the control DC motor. As shown in Figure 4, the input terminals IN1 and IN3 are connected in parallel, IN2 and IN4 are connected in parallel, the output terminals OUT1 and OUT3 are connected in parallel, and OUT2 and OUT4 are connected in parallel to the two ends of the motor respectively. The enable terminal is controlled by the high-speed output port HSO1 of the single chip microcomputer.

The single chip microcomputer 80C196KC gives the PWM signal according to the position loop and the speed loop operation result. The PWM signal is directly output to the IN1 (IN3) terminal, and one channel is inverted to the IN2 (IN4) through the 7406. When the duty ratio of the PWM analog signal is 50%. The positive and negative voltages at both ends of the motor are added for the same time. The motor is in a state of micro-shake at this position, that is, in the "power lubrication" state. When the duty ratio is greater than 50%, the signal voltage OUTA is greater than OUTB, and the motor is rotating forward, otherwise Reverse. Therefore, it is necessary to straighten out the output polarity of each link in order to form negative feedback and complete closed-loop control. By changing the PWM duty cycle to control the motor speed, the motor steering can also be changed, and the control method is simple and reliable. In addition, because the motor is of the electric coil type, the back electromotive force is formed when the motor suddenly stops and suddenly reverses. To ensure the normal operation of the L298N driver chip, two pairs of continuation between the output terminals OUTA, OUTB and the DC motor are added. The flow diode shunts the current to the positive or ground of the power supply to prevent the back electromotive force from damaging the L298N.

3.3, anti-interference and electromagnetic compatibility design

When the motor is driven, the rapid switching of the power main switching element causes a large rate of change of the power current and voltage, which not only affects the driving circuit but also enters the control circuit through the power source and the ground. In addition, when the motor starts braking, a transient voltage is generated at a sudden change in load, and its amplitude is also higher than the power supply voltage, and the front edge is steep and the frequency band is wide, and the control circuit is input via the DC power source. Therefore, anti-jamming and electromagnetic compatibility design is also crucial. The system adopts measures such as current flat wave, deburring, and shielding.

Current flat wave: Since the instantaneous energy of the PWM switch is relatively large, the RC filter is used for filtering at the output end of the PWM power amplifier. By selecting appropriate resistance and capacitance values, the high frequency harmonics are effectively suppressed, and the peak voltage of the PWM power amplifier is absorbed. Reduced interference;

Deburring: The system increases the filter capacitor at the power supply end. The large and small capacitors are used in parallel. The large capacitor shoulders the decoupling, filtering and smoothing of the low frequency alternating signal. The small capacitor eliminates the medium and high frequency parasitics in the circuit network. Coupling, effectively reducing spike burrs;

Shielding: The motor drive cable is double shielded and the wires are separated from other cables as much as possible.

4, control system software implementation

The control system adopts the combination of speed and position closed loop, and the position control method is taken as an example to introduce the software implementation method. The position control is based on the classical PI control algorithm, the proportional and integral parameters are simplified, and the segmentation PI control is introduced. That is, the calculated error is segmented, and the adjustment is performed by different proportional and integral parameters within each error range. Ensure that the system runs more smoothly and stably.

The specific software implementation flow chart is shown in Figure 5, that is, after receiving the given angle command, first calculate the sampled position information and the given angle difference, and then divide the difference into n equal parts, corresponding to a set of parameters in each segment. Kp1 and ki1 participate in the mediation control, calculate the output of the PI control and then convert it into the corresponding PWM value output.

5, the conclusion

Based on the DC motor PWM control system of 80C196KC and L298N, the PWM signal is generated by the single-chip microcomputer to the power integrated circuit L298N. The classical PI segmentation control is used to realize the control of the motor. It has the characteristics of simple circuit and convenient control. The running test results show that the system works stably and reliably, meets the requirements of speed regulation function, and has been successfully applied in multiple airborne products.



Send Inquiry

whatsapp

teams

E-mail

Inquiry