Design of Temperature and Humidity Controller Using Single Chip Microcomputer

Publisher:绿意盎然Latest update time:2012-01-20 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Design of Temperature and Humidity Controller Using Single Chip Microcomputer

In some industries, the requirements for temperature and humidity are high, especially in the power system, where component failure caused by excessively high or low temperature or creepage and flashover accidents caused by excessive humidity often occur. In order to avoid these failures, it is necessary to install temperature control and dehumidification equipment in the power equipment cabinet. The temperature and humidity controller developed with single-chip microcomputer is fully functional and easy to operate. It is especially suitable for relay protection cabinets, instrument boxes, metering cabinets and other equipment with high requirements for temperature and humidity control. The main technical indicators are as follows.
Temperature indication: -30℃~120℃, accuracy ±1℃;
humidity indication: (0~100)%RH, accuracy ±5%RH;
heater start condition: when the temperature display value ≤ low temperature heating lower limit T1_L, or the humidity display value ≥ over-humidity heating setting value upper limit H_H;
heater exit condition: when the temperature display value ≥ low temperature heating upper limit T1_H and the humidity display value ≤ over-humidity heating setting value lower limit H_L are both met;
exhaust fan start condition: when the temperature display value ≥ exhaust cooling setting value upper limit T2_H;
exhaust fan stop condition: when the temperature display value ≤ exhaust cooling setting value lower limit T2_L;
relay contact capacity: AC220V/10A.

Figure 1: Temperature and humidity controller hardware structure diagram

Hardware Design
The hardware structure of this system is shown in Figure 1. The core of the whole system adopts the GMS97C2051 microcontroller which is fully compatible with MCS-51. It has a 20-pin package, reduces the P0 and P2 ports, and the other configurations and performance remain unchanged. The OTP device reduces the hardware cost.

The system uses the IMP813L microcontroller system monitoring circuit of the American IMP company to prevent the program from running away. If WDI is not in a floating state, and GMS97C2051 does not trigger the watchdog input WDI within 1.6 seconds, it means that the program has been disordered. The watchdog output terminal will output a low level to the manual reset terminal, so that the reset output terminal sends a reset signal, so that the GMS97C2051 can be reliably reset.

The display circuit uses the 8-bit LED control driver PS7219 with a high-speed serial interface. PS7219 is a high-performance, low-cost multi-bit LED display driver, which is fully compatible with MAX7219 and adds functions such as bit flash. Its interface adopts the popular synchronous serial peripheral interface SPI, which can be easily interfaced with any single-chip microcomputer and can drive 8-bit LEDs at the same time. PS7219 has 15×8 RAM function control registers inside, which can be easily addressed, each digit can be controlled and refreshed individually without rewriting the entire display. The display brightness can be digitally controlled, and each digit has a flashing enable control bit. These features of PS7219 save I/O ports and facilitate programming.

The A/D converter adopts the 8-bit serial control analog-to-digital converter TLC0834. TLC0834 is a low-cost 8-bit successive approximation A/D converter. Its multiplexer can be configured as single-ended or differential input by software, or as pseudo-differential input. The size of the reference voltage is adjustable, allowing arbitrarily small analog voltage programming intervals at full 8-bit resolution.

The humidity sensor adopts the capacitive humidity sensor HS1101. HS1101 has the advantages of fast response, high linearity, high reliability, constant time stability, and fast dehumidification under constant time saturation. IC1-a, R1, R2, and C1 form a multivibrator, whose oscillation frequency f=1.44/(R1+2R2)C1. The oscillation frequency of the parameters shown in the figure is about 50Hz (T=20ms). Its oscillation pulse provides a trigger pulse as a variable pulse generator. The monostable trigger on the right side of Figure 1 is composed of IC1-b, R3, and HS1101. The output pulse width depends on the charging time constant RC, that is, t=1.1R3(C2+CX). This output pulse is filtered by smoothing filters R4 and C3, and then input to the analog voltage input terminal of TLC0834 after DC amplification by IC3 (OP07). Among them, RP1 is used for zero adjustment, and RP2 is used for full scale adjustment.

The temperature sensor uses MF58 thermistor. The measurement range of this system is: -30~120℃, and the corresponding resistance value range is: 60.0256~0.2760kΩ. Since the resistance change of MF58 is enough to provide 0-2.5V analog voltage for TLC0834, LM358 is connected as a voltage follower. TLC0834 can be configured as differential or single-ended input by software. Differential input is used for temperature sampling. RP3 is used to adjust zero and RP4 is used to adjust full scale.

Three buttons are set up in this system, namely function key, plus 1 and minus 1 keys, which are used to set the upper and lower limits of temperature and humidity. The function key is a multi-function key, which performs the corresponding function according to the number of times it is pressed. When the function key is pressed for the first time, the digital tube displays the symbol for adjusting the lower limit of low-temperature heating and displays the value of the lower limit of low-temperature heating. After pressing plus 1 minus 1 to make the value meet the requirements, press the function key again and the digital tube displays the symbol for adjusting the upper limit of low-temperature heating and displays the value of the upper limit of low-temperature heating. Press plus 1 minus 1 to make the value meet the requirements. This is analogous. After setting the last parameter, press the function key again to complete the parameter setting and enter the measurement and control state.

Software Programming
The software of the controller consists of the main program and the T0 interrupt handler, of which the main program block diagram is shown in Figure 2 and the T0 interrupt handler is shown in Figure 3.

In the system, timer T0 is set to work mode 1, the timing cycle is 125ms, and 8 timer interrupts are 1 second. In order to improve the anti-interference performance, a sliding average filtering algorithm is used, that is, only sampling once, averaging this sampling value with several past sampling values, and the obtained valid sampling value can be put into use.

Two circular queues are used in this system. The temperature and humidity values ​​are sampled once each time an interrupt is interrupted and placed in the circular queues.

Every time a new data is stored, the old data is automatically flushed. The address of the circular queue is 30H~3FH, with a total of 16 units, and the temperature and humidity data occupy 8 units each. In order to effectively prevent the display from flickering, data processing is performed once a second (8 data are summed and divided by 8), and the processed data is converted into temperature and humidity values ​​and sent to the display cache and applied for display. At the same time, monitoring processing is performed. If the heater heating stop conditions or the row fan start and stop conditions are met, corresponding processing must be performed.

Since there is a watchdog circuit in the system, special attention should be paid when programming. The traditional method of waiting for the key to be released is likely to cause the watchdog circuit to output a reset signal. The solution is that in the main program, when a key is detected to be pressed, the post-key press flag is repeatedly judged in the loop of the main program whether the key press flag is cleared. If it is cleared, it means that the key has been released, and then the next round of keyboard press judgment can be performed. In the T0 interrupt handler, each interrupt must detect whether the key is pressed. If no key is pressed, there are two situations: one is that no key is pressed in the system (the key pressed flag is 0 at this time), and it is in monitoring state; the other is that the key is released after being pressed (the key pressed flag is 1 at this time), and the key pressed flag must be cleared at this time so that the next round of key pressed detection can be performed in the main program. This can ensure that when a key is pressed, it will only respond once no matter how long it is pressed, and it can also ensure that the watchdog circuit does not output a reset signal. Conclusion The temperature and humidity controller developed with the microcontroller as the core is small and beautiful, easy to install and use, and has stable and reliable performance. It can be used not only in the power sector, but also in warehouses and granaries with high temperature and humidity requirements.


Reference address:Design of Temperature and Humidity Controller Using Single Chip Microcomputer

Previous article:Analysis of Automatic Calibration Technology for Intelligent Precision Digital Multimeter
Next article:Peak detector

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号