The structure and control algorithm of the fuzzy control PID algorithm and its application in the control system of the single chip DC motor are described.

Fuzzy control is used to adjust the proportion, integral and differential functions, so that the MCU DC motor control system has the advantages of strong adaptability, short adjusting time and good robustness. In the process of DC motor control, there are often uncertainties and nonlinearities, so it is difficult to establish an accurate mathematical model. It is difficult to achieve ideal control effect by using conventional PID control algorithm. The system design combines with the fuzzy control algorithm, establishes the fuzzy control rules according to the theory of fuzzy control and finds out the fuzzy control table. According to the sampled information of DC motor, the system inquires the fuzzy control table to control the speed and steering of the motor. The system uses STC12C5A60S2 as the main control chip to complete the control of the system’s executive mechanism, information processing and DC motor control. In the application of curtain machine, DC deceleration motor can be accurately controlled, and it can make up for the defect that stepping motor can not rotate without electricity. The DC motor is driven by L298N, and the speed and direction of the motor can be adjusted by PWM modulation and enabling transformation. Control the curtain opening and closing process at the same time to detect the status of photoelectric switch to determine the current curtain/window state. By sampling and analyzing the angular speed of the motor, the single chip computer is used to process the information and optimize the control. The controller controlled by the proportion, integral and differential of the deviation signal is called the PID controller, and its control law becomes the PID control algorithm. As shown in Figure 1, the ratio of the deviation e (t) between the given value and the output value, the linear combination of integral and differential forms the output of the control quantity u (t). In the formula: u (t) – output of the controller, proportional coefficient of the Kp – controller. Integration time constant of Ti controller. Differential time constant of Td-controller. E (t) – Controller input, the difference between the given value and the output value of the controlled object, is called deviation signal. The parameters of proportional link, integral link and differential link in PID controller must be selected properly, otherwise the system will be unstable. (1) The proportion link can reflect the deviation quickly and reduce the deviation. The control effect depends on Kp. The larger the Kp, the shorter the transition process and the smaller the steady-state error.

However, the larger the Kp, the larger the overshoot, the easier the oscillation will occur, resulting in the deterioration of the dynamic performance and even the instability of the closed-loop system. (2) Integral link: As long as there are deviations, the control function of integration will accumulate continuously, and the control quantity will be output to eliminate the deviation. However, too strong integration will increase the overshoot of the system, make the dynamic performance of the control worse, and even make the closed-loop system unstable. (3) Differential link: Differential control helps to reduce overshoot, overcome oscillation and improve the stability of the system, **thermostatic element** but it reduces the ability of the system to suppress interference. The strength of the differential part depends on the differential time Td. The larger the Td, the stronger the inhibition of E (t) changes; the smaller the Td, the weaker the resistance to e (t) changes. After sampling and integer quantization, the continuous time signal of the PID control system can only be approximated by numerical calculation. Therefore, the realization of PID control law must also use numerical approximation method. When the sampling period is rather short, the summation is used instead of integral and differential quotient to discretize the PID algorithm. The differential equation describing the continuous-time PID algorithm is transformed into the difference equation describing the discrete-time PID algorithm, that is, the digital PID position control formula. Kp, Ki and Kd are proportional, integral and differential coefficients respectively.

PID control is very good in stability, response speed, overshoot and stability accuracy. It has strong adaptability and adapts to various control objects. But the setting of parameters is a key problem of PID control, and its dynamic characteristics are not ideal.

PID control does not have adaptive control ability and has poor control effect for time-varying and non-linear systems. When the system parameters change, the control performance will change greatly, and the control characteristics may deteriorate, which may lead to the instability of the system in serious cases. Fuzzy control is an intelligent control method based on analog set theory, analog language variables and analog reasoning. It simulates the reasoning process of human thinking and constructs a kind of non-linear control to meet the needs of complex and uncertain process control. The control law of the fuzzy controller is realized by the program. Firstly, according to the sampling value, the input of the fuzzy controller is obtained and quantified; the quantized variables are fuzzified to get the fuzzy quantity; according to the input fuzzy control quantity and the fuzzy control rule, the fuzzy quantity of the output is calculated according to the fuzzy reasoning synthesis rule; the fuzzy output is fuzzified to get the precise quantity of the control quantity, and the output is quantified to get the real quantity. Inter-control quantity. The design of the fuzzy controller includes four levels: the determination of the input and output quantity of the fuzzy controller, the determination of the fuzzy set of the input and output variables and the membership function, the table of fuzzy control rules, and the calculation of the output control quantity by the de-fuzzification process. In the fuzzy controller, the fuzzy control rule table is the most important part of the system control self-tuning. Variables include system deviation e, deviation rate EC and output control U. According to the deviation of system output and the trend of deviation change rate, the deviation is eliminated and the fuzzy control rules are obtained.

Through the query of the fuzzy control rule table, the precise output control quantity can be obtained by the de-fuzzification processing. Fuzzy-PID control is composed of fuzzy control and PID control. The key of the PID control is the determination of the parameters.

The adaptive fuzzy control algorithm uses the fuzzy control to determine the parameters of the PID. That is to say, according to the system deviation E and the deviation change rate ec, the parameters of the PID are modified online by the fuzzy control rules. Firstly, the fuzzy relationship between each parameter of PID and E and EC is found out. In operation, E and EC are continuously detected, and then the parameters are modified online according to the principle of fuzzy control to meet the different requirements of control parameters in different E and ec, so that the control object has good dynamic and static performance, and the calculation is small, so it is easy to realize on the single chip computer. Different deviation E and deviation change rate EC have different requirements for setting parameters Kp, Ki and Kd of PID controller. The self-tuning fuzzy-PID controller system has the advantages of fast response speed, high adjustment accuracy, good steady-state performance, and no overshoot and oscillation. The application of MCU DC motor control system reduces the system error, makes the system control more accurate, and improves the stability of the system.