Temperature Control System Based on PID Algorithm and 51 Single Chip Microcomputer

Publisher:明理厚德Latest update time:2011-10-14 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

0 Introduction
Temperature control technology plays a very important role in both industrial production and daily life. In industries such as metallurgy, petroleum, chemical industry, electric power and modern agriculture, temperature is one of the most important and common thermal parameters. In ordinary households, household appliances such as water heaters, rice cookers, and electric ovens that rely on temperature control technology are also indispensable. It can be said that temperature control technology is everywhere.
The conventional temperature control method takes the set temperature as the critical point. If it exceeds the set allowable range, the temperature is controlled: heating is performed if it is lower than the set value, and otherwise it is stopped or cooled. This method is simple to implement and low in cost, but the control effect is not ideal, the control temperature accuracy is not high, it is easy to cause oscillation, and it takes a long time to reach the stable point. Therefore, it can only be used in occasions where the accuracy requirements are not high.
The PID algorithm is used for temperature control, which has the characteristics of high control accuracy and the ability to overcome capacity hysteresis. It is particularly suitable for control systems with large load changes, large capacity hysteresis, and high control quality requirements.
As an indispensable part of the control system, the single-chip microcomputer has been widely used in various fields. Using the single-chip microcomputer for real-time system data processing and control can ensure that the system works in the best state, improve the control accuracy of the system, and help improve the work efficiency of the system. This system uses single-chip microcomputer programming to implement PID algorithm for temperature control.


1 Principles and characteristics of PID control
In engineering practice, the most widely used regulator control law is proportional, integral, and differential control, referred to as PID control, also known as PID regulation. PID controller has become one of the main technologies of industrial control due to its simple structure, good stability, reliable operation, and convenient adjustment. When the structure and parameters of the controlled object cannot be fully mastered, or an accurate mathematical model cannot be obtained, other technologies of control theory are difficult to adopt, and the structure and parameters of the system controller must be determined by experience and on-site debugging, it is most convenient to apply PID control technology.
PID controller parameter tuning is the core content of control system design. It determines the proportional coefficient, integral time, and differential time of the PID controller according to the characteristics of the controlled process. The methods of PID controller parameter tuning can be summarized into two categories: one is the theoretical calculation tuning method. It is mainly based on the mathematical model of the system and determines the controller parameters through theoretical calculation. The calculated data obtained by this method may not be directly used, and must be adjusted and modified through engineering practice. The second is the engineering tuning method, which mainly relies on engineering experience and is directly carried out in the test of the control system. The method is simple and easy to master, and is widely used in engineering practice.
The general formula of PID and the analog control law are shown in formula (1):

Where: u(t) is the output of the controller; e(t) is the deviation, that is, the difference between the set value and the feedback value; KC is the controller's amplification factor, that is, the proportional gain; TI is the controller's integral constant; TD is the controller's differential time constant. The principle of the PID algorithm is to adjust the three parameters KC, TI, and TD to make the system stable.
Since computer control is a sampling control, it can only calculate the control quantity based on the deviation value at the sampling time. Therefore, in the computer control system, equation (1) must first be discretized, and the differential equation of the continuous system must be replaced by a digital difference equation. At this time, the integral term and the differential term can be expressed by summation and increment:

Substituting equations (2) and (3) into equation (1), the discrete PID expression can be obtained:

Where: △t=T is the sampling period, and T must be small enough to ensure that the system has a certain accuracy (sampling theorem); E(K) is the deviation value at the Kth sampling; E(K-1) is the deviation value at the K-1th sampling; P(K) is the output of the regulator at the Kth sampling.

2 Hardware composition of the system
This system consists of four parts: sensor A/D sampling input, single-chip microcomputer control, human-computer interaction, and control signal output. The temperature sensing part is realized by the test sampling circuit, the human-computer interaction is composed of a matrix keyboard and an LCD screen, the PID control algorithm is realized by the 89C52 single-chip microcomputer, and the control signal output part is composed of a power amplifier and a switch control circuit. The system block diagram is shown in Figure 1.


3 Main program flow
The software program is the core of this control system, which includes the entire process control from temperature sampling to signal output, and its schematic diagram is shown in Figure 2.

The program functions mainly consist of the following parts:
(1) Initialization: Set the initial values ​​of each parameter, set each interrupt and timer.
(2) Receiving/transmitting: This part of the program mainly completes the control and display of data, mainly through the full-duplex serial port of the 89C52 microcontroller to complete the two-way communication with the keyboard part.
(3) PC communication: This part completes the connection with the microcomputer control interface RS 232 and the control of communication.
(4) Numerical conversion subroutine: Since the main program uses a lot of numerical conversion and numerical calculation (such as decimal conversion to hexadecimal, double-byte and single-byte division operations, etc.), for the convenience of program calling, it is specially written in the form of a subroutine.
(5) PID algorithm.


4 Experimental test
The performance and stability of the system need to be completed through specific experimental tests. Now use a 1 kW electric furnace to heat 1 L of clean water in an electric cup.
Observe the error between the set value and the measured value (the value when the water temperature reaches stability), calculate the absolute error and relative error, see Table 1.

The set temperature was 50°C and the measured temperature was recorded every 30 s, as shown in Table 2.

From the data in Table 2, it can be seen that the system basically reaches stability after running for 5 minutes.


5 Conclusion
From the experimental results, it can be seen that the error of the system is basically stable at ±0.3℃, which shows that the accuracy of the system is very good. In addition, the temperature is basically stable when the system runs for 5 minutes, and the time required for stabilization is short. It can be seen that the single-chip temperature control system based on the PID algorithm has high accuracy and stability, and the temperature balance time is short in the temperature adjustment stage. Therefore, this system can be applied to various temperature control occasions with high accuracy requirements.

Reference address:Temperature Control System Based on PID Algorithm and 51 Single Chip Microcomputer

Previous article:Application of Communication Converter Based on Single Chip Microcomputer in Remote Measurement and Control System
Next article:Application of 51 single chip microcomputer in micro printer

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号