Design of temperature and humidity monitoring system based on MSP430 single chip microcomputer and HM1500 sensor

With the development of society and economy and the continuous progress of science and technology, in many cases it is necessary to limit the temperature and humidity of the environment. Therefore, temperature and humidity alarms must be installed in certain specific environments for monitoring. To this end, this article uses the integrated temperature and humidity sensor HM1500’s rapid temperature measurement, easy to use and other characteristics, combined with the powerful functions of the MSP430 microcontroller, design a monitoring system to monitor the temperature and humidity in real time for over-limit alarm. The system is accurate in measurement, convenient to debug, can record alarm information in real time, facilitates the staff to troubleshoot, and can be widely used in occasions where the conditions are bad and the personnel are inconvenient to enter.

introduction

With the development of society and economy and the continuous progress of science and technology, in many cases it is necessary to limit the temperature and humidity of the environment. Therefore, temperature and humidity alarms must be installed in certain specific environments for monitoring. To this end, this article uses the integrated temperature and humidity sensor HM1500’s rapid temperature measurement, easy to use and other characteristics, combined with the powerful functions of the MSP430 microcontroller, design a monitoring system to monitor the temperature and humidity in real time for over-limit alarm. The system is accurate in measurement, convenient to debug, can record alarm information in real time, facilitates the staff to troubleshoot, and can be widely used in occasions where the conditions are bad and the personnel are inconvenient to enter.

1. System structure and overall design plan

The overall design scheme of this system is shown as in Fig. 1. This program adopts the method of separately designing temperature and humidity sampling circuits, and converts the current signal collected by the integrated temperature sensor AD590 and the voltage signal collected by the humidity sensor HM1500 into a Voltage signal within a given range. Then the voltage signal is read in by the AD sampling port of the single-chip MSP430F1232, and an alarm signal is given if the temperature is less than the threshold value or the humidity is greater than the threshold value. The threshold can be set by pressing the button. At the same time, the system can also send the collected temperature and humidity values ​​to the host computer in an interrupt mode according to a given protocol.

Design of temperature and humidity monitoring system based on MSP430 single chip microcomputer and HM1500 sensor

2. Device selection

2.1 MSP430F1232 MCU

The MSP430 series single-chip microcomputer is a powerful ultra-low-power 16-bit mixed-signal processor launched by TI. This series of single-chip microcomputers are widely used in portable meters, smart sensors, practical testing instruments, motor control and other fields due to their extremely low power consumption, powerful processing capabilities, rich ON-chip peripheral modules, and convenient and efficient development methods. In order to maximize the use of the MCU port and on-chip peripherals and reduce the design cost, this design uses MSP430F1232. The MCU has 3 parallel ports, one RS485 serial communication port, and a built-in 10-bit AD sampler, which can fully meet the temperature and humidity sampling The accuracy requirements.

2.2 AD590 temperature sensor

AD590 is a two-terminal integrated temperature-current sensor produced by the American AD company. The device is small in size, light in weight and stable in performance. The temperature measurement range is -50~+150℃; the 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 and 10 V and the voltage stability is 1%, the error is only ±0.1°C.

2.3 HM1500 humidity sensor

The linear voltage output integrated humidity sensor HM1500 is designed and manufactured with the patented humidity-sensitive Capacitor HS1101. Its humidity measurement range is 5%~99% (relative humidity); relative humidity accuracy is 3%; 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, suitable for industrial-grade occasions.

3. Design of signal conditioning circuit

3.1 Temperature measurement circuit design

Taking into account the output current source characteristics of the AD590 temperature sensor, the temperature signal measurement circuit designed is shown in Figure 2. The temperature measurement range of this circuit is -10~+500℃. AD590 uses 15V voltage power supply; Resistor R1 is used to adjust the zero point; Resistor R3 is a precision resistor to adjust the gain. The op amp’s non-inverting terminal inputs 2.50V precision reference voltage, which is provided by TL431. The IN end inputs the current of AD590, and the OUT end outputs the voltage obtained by the corresponding conversion. According to the characteristics of AD590, at -10°C, the current flowing is 262.2μA. The design makes this part of current flow through R1 and R2, and the increased current flows through R3. The output voltage at the OUT terminal is:

Design of temperature and humidity monitoring system based on MSP430 single chip microcomputer and HM1500 sensor

When the temperature changes between -10 and +50°C, the voltage changes linearly in the opposite direction between 2.5 and 0V. Adjusting the resistance of R1 can eliminate the zero error of different sensors.

Design of temperature and humidity monitoring system based on MSP430 single chip microcomputer and HM1500 sensor

3.2 Humidity measurement circuit design

The output voltage of the integrated humidity sensor HM1500 varies linearly with humidity from 1 to 4 V. Taking into account the characteristics of the single power supply of the system, the humidity signal acquisition circuit designed is shown in Figure 3. The humidity measurement range of the circuit is 0 to 100% .

Design of temperature and humidity monitoring system based on MSP430 single chip microcomputer and HM1500 sensor

Since there is no negative voltage in the circuit, the main body of the circuit adopts a 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 the HM1500 sensor is input from the IN terminal. Input Vs on the other side of the difference. A voltage of about 1.0 V can be obtained after a precise voltage division of 2.5 V provided by TL431. And from this, the calculation formula of the output voltage can be obtained as:

Design of temperature and humidity monitoring system based on MSP430 single chip microcomputer and HM1500 sensor

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

4. Design of Display storage and serial communication circuit

This system adopts 3 independent buttons and four-digit seven-segment digital tube dynamic scanning display mode, and data storage is adopted. EEPROM chip AT24C02 to store the set temperature and humidity sensor address, temperature and humidity alarm threshold, and alarm records. The collected various 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, when the single-chip microcomputer collects the temperature and humidity data from the ADIN1 and ADIN2 ports, it first sends the humidity value to the digital tube for display, and at the same time lights up the humidity indicator, indicating that the humidity is now displayed. The temperature and humidity display can be switched by pressing the No. 2 key and the No. 3 key. The No. 2 key displays the humidity and the No. 3 key displays the temperature. When the temperature is displayed, the corresponding indicator will also be lit. If it is detected that the temperature and humidity exceed the threshold, the warning light is turned on to indicate that the data exceeds the limit. Press No. 1 key to set the corresponding temperature and humidity threshold and sensor address. After the data setting is completed, the two IO ports can be programmed to simulate the I2C bus protocol to store the data in the designated location, so that the data can be read normally when the power is turned on again. Due to the limited IO ports of the 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 is powered by 3.3V voltage. After the data acquisition and conversion are completed, the system can be directly connected to the MAX3485 communication chip through the UASRT (asynchronous serial communication port) of the microcontroller, so as to transmit the data to the upper computer according to the specified protocol.

Design of temperature and humidity monitoring system based on MSP430 single chip microcomputer and HM1500 sensor

5. Software design

The software design of this system is written in C language, mainly through the 10-bit AD sampling module of the MSP430F1232 single chip microcomputer to read the temperature and humidity voltage signal of the human port, and convert it into the actual temperature and humidity value according to the corresponding conversion formula and store it. Then send it to the digital tube display or send it to the host computer through the RS485 serial port as needed. In addition, the software can also perform data storage that simulates the I2C bus.

Figure 5 shows the main loop flow of the system. After the system is powered on, it first reads the address and temperature and humidity thresholds stored in the EEPROM, and then enters the loop state for temperature and humidity signal sampling, and then processes and stores the collected data. At the same time, the button flag is performed in the loop judge. If it is set, the corresponding key processing is executed.

Design of temperature and humidity monitoring system based on MSP430 single chip microcomputer and HM1500 sensor

Figure 6 shows the timer interrupt flow of the system. When the system enters the interrupt, first judge whether there is a key press by judging whether the corresponding IO port input level is low. If there is a key press, it will further judge which key it is, and then store the key position and mark the key. Position bit. Then call the display refresh program to send the latest collected data to the digital tube for display. Finally, it is judged whether the collected data exceeds the threshold, and the indicator light or warning light is lit accordingly. After performing the above operations, the interrupt returns.

Design of temperature and humidity monitoring system based on MSP430 single chip microcomputer and HM1500 sensor

6. Concluding remarks

The biggest feature of this system is accurate measurement, simple structure, convenient debugging and use, high cost performance, can be used alone, or connected with the host computer. In order to ensure the stability of the entire system, this system also uses a single-chip power-on reset circuit in the hardware design, and adds a watchdog and software trap to the software design. Experiments have proved that the device is reliable in operation, small in measurement error, and has a good application effect. Therefore, it can be widely used in industrial environments where temperature or humidity exceeds the limit alarm requirements.

The Links:   MG150J2YS11 PM30CNA060