Temperature Control System Based on PID Algorithm and 89C52 Single Chip Microcomputer

Publisher:Tianyun2021Latest update time:2009-12-22 Source: 现代电子技术 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, water heaters, rice cookers, electric ovens and other household appliances that rely on temperature control technology are also indispensable. It can be said that temperature control technology is everywhere.

Conventional temperature control methods use the set temperature as the critical point. If the temperature exceeds the set range, the temperature is adjusted: heating is performed when the temperature is lower than the set value, and stopping or cooling is performed when the temperature is higher than the set value. This method is simple to implement and low in cost, but the control effect is not ideal. The temperature control 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 situations 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 lag. It is particularly suitable for control systems with large load changes, large capacity lag, 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 control theory techniques 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.

The parameter tuning of PID controller is the core content of control system design. It determines the proportional coefficient, integral time and differential time of PID controller according to the characteristics of the controlled process. There are two main methods for parameter tuning of PID controller: one is theoretical calculation tuning method. It mainly determines the controller parameters through theoretical calculation based on the mathematical model of the system. 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):

In the formula: 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 differential 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), we can get the discrete PID expression: 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 System Hardware Composition

The system consists of four parts: sensor A/D sampling input, single-chip 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 computer, 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, and set each interrupt and timer.

(2) Receive/transmit: This part of the program is mainly responsible for data control and display, and mainly completes two-way communication with the keyboard part through the full-duplex serial port of the 89C52 microcontroller.

(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 calculations (such as decimal to hexadecimal conversion, double-byte and single-byte division operations, etc.), for the convenience of program calling, it is written in the form of a subroutine.

(5)PID algorithm.

4 Experimental testing

The performance and stability of the system need to be completed through specific experimental tests. A 1 kW electric furnace is used 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), and 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

It can be seen from the experimental results 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 89C52 Single Chip Microcomputer

Previous article:Realization of short-distance wireless communication based on AT89C52 single-chip microcomputer
Next article:A temperature controller for passenger car drying room based on fuzzy control based on single chip microcomputer

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号