Temperature and humidity detection system based on single chip microcomputer

Publisher:rocky96Latest update time:2022-04-25 Source: eefocus Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Abstract: Design a computer classroom temperature and humidity detection system to control the temperature and humidity of the computer room. The whole system uses STC89C51 microprocessor as the main control system. The hardware circuit mainly includes 51 single-chip microcomputer, DHT11 temperature and humidity sensor, display module, alarm and control equipment. Through the given upper and lower limits of temperature and humidity and displayed by 1602 LCD display, the signal measured by the sensor is displayed by LCD, and the LCD displays the real-time temperature and humidity values. When the temperature and humidity exceed the limit value, the buzzer sounds an alarm.


1 Overall solution structure


1.1 Overall design plan and its demonstration


The functions to be realized in this design are: real-time display of the current temperature and humidity, allowing users to set the upper and lower limits of temperature and humidity. When the ambient temperature and humidity exceed or fall below the limit, the system will sound an alarm with a buzzer and start the temperature control device. When the room reaches the normal range, the buzzer stops sounding, the temperature control device stops running, and the system works normally.


(1) Temperature detection: Measure the greenhouse temperature and reflect it on the display.
(2) Humidity detection: Measure the greenhouse humidity and reflect it on the display.
(3) Display: 1602 LCD display shows real-time temperature and humidity values.
Based on the function settings, this system is mainly divided into the following three modules:
(1) Temperature and humidity acquisition module
(2) Data processing module
(3) User interaction module


The temperature and humidity acquisition module uses the DHT11 digital temperature and humidity sensor, which uses a single bus, has a simple interface, and does not require additional calibration. The resolution is 8 bits, which can meet the detection requirements of daily environmental temperature and humidity.


The data processing module uses the STC89C51 microcontroller as the minimum system, which completes the functions of collecting, calculating and controlling the operation of temperature and humidity data.
The user interaction module is mainly composed of buttons, 1602 LCD, buzzer and control equipment. The buttons are used for users to set the limit values ​​of temperature and humidity, the 1602 LCD is used to display data, the buzzer is used to prompt users, and the control equipment is used to adjust and control the temperature and humidity that do not meet the requirements.


1.2 System Design Diagram


The C51 microcontroller is the main controller, responsible for processing the data transmitted by DHT11 and sending the processed data to the display module. The DHT11 temperature and humidity sensor is mainly used to collect the surrounding environmental parameters and send the collected data to the microcontroller. The key circuit is mainly used to complete the reset operation of the microcontroller and the setting of the temperature and humidity limit values. The buzzer circuit is implemented with a transistor to prompt whether the surrounding temperature or humidity exceeds the set value, and the control device waits for instructions. When the buzzer sounds and the temperature and humidity are not within the standard range, the control device starts automatically until the temperature and humidity are normal. The display circuit is mainly used to display the current temperature and humidity.

insert image description here

Figure 1-2-1 Schematic diagram of temperature and humidity monitoring system


2 System Hardware Design


2.1 Device Selection


When using a single-chip microcomputer as a measurement and control system, there must always be a measured signal input channel for the computer to pick up the necessary input information. For the measurement system, its core task is how to obtain accurate measured signals; and for the measurement and control system, the indispensable link is the monitoring of conditions and the testing of the state of the controlled object. The sensor is the first link to achieve measurement and control and is the key part of the measurement and control system. All accurate measurement and control will depend on the accurate and reliable conversion and capture of the original signal by the sensor. The automated measurement and control of industrial production processes basically relies on various sensors to control and detect various quantities in the production process, so that the system and equipment can operate normally in the best state, thereby ensuring high quality and high efficiency of production [2].


2.1.1 DHT11 Temperature and Humidity Sensor


DHT11 is a temperature and humidity sensor with calibrated digital signal output. Its accuracy is ±5%RH for humidity, ±2℃ for temperature, 20-90%RH for humidity, and 0~50℃ for temperature. The sensor includes a resistive humidity sensor and an NTC temperature sensor, and is connected to a high-performance 8-bit microcontroller. Therefore, the product has the advantages of excellent quality, ultra-fast response, strong anti-interference ability, and high cost performance. Each DHT11 sensor is calibrated in an extremely accurate humidity calibration room. The calibration coefficients are stored in the OTP memory in the form of a program. These calibration coefficients are called in the sensor during the processing of the detection signal. The single-wire serial interface [5] is used to make system integration simple and fast.

insert image description here

Figure 2-1-1 Packaging information

insert image description here


Two of the four pins are power pins, and one is the output data pin. You only need to supply the rated voltage to it, and the output pin can collect the signal. If the output signal is an analog quantity, it will be converted into a digital signal through the A/D chip and then transmitted to the microcontroller. DHT11 is a digital sensor and does not require analog-to-digital conversion.


2.1.2 1602 LCD display


Liquid Crystal Display (LCD) is a passive light-emitting, low-power display device. Since liquid crystal itself does not emit light, it only makes the molecules inside the liquid crystal arranged in order under the action of an external electric field, thereby changing the direction of light passing through these liquid crystal molecules. The light is then reflected and scattered by the bottom plate and finally enters people's field of vision. LCDs have the advantages of light weight, small size, low power consumption, and strong anti-interference ability. They are widely used in people's lives, instruments, control systems and other fields [3].


This design will use a dot matrix character type 1602 LCD display module.

insert image description here

insert image description here


Basic operation sequence
(1) Read status; input: RS=L, R/W=H, E=H; output: D0~D7 is the status word.
(2) Read data; input: RS=H, R/W=H, E=H; output: none.
(3) Write instruction; input: RS=L, R/W=L, E=H, D0D7 is the instruction code; output: D0D7 is data.
(4) Write data; input: RS=H, R/W=L, E=H, D0~D7 is data; output: none.

 

insert image description here
                                                        Figure 2-1-2 Dimensions

 

insert image description here

Figure 2-1-3 Display address mapping diagram of dot matrix character 1602 LCD display


The controller has an internal 80B RAM buffer, and the corresponding relationship is shown in Figure 2-1-2.
When writing display data to any of the addresses 00H0FH and 40H4FH in the figure, the LCD can display it immediately, but when writing to the addresses 10H27H or 50H67H, they must be moved into the displayable area through the screen shift instruction for normal display [4].


2.2 Main control system circuit and hardware modules


2.2.1 Introduction to STC89C51 MCU


The STC89C51 microcontroller is a new generation of high-speed, low-power, and super-anti-interference microcontroller launched by Macrocrystalline Technology. The instruction code is fully compatible with the traditional 8051 microcontroller, and 12 clocks/machine cycle and 6 clocks/machine cycle can be selected at will.


Its main features are as follows:
Operating voltage: 5.5V ~ 3.3V (5V MCU) / 3.8V ~ 2.0V (3V MCU)
Operating frequency range: 0 ~ 40MHz, equivalent to 0 ~ 80MHz of ordinary 8051, the actual operating frequency can reach 48MHz
User application space is 12K/10K/8K/6K/4K/2K bytes
On-chip integrated 512 bytes RAM
General I/O port (32), after reset: P1/P2/P3/P4 is quasi-bidirectional port/weak pull-up, P0 port is open drain output, when used as bus expansion, no pull-up resistor is needed, when used as I/O port, a pull-up resistor is needed.
ISP (in-system programmable) / IAP (in-application programmable), no special programmer or special emulator is required, user program can be directly downloaded through the serial port (RXD/P3.0, TXD/P3.1), and it can be completed in seconds One chip
has EEPROM function
and watchdog function
A total of 3 16-bit timers/counters. That is, timer T0, T1, T2
external interrupt 4 channels, falling edge interrupt or low level trigger circuit, Power Down mode can be triggered by external interrupt low level interrupt to wake up
the universal asynchronous serial port (UART), and timer software can also be used to achieve multiple UART
operating temperature range: -40 ~ +85 ℃ (industrial grade) / 0 ~ 75 ℃ (commercial grade)
PDIP package


2.2.2 MCU Minimum System

insert image description here

Figure 2-2-2 Minimum system schematic diagram


2.2.3 Reset circuit and crystal oscillator circuit


The detection system uses power-on reset. When a high level appears on the RST pin for more than two cycles, an internal reset will be triggered. The EA terminal here has nothing to do with the reset circuit. Since the data is stored in the internal memory, the EA terminal is directly pulled up to a high level.


Crystal oscillators are usually used in conjunction with phase-locked loop circuits to provide the clock frequency required by the system. The same crystal oscillator can be used in different phase-locked loops. The crystal oscillator circuit of the STC89C51 microcontroller uses a passive crystal oscillator, and the fine-tuning capacitor is 30pF.

[1] [2]
Reference address:Temperature and humidity detection system based on single chip microcomputer

Previous article:Design of electronic scale system based on single chip microcomputer
Next article:Design of traffic light system based on single chip microcomputer

Recommended posts

Introduction to RF Gain Blocks for Radio Range and Reliability
Radiofrequency(RF)PCBdesignhasmanyuncertaintiesinthecurrentlypublishedtheoriesandisoftendescribedasa"blackart".Generallyspeaking,forcircuitsbelowthemicrowavefrequencyband(includinglow-frequencyandlow-frequencydigi
灞波儿奔 RF/Wirelessly
[Telink's new generation of low-power, high-performance multi-protocol wireless kit B91 review] Home Assistant installation
HomeAssistantinstallation First,IwantedtoconnecttheB91totheInternet,butthemanufactureronlygavemeoneboard.Thiswasaheadacheforawhile,soIhadtodigouttheRaspberryPi4Iboughtbeforeandpreparetobuildtheo
damiaa Domestic Chip Exchange
CC3200LaunchPad modified infrared thermometer
CC3200LaunchPad,asshowninthepicture,Iwon'tcommentmuch,theperformanceandsoonshouldbeOK,buteveryoneknowsthecostperformanceof8266(especiallytheprice),generallypeopleuse8266whenplayingwithwifi.ThisCC3200LaunchP
Jacktang Wireless Connectivity
These are almost the only terms used to measure antennas.
AntennaBasics Let'sstartbylookingatantennasandantennabasics.Supposeonedayyouarewalkingdownthestreetandakindbutimpatientpersonrunsuptoyouandasksyoutodesignanantennaforthem."Sure",youquicklyrespond,adding"Wh
btty038 RF/Wirelessly
Broadband Matching Network_Huang Xiangfu《Scanned Version》
Downloaditandhavealook. Good,veryhelpful
btty038 RF/Wirelessly
【Beetle ESP32 C6 mini development board】--2.点亮LED
ThisarticledescribeshowtodrivetheLEDonthedevelopmentboard. 1.Understandtheprinciples TheuserLEDiscontrolledbytheGPIO15pinofESP32-C6-FH4andlightsupwhenthelevelishigh.Theschematicdiagramisasfollows Figu
dirty RF/Wirelessly
Latest Microcontroller 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号