0 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, in order to detect the ambient temperature and humidity at any time for monitoring and reduce the economic losses caused by temperature and humidity to the project, this paper designs a system for measuring temperature and humidity based on SHT11, which can realize the monitoring of ambient temperature and humidity.
1 System Hardware Design
1.1 Overall structure
The temperature monitoring system is based on msp430 and uses temperature and humidity sensor SHT11 to measure temperature and humidity. The system consists of temperature and humidity data acquisition module, main control module, display module and key module. The temperature and humidity data acquisition module collects data and sends it to the microcontroller. After processing, the corresponding temperature and humidity display is completed according to the key operation, and it has the function of over-limit alarm. Figure 1 is the system structure diagram.
1.2 Hardware Selection
1.2.1 Main control module
MSP430 microcontroller is a series of ultra-low power microprocessors launched by TI. Its notable features are ultra-low power consumption, with 5 low-power modes to choose from; the digitally controlled oscillator can quickly convert the hardware from the low-power state to the wake-up state, and can reach the activation working mode in less than 6μs; the development language has the characteristics of assembly language and C language. The above features make it the preferred microprocessor for battery-powered portable devices.
1.2.2 Temperature and humidity monitoring module
This design uses SHT11 sensor to measure temperature and humidity. The temperature and humidity measurement chip consists of a capacitive polymer humidity measuring element and an energy gap temperature measuring element, and is seamlessly connected to a 14-bit analog-to-digital conversion chip and a serial interface circuit. Therefore, compared with other similar chips, this chip has the advantages of strong anti-interference ability, high measurement accuracy, extremely short response time, and high cost performance.
The internal hardware structure of SHT11 is shown in Figure 2.
The default accuracy of the SHT11 sensor for measuring temperature and relative humidity is 14 bits and 12 bits respectively. If the status register is set, the accuracy can be reduced to 12 bits and 8 bits. The temperature range that can be measured is -40 ~ 123.8℃. If the accuracy is set to 14 bits, the temperature resolution is 0.01℃; the humidity range that can be measured is 0% ~ 100%RH. If the accuracy is set to 12 bits, the humidity resolution is 0.03%RH. The SHT11 sensor chip is extremely accurately calibrated for humidity before leaving the factory, and the calibration coefficient is stored in the OTP memory as a program. During the measurement process, the program can automatically calibrate the relative humidity. The calibration of the sensor signal is related to the calibration coefficient. The SHT11 chip uses the relative temperature and relative humidity analog signals generated by the temperature and humidity sensor, respectively, and amplifies the signal through the amplifier, then performs analog-to-digital conversion, signal calibration and error correction through the analog-to-digital conversion chip, and finally transmits the relative temperature and humidity to the MSP430 microcontroller for processing through the RS232 serial interface. [page]
As shown in Figures 3 and 4, the transmission process of SHT11 is that when SCK is high, the DATA line is low, then SCK gives a low pulse, and when SCK is high again, DATA rises again. The subsequent command sequence consists of three address bits (currently only 000 is supported) and five command bits. SHT11 indicates the correct reception of the command by pulling down the DATA pin after the eighth SCK clock falling edge. At the ninth falling edge of the SCK clock, the DATA line is released (raised to a high level), as shown in Figure 4. To transmit two bytes of measurement data and one byte of CRC checksum, the μC must receive each byte through the pull-down pin of the DATA line.
When the communication between the external and SHT11 sensor chip is suddenly interrupted, the serial port can be reset according to the following timing: As shown in Figure 4, set the DATA line to a high level, trigger the SCK pulse more than 9 times, and then transmit a "transmission start" command sequence on the SCk line. After executing the temperature (humidity) measurement command sequence, the temperature and humidity measurement controller needs to complete the measurement before accepting new commands. When using 12-bit and 14-bit measurement accuracy, the measurement time is 55 and 210ms respectively. When a measurement is completed, the SHT11 chip will set the data line to a low level. At this time, the temperature and humidity measurement controller must restart the SCK signal and transmit 2 bytes of random measurement data and 1 byte CRC checksum. The temperature and humidity measurement controller must confirm each byte received by setting the DATA line to a low level. The received data is transmitted in MSB sequence. The temperature and humidity measurement controller stops working after confirming that the CRC data is correct. If the CRC-8 checksum does not exist or is not received, the temperature and humidity measurement controller keeps the SCK line high to stop data transmission after receiving the LSB bit. The SHT11 chip returns to sleep mode to automatically save energy after measuring the temperature and humidity and completing data communication.
1) Display and button module
The display module of the system adopts 8-bit digital tube display, plus 4*1 key module control. K1 and K2 respectively display the current temperature and humidity on the digital tube, and K3 and K4 display 0, which is convenient for hardware debugging.
2) Alarm module
The system uses sound and light alarm. If the system detects that the temperature and humidity of the surrounding environment exceed or fall below the required range, the single chip microcomputer drives the LED of the P3.5 interface to flash, and the buzzer sounds to remind the alarm.
2 System Software Design
The whole program mainly includes the design of main program, temperature and humidity data acquisition, digital tube display, key processing, sound and light alarm and other modules.
Figure 5 is the main program flow chart of the monitor. The key selection structure is used in the program design, mainly for the temperature and humidity display selection. After the key is pressed, the single-chip computer system determines that if it is K1, the current temperature is displayed; if it is K2, the current humidity is displayed; if it is K3 or K4, "0" is displayed. Finally, it is determined whether the temperature and humidity are out of limit. If they are, the sound and light alarm is activated, the LED flashes and the buzzer sounds; if normal, the temperature and humidity are continued to be measured.
In the temperature and humidity measurement module of this system, the I2C port of the SHT11 chip is connected to the general I/O port of the MSP430 microcontroller to transmit data commands. The temperature and humidity measurement program is placed in the interrupt service program of the timer. After the system automatically determines the event, it calls the "write" command subroutine, "read" command subroutine, numerical calculation subroutine and display subroutine, and finally stores the actual temperature and humidity values in two fixed storage units, with temperature and humidity occupying one unit each.
3 System Testing and Analysis
In order to verify the correctness of the temperature and humidity displayed by SHT11, an alarm clock that can display temperature and humidity is placed next to hot water heated to a certain temperature with this system, and the reading changes are observed and recorded. Table 1 is a comparison of the temperature and humidity recording results monitored by the alarm clock and this system.
Parameters of temperature and humidity alarm clock:
Temperature measurement range: -20℃~ +60℃
Temperature and humidity measurement accuracy: ±1.0℃ (15℃~30℃)
±5%RH (40%RH ~ 80%RH)
Temperature resolution: 0.1℃
Humidity measurement range: 10%RH ~ 99%RH
Humidity resolution: 1%RH
From the experimental results, it can be seen that the temperature value measured by the system is very close to the value displayed by the alarm clock, while the relative temperature has an error of about 1% to 2% with the displayed value of the alarm clock, but it is within the error range of the measurement accuracy of the temperature and humidity alarm clock. When using two different instruments to measure temperature and humidity, this system displays the current temperature and humidity in real time and can obtain real-time values more quickly, while the temperature and humidity alarm clock requires 5s of sampling and refreshing, so it takes a longer time for the system to obtain the current temperature and humidity, and the measurement data is not as accurate as this system.
4 Conclusion
This design improves on the traditional temperature and humidity monitoring and alarm system and designs a low-power temperature and humidity monitoring system. Through software and hardware testing, it is proved that the system can operate safely and reliably with small measurement errors and good application effects.
Previous article:Application of AT45DB021B in power parameter monitoring
Next article:Design of portable weather instrument based on MSP430 microcontroller
Recommended ReadingLatest update time:2024-11-17 05:42
- Popular Resources
- Popular amplifiers
- 100 Examples of Microcontroller C Language Applications (with CD-ROM, 3rd Edition) (Wang Huiliang, Wang Dongfeng, Dong Guanqiang)
- MSP430 series single chip microcomputer system engineering design and practice
- oled multi-chip calling program
- Microcontroller Principles and Applications Tutorial (2nd Edition) (Zhang Yuanliang)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- Rambus Launches Industry's First HBM 4 Controller IP: What Are the Technical Details Behind It?
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- [Shanghai Hangxin ACM32F070 development board + touch function evaluation board] 01. Basic engineering & KEY & LED & BUZZER & SHELL
- Complain about the search engine you currently use...
- KiCad 5.1.7 was officially released on September 30th
- C2000 Real-time Control MCU Application in Electric Vehicles
- Qorvo's Zhou Ting: Towards an ideal ultra-broadband provider
- TMS320C6000 C/C++ Runtime Environment
- I still don't understand the problem of using PNP npn as a switch. 8050 is used as a switch and it keeps turning on and off.
- Msp430 learning notes interrupt processing function
- "It's OK as long as it works, what else do you need?" ST Industry Summit 2019 answer sheet completed and sent a mouse disassembly diagram
- Smart electric car seesaw