Application of Single Bus Sensor DHT11 in Temperature Temperature Control

Abstract: With the continuous development of science and technology, various types of electrical appliances such as automobiles, air conditioners, dehumidifiers, and dryers have entered people’s daily lives, and many of these electrical appliances are inseparable from environmental factors such as temperature and humidity. . Therefore, this article mainly introduces the application of single-bus sensor DHT11 in temperature temperature control. For reference.

With the continuous development of science and technology, various types of electrical appliances such as automobiles, air conditioners, dehumidifiers, and dryers have entered people's daily lives, and many of these electrical appliances are inseparable from the requirements of environmental factors such as temperature and humidity. Therefore, temperature and humidity sensors are becoming more and more widely used. The new generation of digital sensors no longer requires an external A/D conversion module, and has a standard interface. It is easy to use and has gained more and more applications. DHT11 as a new type of single-bus temperature and humidity digital sensor, has more advantages, it makes the system design more simple, easy to control and easy to implement.

1. Brief introduction of single-bus communication At present, the serial buses used for data transmission between the commonly used microcomputers and peripherals mainly include I2C bus, SPI bus and SCI bus. The I2C bus communicates in a synchronous serial two-wire mode (1 clock line, 1 data line), and the SPI bus communicates in a synchronous serial 3-wire mode (1 clock line, 1 data input line, 1 data line The output line), while the SCI bus communicates asynchronously (1 data input line, 1 data output line). These buses require at least two or more signal lines. In recent years, the United States Dallas Semiconductor has introduced a unique 1-wire Bus technology. This technique is different from the above bus. It adopts a single signal line, which can transmit clocks and data, and the data transmission is bidirectional. Therefore, this single-bus technology has the advantages of simple circuit, less hardware overhead, low cost, and easy bus extension and maintenance.

A single bus is suitable for single-master systems and can control one or more slave devices. The host can be a microcontroller and the slave is a single bus device. The data exchange between them is via only one signal line. When there is only one slave device, the system can operate as a single-node system; when there are multiple slave devices, the system operates as a multi-node system.

2. Main features and pin descriptions of DHT11 DHT11 digital temperature and humidity sensor recently introduced by Guangzhou Aosong Electronics Co., Ltd. is a temperature and humidity composite sensor with calibrated digital signal output. It applies a dedicated digital module acquisition technology and temperature and humidity sensing technology, with high reliability and stability. The DHT11 sensor includes a resistive moisture sensing element and an NTC temperature measuring element, and is connected to a high performance 8-bit microcontroller. The single-wire serial interface makes the system connection more concise. Very low power consumption, signal transmission distance up to 20m or more. As a new type of single-bus digital temperature and humidity sensor, DHT11 has the advantages of small size, low power consumption, fast response speed, strong anti-interference ability, simple control and high cost performance. It can be widely used in various fields. The basic indicators are as follows:

â—†Temperature and humidity composite sensors;

â—† full scale calibration, single-line digital output;

â—† Humidity measurement range is 20% ~ 90% RH;

◆Temperature measurement range is 0~+50°C;

◆Humidity measurement accuracy is ±5.0%RH;

◆Temperature measurement accuracy is ±1.0°C;

â—† Response time <5s;

â—†Low power consumption;

â—†Long signal transmission distance;

â—† Excellent long-term stability;

â—† ultra-small size.

The DHT11 is available in a 4-pin single row pin package with convenient circuit connections. Pin descriptions are listed in Table 1.

DATA is a serial bidirectional interface for communication and synchronization between the microprocessor and the DHT11, using a single-bus data format. Each communication transmits 40-bit data in the first-in-first-out order, which takes about 4ms. The data format is:

8-bit humidity integer data + 8-bit humidity decimal data + 8-bit temperature integer data + 8-bit temperature decimal data + 8-bit checksum data data The fractional part and the integer part, the current fractional part is used for later expansion, and is now read as zero.

When the data transmission is correct, the checksum data is equal to the last 8 bits of the result of “8-bit humidity integer data + 8-bit humidity decimal data + 8-bit temperature integer data + 8-bit temperature decimal data”.

3. The circuit connection between the typical application circuit DHT11 and the microprocessor is very simple. The typical application circuit is shown in Figure 1.

A 5kΩ pull-up resistor can be used when the data line length is shorter than 20m. When the data line length is shorter than 20m, a suitable pull-up resistor can be used according to the actual situation.

After the MCU sends a start signal, the DHT11 switches from low-power mode to high-speed mode. After waiting for the start of the host signal, the DHT11 sends a response signal, sends 40-bit measurement data, and triggers a signal acquisition. The user can select to read some data. . The DHT11 receives a start signal to trigger a temperature and humidity acquisition. If no host sends a start signal, the DHT11 will not actively perform temperature and humidity acquisition. Collect data and switch to low speed mode.

4. Timing Description The communication process is very simple, as shown in Figure 2 (in Figure 2-5, the solid line is the host signal, and the dotted line is the DHT signal). First, the host computer (microprocessor) sends a start signal on the data line, and the DHT11 responds with a response after detecting the signal, and pulls up the data line level to start sending the measured data to the host. After the data is sent, release the bus.

Detailed timing is shown in Figure 3. The bus idle state is high. When the DHT11 measurement data needs to be read, the host first pulls the bus low for more than 18ms. This is the start signal from the host. When the DHT 11 detects a start signal on the bus, a response signal of low level of 80 μs is transmitted after the host start signal ends. After the host sends the start signal and waits for 20 to 40 μs delay, it reads the DHT11 response signal from the bus. If the read response signal is high, the DHT11 is not responding. Check if the line is connected properly. If the bus is low, the DHT11 normally sends a response.

After the DHT11 sends a response signal, the bus is pulled high for 80 μs to prepare for data transmission. Each bit of data starts with a low-level time slot of 50μs. The duration of the high level distinguishes the data bit from 0 or 1. A high level of 26 to 28μs indicates 0, and a high level of 70μs indicates 1 (see the specific format shown in Figure 1). 4 and Figure 5). When the last bit of data has been transmitted, the DHT11 pulls the bus low for 50 μs, and then the bus is pulled high by the pull-up resistor into idle state.

The digital 0 signal representation method is shown in FIG. 4, and the digital 1 signal representation method is shown in FIG. 5.

The temperature and humidity reading subroutines are as follows:

5, DHT11-based warehouse temperature and humidity measurement and control system application example DHT11 has been successfully applied to the warehouse management and control system. As shown in FIG. 6 , the STC89C52RC processor is used to control the DHT11, a start signal is transmitted on the data line according to the timing of the DHT11, and the DHT11 measurement data is read from the data line. These data are analyzed and processed, sent all the way to the digital tube display, another way to the computer through the RS232 port. The measurement data can also be stored in the Flash in the microcontroller for future reference. If the measurement data shows that the current temperature and humidity in the library exceeds the temperature and humidity range set by the warehouse, the SFC89C52RC microcontroller will generate an alarm signal. The alarm signal triggers an alarm in the alarm device, and the other control relay turns on the power of the dehumidifier and the air conditioner to adjust the temperature and humidity in the library. In this way, the DHT11 can effectively control the temperature and humidity of the warehouse and improve the management of the warehouse.

6. Conclusion The price of the DHT11 monolith on Taobao.com is only 7.8 yuan. The authors compared the measured data of the DHT11 with the DS18820 and some mercury temperature and humidity meters to verify the accuracy and stability of the DHT11 measurement data. Low price, small size, accurate and stable measurement data, simple single-bus control mode, and simple circuit connection will make DHT11 have a good application prospect.

Special Industrial Grease

Special Industrial Grease,Industrial Grease,Silicon Base Grease,Precision Machinery Grease

PUYANG XINYE SPECIAL LUBRICATING OIL AND GREASE CO.,LTD , https://www.specialgrease.com