Vous êtes sur la page 1sur 4

2010 International Conference on Computer Application and System Modeling (ICCASM 2010)

High-precision Temperature Control System Based on PID Algorithm

Jun-hong Yang Xi-yan- Bi


Dept. of Information Engineering Dept. of Information Engineering
ZHENGZHOU Railway Vocational& Technical College ZHENGZHOU Railway Vocational& Technical College
ZHENGZHOU, China ZHENGZHOU, China
E-mail:362764053@qq.com; yjhisyjh@sina.com E-mail: WLBXYWL@yahoo.com.cn

Abstract---This system uses 8bit AT89C51 CPU as a core for


building a electronic oven temperature control system with A. 89C51 CPU
high precision, the temperature was changed to voltage signals The 89C51 contain a non-volatile FLASH program
by the thermal resistor PT1000 and amplified by LM358, then memory that is parallel programmable. For devices that are
the analog voltage signal is converted to digital data by the serial programmable (In System Programmable (ISP) with a
AD0809. The PID algorithm was adopted as the software for boot loader), FEATURES
power and temperature control of the furnace, the control
accuracy is up to 0.2 º C. At the same time, with a temperature • 80C51 Central Processing Unit
display and can upload the data to PC for the data curve being • On-chip FLASH Program Memory
printed. The experiment shows that it’s very useful in the • Speed up to 33 MHz
practical system of agriculture and industry or household. • Full static operation
Key words-- AT89C51 microcontroller; Pt1000; PID; • RAM expandable externally to 64 k bytes
AD0809 • 4 level priority interrupt
• 6 interrupt sources
I . INTRODUCTION
Water temperature control system is widely used in • Four 8-bit I/O ports
industrial and agricultural production and family and other • Full-duplex enhanced UART
aspects, however, the control precision of the main problems – Framing error detection
is low in ordinary water temperature control system. In this – Automatic address recognition
paper, high-precision platinum resistance temperature sensor • Power control modes
Pt1000 was used to changed the water temperature to voltage – Clock can be stopped and resumed
signal, the AT89C51 microcontroller as the core of control – Idle mode
system in which the PID control algorithm adopted. The
– Power down mode
oven is a 1 kW electric heater, the temperature control range
is from 40 to 90 degrees Celsius, and the static control • Programmable clock out
accuracy is 0.2 degrees Celsius. Good fast and small • Second DPTR register
overshoot, and the decimal digital display, temperature curve • Asynchronous port reset
may be printed when the data is uploaded to PC. • Low EMI (inhibit ALE)
• 3 16-bit timers
II. THE SYSTEM HARDWARE DESIGN
•Wake up from power down by an external interrupt
The 89C51 Microcontroller can be programmed to
achieve various control algorithms and logic control. B. keyboard and digital display circuit
External ADC ADC0809 to meet the data sampling. As the The keypad is for temperature settings. The total of three
temperature data memory used 24C128. System block buttons is:
diagram shown in Figure 1. K1: Set the temperature of the 0 - 9 10 bits;
ADC0809 Sensors
K2: Set the temperature of 0 - 9 digits;
DISPLAY K3: temperature settings to confirm.
AT89C51 24C128
When the system power on, the all digital display zero,
8255 according to the pressing number by K1, the decimal
digital adds in sequence. Similarly, K2, also do so. By K3,
CPU Serial port
the system began to measure temperature, switch on or off
Keys PC printer
the electric stove.
8255 is used here for extended the 89C51 parallel port,
Relay Electrical heater in which 8255 PC0 is K1, PC1 then K2, PC2 then K3. A
total of four external LED digital cathode tubes is for
Fig. 1 System block diagram

978-1-4244-7237-6/$26.00 C 2010 IEEE V12-568


2010 International Conference on Computer Application and System Modeling (ICCASM 2010)

display, 8255 PA0-PA3 LED is for chip select. PB port is E. serial communication circuit
to connect the digital control of a ~ h segment. The This control system needs to communicate with the PC
Keyboard and display circuit is shown in Figure 2. so as to use the PC graphics capability to print or shows the
temperature curve. As AT89C51 TXD / RXD serial port is
TTL level, PC serial port for the RS232 level, so that using a
MAX232 level converter to drive. The Communication rate
is 9600 baud and the data transmission time is every 5
seconds.

Fig.2 The Keyboard and display circuit

C. heat furnace control circuit


CPU P1.7 is connected to transistor 8050 for control the
relay to turn on or off heaters, so as to control the electric
Fig. 3 The temperature measurement circuit
furnace power.
D. The temperature measure circuit III. SOFTWARE DESIGN

The temperature measurement circuit is shown in A. PID control algorithm


Figure 3. Using platinum resistance Pt1000 as temperature The basic process of PID algorithm is shown in Figure
sensor, platinum thermal resistance of physical and chemical 4.
properties at high temperature and oxidative medium is very
stable, it can be used as components of industrial S(k) - u(k)
e(k) Controlled y(k)
temperature, and this element linear better. In the 0-100 Controller object
degrees Celsius, the maximum nonlinear error is less than
Fig.4 The basic process of PID algorithm
0.5 degrees Celsius. The voltage signal is converted into
digital data by the ADC0809, and the data is stored into
PID algorithm is in two ways:
AT24C128 meanwhile for display.
Direct calculation method is the amount that current
The relationship between the Platinum thermal
control needs.
resistance and temperature is
Rt = R0(1 + At + Bt*t) (1) Pout = K P ∗ c(t ) +
(2)
Where Rt is the resistance when the temperature of t K i ∗ ∑ c(t ) + K d (c(t ) − c(t − 1))
degrees Celsius; R0 is the resistance when the temperature of
Then
0 degrees Celsius; t for arbitrary temperature, A and B for
the temperature coefficient. Pout = Kp * e(t ) +
(3)
LM358 op amp IC is used for amplifying the voltage Ki * ∑ c(t ) + Kd (e(t ) − e(t-1))
signal from Pt1000. Pt resistance was 1000 ohm at 0 degrees
Celsius, meanwhile at 100 degrees Celsius, the resistance is Incremental calculation method is the difference between
1380 ohms, then the Pt resistance is from 0-380 ohms, the two operations relative to the standard algorithm, the result
voltage from 0~3.3V. Using differential op amp was incremental, which means that the last control on the
in put, through the adjustable resistor divider to meet zero basis of the amount necessary to increase the amount of
adjustment. Pt resistance because of the basic current is control.
1-2mA, the Pt resistor voltage fluctuations in 0-3.3V. So Pout (t-1) = Kp*(e(t)e(t-1) + Ki e(t)
design 165-fold voltage amplification may basically meet the (4)
ADC0809 analog-digital conversion. + Kd(e(t)2*e(t-1) + e(t-2))

V12-569
2010 International Conference on Computer Application and System Modeling (ICCASM 2010)

Then Figure 5. The main program flow chart is shown in Figure 6.


Pout(t-1) = Kp*(e(t)e(t-1) + Ki e(t)
(5) Program structure configurations
+ Kd(e(t)2*e(t-1) + e(t-2))
The fundamental deviation e (t) is that the current
measured value and the difference between setting goals, AD Sample and upload

KEY value process


setting goals is the minuend, the result can be positive or

LED display
negative, positive number that has not yet reached, a

KEY scan
PID calculation
negative number indicates more than a set value. This is used
for the proportional change in the data.
The cumulative deviationis Σe (t) = e (t) + e (t-1) + e (t-2)
+ ... + E (1), which is the deviation of each measured value Relay control
of the sum, which is the algebra and, taking into account the
positive and negative sign operation, which is used for the Fig.5 Program structure configuration diagram
integral term changes in the data.
The relative deviation of the fundamental error: e(t)-e Start
(t-1), with the basic error of this fundamental deviation
minus the last time, to investigate the trend of the current System initialization
control object, as an important basis for rapid response,
which is a change item for differential data.
Ratio regulation is a proportional response system error,
once the system appears the deviation, the proportion will be Get key value
immediately adjusted.
Regulation is to reduce the deviation. Ratio effects more,
and can speed up the adjustment to reduce the error, but if Key value process
the ratio is too large, the stability of the system down, or
even cause system instability.
Integral regulatory is for the system to eliminate steady
state error, no gradient to increase. Because of the error,
Processing sampling
integral adjustment to be carried out until no difference so
that the integral adjustment stops and the integral adjustable data?
output a constant. Integral role in the strength depends on the
integration time constant Ti, Ti smaller, integral action will
be larger. On the contrary if the Ti is bigger the role of which
becomes weak, the adding of integral regulatory may cause PID calculation
system stability down and the dynamic response becomes
slow. The integral role often combined with the other two Relay control
regulating rule to form a PI controller or PID regulator.
Differential regulation reflects the system differential Fig.6 The main program flow chart
change rate of error signal, with foresight, to anticipate
change in error trend, so the control can produce lead role in IV. SYSTEM TEST AND THE RESULTS
the deviation is not yet before the differential regulatory role In order to verify the usability of the system, it’s need to give
has been to eliminate. Thus, it can improve the system the system a test. The ambient temperature is 28 degrees
dynamic performance. Differential timing in the right Celsius, digital millimeter test equipment, 0~100 ° C
circumstances can reduce the overshoot and reduce the thermometer, a printer, a stopwatch.
adjustment time. Differential role of noise disturbance Test method: make the system operation, simultaneous
amplification, so excessive increase in differential regulation measure the temperature changing using the thermometer,
of the system interference adversely. In addition, the come to the system temperature indicator.
differential response is that the rate of change, and when the Test results: the set temperature is from 40 to 60 degrees
input does not change, the output differential is zero, so the Celsius; calibration temperature <= 0.4 degrees C; settling
differential regulation can not be used alone; the law needs time of 450 seconds; static error <= 0.2 degrees C; maximum
to be combined with the other two methods to form the PD overshoot of 0.5 degrees Celsius.
or PID controller.
V. CONCLUSION
B. Programming design
High-performance 8-bit microcontroller AT89C51 as control
Program structure configuration diagram is shown in
core, used Pt1000 as a temperature sensor, the PID algorithm

V12-570
2010 International Conference on Computer Application and System Modeling (ICCASM 2010)

was used to build a high-precision temperature control [3] 8- channel, 8-bit, 200 Kbps data acquisition system ADC0809
(PDF).Analog Devices, 1998
system, the result tested showed that its accuracy is 0.2 ° C,
[4] De-biao Wang. MCS-51 Microcontroller Theory and Interface
can meet most application of the industrial and agricultural Technology Development, Beijing Electronic Industry Press, 2007
production and family. If a fuzzy control would be added to [5] YU Nan-hua, LIANG Xiao-bing. Research on PID Controller Based
the system, the time of adjustment will be short and the on Grey Algorithm [J]. Microcomputer Information, NO.31, 2008,
effect of PID control would be enhanced. pp :47-51
[6] KJAstrom and T. Hagglund, editors, PID control: Theory, Design and
REFERENCES Tuning, Instrument
Society of America Press, Research Triangle Park, NC second edition,
[1] Guo-feng Zhang, Principles and Applications, Mechanical Industry
1995.
Press, 2009
[2] Xu Ming, Chen Jian, 89C51 constant-current discharge in the battery
application. Electronics. No. 8, 2003 pp: 12-15

V12-571

Vous aimerez peut-être aussi