Design of Temperature Controller Based on MSP430F149 MCU and Fuzzy Control

Temperature control has broad application prospects for industries such as industry and daily life. Many application fields require constant temperature control with high precision. Due to its nonlinearity, time lag and uncertainty, traditional control cannot be achieved. good control effect. Fuzzy control is a rule-based control. It directly adopts language-based control rules. The starting point is the control experience of field operators or the knowledge of relevant experts. Its robustness is strong, and the influence of interference and parameter changes on the control effect is greatly weakened. , so it is especially suitable for the precise control of temperature from 0 to 100 °C.

0 Preface

Temperature control has broad application prospects for industries such as industry and daily life. Many application fields require constant temperature control with high precision. Due to its nonlinearity, time lag and uncertainty, traditional control cannot be achieved. good control effect. Fuzzy control is a rule-based control. It directly adopts language-based control rules. The starting point is the control experience of field operators or the knowledge of relevant experts. Its robustness is strong, and the influence of interference and parameter changes on the control effect is greatly weakened. , so it is especially suitable for the precise control of temperature from 0 to 100 °C.

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

1 System Design

The system takes MSP430F149 single-chip microcomputer as the control core. The temperature measurement is completed by the platinum resistance constant current conditioning circuit. The output voltage of the conditioning circuit is sent to the single-chip microcomputer, and the A/D conversion is realized in the single-chip microcomputer. The sampling data is filtered and scaled. The value is displayed by a 3-digit digital tube. The input temperature setting value is carried out 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. System design block diagram shown in Figure 1.

2 Main hardware circuit design

2.1 Platinum resistance temperature measurement and conditioning circuit

In this system, the actual temperature value is measured by the platinum resistance constant current work conditioning circuit. In order to overcome the nonlinear characteristics of platinum resistance, a negative feedback nonlinear correction network is added to the signal conditioning circuit. As shown in Figure 2, RT100 with a nominal value of 100Ω is selected as the temperature sensor for platinum resistance. A1, A2 and A3 use low temperature drift op amp OP07. Since there is current flowing through the platinum resistance sensor, when the temperature is 0°C, there is a voltage drop on the platinum resistance sensor. This voltage is the bias voltage of the platinum resistance sensor, which is A part of the output voltage of the operational amplifier A1 makes the output of the constant current work conditioning circuit not actually 0, so it is necessary to zero-adjust the bias voltage. R3 is the zero-adjusting resistor in the figure. In the figure, op amp A3 and resistors R1, R4 and R6 form a negative feedback nonlinear correction network. R5 is used to adjust the gain of op amp A2.

2.2 Temperature control circuit

Both the heating wire and the fan of the system adopt the circuit form shown in Figure 3. The circuit uses a transistor-driven DC electromagnetic relay. When P5.4 of the one-chip computer is low level, the relay RL1 pulls in, when P5.4 is high level, the relay RL1 releases. The use of this control logic can make the relay not pull in during power-on reset or controlled reset of the microcontroller. The relay is driven by a transistor 2N222A, which can provide the required drive current.

3 Fuzzy control rule table and software flow chart

3.1 Establish a fuzzy control rule table

The temperature error E and the temperature error rate of change 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 temperature error E, temperature error change rate Ec and temperature control quantity U (unit: °C) in the system are respectively:[-5,+5],[-2,+2]and[0,1]. The language value of the input language variable is 7, and the output control quantity is used to control the relay drive circuit. Set the duty cycle fuzzy control amount to 0, 1/4, 1/2, 3/4, 1 five single point blur amount and 1 single point blur amount to control the blowing of the fan. The language value of the output language variable is 6. When U=0, the P3.5 port of the single-chip microcomputer 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 within 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 connected in 1 cycle Pass. The control system selects trigonometric function, ascending semi-trapezoid function and descending semi-trapezoid function as the membership function of the input quantity linguistic value, and uses the impulse function as the membership function of the output quantity linguistic value. The fuzzy control rules are shown in Table 1.

The input-output relationship of the language rules of the fuzzy controller can be obtained by reasoning from the fuzzy rules, and the relationship is a nonlinear relationship surface. When the deviation is large, the change of the control variable should try to reduce the deviation rapidly; 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 and even causing the system to oscillate.

3.2 Software flow chart

The main program software flow is shown in Figure 4.

Temperature acquisition and Display, keyboard processing, etc. are implemented as relatively independent functional modules during programming, and are called according to the set process during the running of the main program, and then return to the main program after completing the corresponding tasks.

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 output of the system shows that the actual temperature is 54°C, and the set temperature of the system is 55°C. At this time, P5.4 outputs a heater control signal with a duty ratio of 2:1; When the actual temperature of the system is greater than the set temperature, the system outputs appropriate fan control signals to dissipate heat with constant power, indicating that the design requirements are met.

5 Conclusion

This system adopts low-power MSP430 series single-chip microcomputer as the control core. The whole control circuit is relatively simple. The fuzzy control algorithm is used to design the program. The set temperature value and the measured temperature value are displayed in real time, and the control accuracy can reach ±0.5℃. And has a wide range of practicality in life.

The Links:   CM400HA-24A DMF-50036ZNBU-FW TIMMALCD