The hottest temperature and humidity detection bas

2022-10-14
  • Detail

A temperature and humidity detection system based on MSP430F1232

Introduction

with the development of social economy and the continuous progress of science and technology, the temperature and humidity of the environment need to be limited in many cases. Therefore, temperature and humidity alarms must be installed in some specific environments for monitoring. Therefore, this paper uses the characteristics of the integrated temperature and humidity sensor HM1500, such as fast temperature measurement, easy to use and so on, combined with the powerful function of MSP430 single chip microcomputer, designs a monitoring system to monitor the temperature and humidity in real time for over limit alarm. The system has the advantages of accurate measurement, convenient debugging, real-time recording of alarm information, convenient troubleshooting for staff, and can be widely used in occasions with poor conditions and inconvenient access

1 system structure and overall design scheme

the overall design scheme of this system is shown in Figure 1. This scheme adopts the method of designing temperature and humidity sampling circuits respectively, and converts the current signal collected by the integrated temperature sensor AD590 and the voltage signal collected by the humidity sensor HM1500 into the voltage signal within the given range. Then the AD sampling port of MCU MSP430F1232 reads the voltage signal. If the temperature is less than the threshold value or the humidity is greater than the threshold value, an alarm signal will be given. The threshold value can be set by pressing the key. At the same time, the system can also send the collected temperature and humidity values to the upper computer by interruption according to the given protocol

2 device selection

2.1 MSP430F1232 single chip microcomputer

msp430 series single chip microcomputer is a powerful ultra-low power 16 bit mixed signal processor launched by TI company. This series of single chip microcomputer is widely used in portable instruments, intelligent sensors, practical detection instruments, motor control and other fields because of its extremely low power consumption, strong processing capacity, rich on-chip peripheral modules, convenient and efficient development methods and other characteristics. In order to maximize the use of single-chip port and chip internal and external devices and reduce the design cost, MSP430F1232 is selected in this design. The single-chip microcomputer has three parallel ports, an RS485 serial communication port, and a 10 bit AD sampler is built at the same time, which can fully meet the accuracy requirements of temperature and humidity sampling

2.2 AD590 temperature sensor

ad590 is a two terminal integrated temperature current sensor produced by American ad company. This device has small volume, light weight and stable performance. The temperature measurement range is -50 ~ +150 ℃; Linear current output is 1 μ A/K; The linearity is good, and the measurement accuracy is ± 0.3 ℃; The power supply voltage range is 4 ~ 30 v. When the power supply voltage is between 5 ~ 10 V and the voltage stability is 1%, the error is only ± 0.1 ℃

2.3 HM1500 humidity sensor

linear voltage output integrated humidity sensor HM1500 is designed and manufactured with patented humidity sensitive capacitor HS1101, and its humidity measurement range is 5% - 99% (relative humidity); The accuracy of relative humidity is 3%; The working temperature is -30 ~ +60 ℃; The working humidity range is 0 ~ 100% (relative humidity); The power supply voltage is 5V (the maximum voltage is dc16v); The output DC voltage is 1 ~ 4 V; The response time is 5S, which is suitable for industrial occasions

3 signal conditioning circuit design

3.1 temperature measurement circuit design

considering the output current source characteristics of AD590 temperature sensor, the designed temperature signal measurement circuit is shown in Figure 2. The temperature measurement range of this circuit is -10 ~ +500 ℃. AD590 is powered by 15V voltage; Resistance R1 is used to adjust the zero point; Resistor R3 is a precision resistor used to adjust the gain. Input 2.50V precision reference voltage at the same direction end of the operational amplifier, which is provided by TL431. The in end inputs the current of AD590, and the out end outputs the voltage obtained by corresponding conversion. According to the characteristics of AD590, the flowing current is 262 at -10 ℃ Simple and fast operation 2 μ A. The design makes this part of current flow through R1 and R2, and the subsequent increased current flow through R3. The output voltage of the out end is:

when the temperature changes between -10 ~ +50 ℃, the voltage changes inversely and linearly between 2.5 ~ 0V. Adjusting the resistance value of R1 can eliminate the zero point error of different sensors

3.2 design of humidity measurement circuit

the output voltage of the integrated humidity sensor HM1500 changes linearly with humidity between 1 ~ 4 v. considering the characteristics of the single power supply of this system, the designed humidity signal acquisition circuit is shown in Figure 3, and the humidity measurement range of this circuit is 0 ~ 100%

because there is no data and mechanical functions of various castings on the 3.1 experimental machine in this circuit, which should conform to the regular negative pressure of the response specification, the main body of the circuit adopts the differential subtraction circuit, with precision resistors r3=r6=2.4k Ω, r4=r7=2k Ω, and the gain can be adjusted with these four resistors. The humidity voltage signal measured by HM1500 sensor is input from the in end. Input vs on the other side of the difference. TL431 provides a precision voltage of 2.5 v. after voltage division, a voltage of about 1.0 V can be obtained. From this, we can get the calculation formula of output voltage as follows:

if the input voltage changes between 1 and 4 V, the output voltage changes between 0 and 2.5 V accordingly. Adjusting R1 can eliminate the zero error of different humidity sensors

4 design of display storage and serial communication circuit

this system adopts three independent keys and four digit seven segment nixie tube dynamic scanning display mode, and data storage adopts. EEPROM chip AT24C02 stores the set temperature and humidity sensor address, temperature and humidity alarm threshold value, and alarm record. The collected data and stored alarm information can be transmitted to the upper main controller for processing according to the specified protocol

Figure 4 shows the key display, data storage and serial communication circuits in the system. In the figure, after the MCU collects the temperature and humidity data from adin1 and adin2 ports, it first sends the humidity value to the nixie tube for display, and lights up the humidity indicator light at the same time, indicating that the humidity is displayed now. By pressing key 2 and key 3, the temperature and humidity display can be switched. Key 2 displays humidity. It is important to pay attention to the temperature displayed by key 3 in the context of the new round of industrial revolution. When displaying the temperature, the corresponding indicator light will also be lit. If it is detected that the temperature and humidity exceed the threshold, the alarm light will be turned on to indicate that the data exceeds the limit. Press key 1 to set the corresponding temperature and humidity threshold and sensor address. After the data setting is completed, the I2C bus protocol can be programmed and simulated through two IO ports to store the data in the specified position, so that the data can be read normally when the machine is powered off and then turned on. Due to the limited IO ports of single chip microcomputer, the system uses two sn74hc373 chips to expand 8 IO ports to meet the design requirements. In order to ensure level compatibility, this part of the circuit adopts 3.3V voltage for power supply. After the data acquisition and conversion is completed, the system can be directly connected to the max3485 communication chip through the uasrt (asynchronous serial communication port) of the single chip microcomputer, so as to transmit the data to the upper computer according to the specified protocol

5 software design

the software design of this system is written in C language. It mainly reads the temperature and humidity voltage signal of the port through the 10 bit AD sampling module of MSP430F1232 MCU, and converts it into the actual temperature and humidity value according to the corresponding conversion formula and stores it. Then send it to the nixie tube display or the upper computer through RS485 serial port as needed. In addition, the software can also store data of analog I2C bus

Figure 5 shows the main cycle flow of the system. After the system is powered on, first read the address and temperature and humidity threshold value in the EEPROM, then enter the cycle state to sample the temperature and humidity signal, then process and store the collected data, and judge the key flag bit in the cycle. If it is set, the corresponding key processing is performed

Figure 6 shows the timer interrupt flow of the system. After the system enters the interrupt, first judge whether there is a key pressed by judging whether the input level of the corresponding IO port jumps low. If there is a key pressed, then further judge which key it is, and then store the key position and mark the key position. Then call the display refresh program to send the latest collected data to the nixie tube for display. Finally, judge whether the collected data exceeds the threshold, and light the indicator light or alarm light accordingly. Interrupt the return after the above operations

6 conclusion

the biggest characteristics of this system are accurate measurement, simple structure, convenient debugging and use, high cost performance, and can be used alone or connected with the upper computer. In order to ensure the stability of the whole system, the system also uses the MCU power on reset circuit in the hardware design, and adds the watchdog and software trap in the software design. Experiments show that the device is reliable, with small measurement error and good application effect. Therefore, it can be widely used in industrial environments where there are over limit alarm requirements for temperature or humidity. (end)

Copyright © 2011 JIN SHI