Today we will talk about a new module DHT11 - temperature and humidity sensor
As the name suggests, it is a very practical and interesting module that can detect temperature and humidity through the development of DHT11. Let's first understand the basic information of DHT11 and then develop it.
Advantages of DHT11:
► Relative humidity and temperature measurement
►Full calibration, digital output
►Excellent long-term stability
►No additional parts required
►Long signal transmission distance
►Ultra low power consumption
►4 pin mount
►Completely interchangeable
Application field
►HVAC
►Test and testing equipment
►Car
►Data logger
► Consumer goods
►Automatic control
►Weather station
►Home appliances
►Humidity regulator
►Medical
►Dehumidification
Let's look at the DHT11 manual first
Detect the presence of DHT11?
Encapsulate a DHT11_Check function according to the code
After a delay of 20-40us, read the response signal of DHT11. After the host sends the start signal, it can switch to the input mode, or output high level, and the bus is pulled high by the pull-up resistor.
The program is programmed as follows:
After that, we start to read the data, which is nothing more than two kinds of data 1 or 0, and judge whether the corresponding time is high level or low level according to the timing diagram.
Write the program according to the diagram. Before writing the program, we need to know:
We can find that after the last bit of data is transmitted, it will enter the idle state, so we have to re-enter the high-speed mode
At this point, the separate development of DHT11 has ended, and we can transfer the obtained data to the PC or LCD in the future.
*Attach the complete program:
------------pending upgrade------------