Design and implementation of temperature controller based on single chip microcomputer and fuzzy control

Publisher:CrystalDawnLatest update time:2012-03-22 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
Abstract: Temperature is one of the most basic physical quantities in science and technology. In industrial production and life, it is often an important parameter to characterize the state of objects and processes. Its control has nonlinearity, time lag and uncertainty, and traditional control cannot achieve good control effects. A temperature controller with MSP430F149 as the core component of the system is designed, and the fuzzy control algorithm is applied to it. The temperature control range is 0-100℃ at room temperature. The set temperature value and the measured temperature value are displayed in real time, and the control accuracy can reach ±0.5℃. The system adopts constant temperature power supply, the circuit is simple, the cost is low, and the temperature control accuracy is high. It can be widely used in production and life that require constant temperature control.

0 Introduction

Temperature control has broad application prospects in industries and daily life. Many application fields require high-precision constant temperature control. Due to the nonlinearity, time lag and uncertainty of its control, traditional control cannot achieve good control effects. Fuzzy control is a rule-based control that directly adopts language-based control rules. The starting point is the control experience of field operators or the knowledge of relevant experts. It has strong robustness, and the influence of interference and parameter changes on the control effect is greatly reduced, so it is particularly suitable for precise control of 0-100℃ temperature.

The MSP430 series microcontroller is a 16-bit, ultra-low power hybrid microcontroller with a reduced instruction set. The MSP430F149 microcontroller uses a reduced instruction set (RISC), has a rich addressing mode (7 source operand addressing, 4 destination operand addressing), 27 concise core instructions and a large number of analog instructions, a large number of registers and on-chip data memory can participate in a variety of operations, and there are efficient table lookup processing instructions; it has a high processing speed, and the instruction cycle is 125 ns under 8MHz crystal drive. These features ensure that a highly efficient source program can be compiled. The MSP430F149 microcontroller has different combinations of some peripheral modules such as 10-bit/12-bit ADC, 16-bit Sigma-Delta A/D, direct addressing module (DMA), ports 1 to 6, basic timer (Basic Timer), etc. Among them, the watchdog can quickly reset the program when it is out of control; the analog comparator compares the analog voltage, and with the timer, an A/D converter can be designed. The system uses MSP430F149 single-chip microcomputer, which can save A/D and other hardware circuits, thus reducing its cost and greatly enhancing its reliability.

1 System Design

The system uses MSP430F149 microcontroller as the control core. The temperature measurement is completed by the platinum resistor constant current conditioning circuit. The output voltage of the conditioning circuit is sent to the microcontroller, and A/D conversion is realized inside the microcontroller. The sampled data is filtered and scaled. The temperature value is displayed by a 3-digit digital tube. The input temperature setting value is input by a 4-digit independent keyboard circuit. After the setting value is sent to the microcontroller, it is displayed by another 3-digit digital tube. The system design block diagram is shown in Figure 1.

System design block diagram

2 Main hardware circuit design

2.1 Platinum resistance temperature measurement conditioning circuit

In this system, the actual temperature value is measured by the constant current working conditioning circuit of the platinum resistor. In order to overcome the nonlinear characteristics of the platinum resistor, a negative feedback nonlinear correction network is added to the signal conditioning circuit. As shown in Figure 2, the platinum resistor uses RT100 with a nominal value of 100Ω as the temperature sensor. A1, A2 and A3 use the low temperature drift op amp OP07. Since there is current flowing through the platinum resistor sensor, when the temperature is 0℃, there is a voltage drop on the platinum resistor sensor. This voltage is the bias voltage of the platinum resistor sensor and is part of the output voltage of op amp A1, so that the output of the constant current working conditioning circuit is not actually 0, so it is necessary to zero this bias voltage. R3 in the figure is the zero adjustment resistor. The op amp A3 and resistors R1, R4 and R6 in the figure constitute a negative feedback nonlinear correction network. R5 is used to adjust the gain of op amp A2.

Platinum resistance signal conditioning circuit

2.2 Temperature Control Circuit

The system heating wire and fan both adopt the circuit shown in Figure 3. The circuit uses a DC electromagnetic relay driven by a transistor. When P5.4 of the microcontroller is at a low level, the relay RL1 is energized, and when P5.4 is at a high level, the relay RL1 is released. This control logic can prevent the relay from energizing during power-on reset or microcontroller controlled reset. The relay is driven by a transistor 2N222A, which can provide the required drive current.

Temperature control circuit

3. Fuzzy control rule table and software flow chart
3.1 Establishing fuzzy control rule table

The temperature error E and the temperature error change rate Ec are used as the input variables of the fuzzy controller, and the temperature control quantity U is used as the output variable of the fuzzy controller. The basic domains of the temperature error E, the temperature error change rate Ec and the temperature control quantity U (unit: ℃) in the system are [-5, +5], [-2, +2] and [0, 1] respectively. The language value of the input language variable is 7, and the output control quantity is used to control the relay drive circuit. The duty cycle fuzzy control quantity is set to five single-point fuzzy quantities of 0, 1/4, 1/2, 3/4, and 1 and a single-point fuzzy quantity for controlling the fan blowing. The language value of the output language variable is 6. When U=0, the P3.5 port of the single-chip computer is set to a low level to make the fan control circuit work; when U=1, the heating wire control circuit works, and the relay is fully turned off in 1 cycle; when U=2, the heating wire control circuit works, and the relay is turned on in 1/4 cycle and turned off in 3/4 cycle; when U=5, the heating wire control circuit works, and the relay is fully turned on in 1 cycle. This control system uses trigonometric functions, ascending semi-trapezoidal functions and descending semi-trapezoidal functions as the membership functions of the input language value, and uses pulse functions as the membership functions of the output language value. The fuzzy control rules are shown in Table 1.

Reasoning from fuzzy rules can derive the input-output relationship of the fuzzy controller language rules, which is a nonlinear relationship surface. When the deviation is large, the change of the control quantity should try to reduce the deviation quickly; when the deviation is small, in addition to eliminating the deviation, the stability of the system should also be considered to prevent the system from overshooting or even causing system oscillation.

3.2 Software Flowchart

The main program software flow is shown in Figure 4.

Main program software flow chart

Temperature collection and display, keyboard processing, etc. are implemented as relatively independent functional modules during programming, and are called according to the set process during the operation of the autonomous program. After completing the corresponding tasks, they return to the main program.

4 Simulation Analysis

Add the compiled HEX file to the Proteus simulation software, and use the analysis chart analysis system to analyze the duty cycle of the heater control signal and the fan control signal output port. When the input voltage is 2.7 V, the system output shows that the actual temperature is 54°C, and the system set temperature is 55°C. At this time, P5.4 outputs a heater control signal with a duty cycle of 2:1; and when the actual temperature of the system is greater than the set temperature, the system outputs an appropriate fan control signal to dissipate heat at a constant power, indicating that the design requirements are met.

5 Conclusion

This system uses the low-power MSP430 series microcontroller as the control core. The entire control circuit is relatively simple. The program is designed using fuzzy control algorithm. The set temperature value and the measured temperature value are displayed in real time. The control accuracy can reach ±0.5℃, which has wide practicability in actual production and life.

Reference address:Design and implementation of temperature controller based on single chip microcomputer and fuzzy control

Previous article:Liquid level detection circuit
Next article:Common Problems and Maintenance of Electronic Scale Sensors

Latest Analog Electronics Articles
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号