Introduction to DHT11
Hello Friends, I hope you all are fine and will be doing well in your life. In today's tutorial, I am going to give you a detailed Introduction to DHT11. It is an embedded sensor used to measure temperature & humidity in the surroundings and gives calibrated digital output. It can measure temperature in the range of 0°C to 50°C with ±2°C accuracy. Its humidity range is from 20% to 80% with ±5% accuracy. It is a small, low cost and easy-to-interface embedded sensor.
In this tutorial, I will explain its working, pinout, protocol and interfacing with other microcontrollers in detail.
- Here are a few important features of DHT11, given in the below table:
DHT11 Features & Specs |
No. |
Parameter |
Value |
1 |
Measures |
Humidity & Temperature |
2 |
Sensors Included |
Capacitive Humidity Sensor & Thermistor |
3 |
Humidity Range |
20% to 80% with ±5% accuracy |
4 |
Temperature Range |
0°C to 50°C with ±2°C accuracy |
5 |
Package |
4 Pins in a single row |
6 |
Operating Voltage |
3.0V to 5.5V |
7 |
Operating Current |
0.3mA(measuring), 60uA(idle) |
8 |
Resolution |
1°C, 1%RH (8-Bit) |
9 |
Response Time |
6s-15s |
10 |
Repeatability |
±1°C, ±1%RH |
11 |
Sampling Frequency |
1Hz |
12 |
Dimensions |
27mm x 59mm x 13.5mm (1.05" x 2.32" x 0.53") |
So, let's start with the Introduction to DHT11:
Where To Buy? |
---|
No. | Components | Distributor | Link To Buy |
1 | DHT11 | Amazon | Buy Now |
Introduction to DHT11
- DHT11 is a low-cost, small-sized & easy-to-operate embedded sensor, consisting of 4 pins, used to measure Temperature(0°C to 50°C with ±2°C accuracy
) & Relative Humidity
(20% to 80% with ±5% accuracy
) and provides calibrated digital output.
- DHT11 Pinout consists of 4 Pins in total, listed below from left to right:
- Vcc: Need to provide +5V at this pinout.
- Data: It's the digital output pin, that gives either 0V or 5V.
- NC: Not Connected. (It's left open for future design)
- GND: Need to provide Ground at this pinout.
- DHT11 has a Capacitive Sensor
for measuring humidity & NTC Thermistor
for temperature sensing. (We will cover them in detail below)
- It comes in a single package comprising of 4 pins with 0.1" spacing
between them and a special package can be provided according to user demand.
- DHT11 updates the output value once every 2 seconds.
- Small-size, low-cost, precise & calibrated output and up to 20 meters signal transmission
stand it out from other sensors.
- DHT11 uses a single-wire serial interface
for data processing.
- It calibrates the humidity using humidity coefficients, which are stored in the OTP program memory
of the built-in controller.
- Its operating voltage is 3V to 5.5V, so it works with both 3.3V and 5V microcontroller systems.
- It has a sampling frequency of 1Hz, so it samples the data after every 1sec.
- DHT11 has a dimension of 27mm x 59mm x 13.5mm (1.05" x 2.32" x 0.53"), so it is very small and can easily be placed in autonomous embedded projects.
- It is quite accurate & precise in its readings as compared to other expensive sensors i.e. SHT10, DS18B20 etc.
We have discussed the basic features of our Moisture sensor DHT11. Now, let's have a look at DHT11 Pinout and description:
DHT11 Pinout & Description
- DHT11 Pinout consists of 4 Pins in total, which are shown in the below table:
Pin# |
Type |
Parameters |
Pin#1 |
Vcc |
Provide 3.3V to 5V at this pin. |
Pin#2 |
Data |
This pin provides a digital output. |
Pin#3 |
N/C |
Not Connected. |
Pin#4 |
Ground |
This pin is used for Ground ( Connected to 0V or GND ). |
- For better understanding let's check its picture, given below:
Now, we will discuss the DHT11 working principle in detail:
DHT11 Working Principle
- Now, let's understand the working principle of the DHT11 temperature & humidity sensor.
- As we have discussed earlier, it has two sensors inside it, so let's have a look at both of them separately:
DHT11 Temperature Sensing
- For temperature sensing, it has an NTC(Negative Temperature Coefficient) temperature sensor
(also called a thermistor
) mounted on the surface inside the plastic casing.
- NTC temperature sensors are variable resistive sensors
and their resistance decreases with an increase in the surrounding temperature.
- Thermistors are designed with the sintering of semiconductor
materials, such as ceramic or polymers and they provide a large change
in resistor with a small temperature change.
- Here's the graph showing the relation between temperature and resistance
for the DHT11 sensor:
Now, let's discuss the Humidity Measurement of DHT11:
DHT11 Humidity Measurement
- For Humidity Measurement, it uses a capacitive humidity sensor, which has two electrodes and a substrate
material in between.
- The substrate material is used for holding the moisture
on its surface.
- As moisture content changes in our environment, they get saturated on the substrate material, which in turn changes the resistance between electrodes.
- This change in electrode resistivity is then calibrated using the humidity coefficient
(saved in OTP memory) and the final relative humidity value is released.
- Here's the image showing the internal structure of the DHT11 humidity sensor:
Now let's discuss the communication Protocol of the DHT11 temperature & humidity sensor:
DHT11 Communication Protocol
- DHT11 sensor uses a single-wire, two-way Serial Protocol
for communicating with third-party peripherals normally microcontrollers.
- We call it single-wire
because the communication is performed through a single pin.
- It's two-way
because DHT11 receives commands from the microcontroller and then responds required data.
- Data sent by the DHT11 sensor is 40 bits
and it sends Higher Data Bits
first.
- Data contains both Integral and decimal values
of temperature and relative humidity along with a checksum value.
DHT11 Data Format
- DHT11 sends the 40Bit serial data in the below format:
- 8-Bit Humidity(Integral)
- 8-Bit Humidity(Decimal)
- 8-Bit Temperature(Integral)
- 8-Bit Temperature(Decimal)
- 8-Bit Checksum
- If DHT11 is sending the correct data, then it must send an 8-bit Checksum data at the end.
DHT11 Communication with Microcontroller
- The circuit diagram
to interface DHT11 with the microcontroller
is shown in the below figure:
- A pull-up resistance of 5k ohm
is recommended to place at the Data Pin of the DHT11 sensor.
- At normal conditions, the data pin of DHT11 remains at the HIGH voltage level
and the sensor remains in low power consumption mode.
- To receive data from the DHT11 sensor, the microcontroller should make the Data Pin low for at least 18us, so that the sensor could sense it.
- Once the DHT11 sensor senses the low signal at the Data Pin, it changes its state from low power consumption mode to running mode
and waits for the Data Pin to get HIGH.
- As the Data Pin gets HIGH
again by the microcontroller, DHT11 sends out the 40-bit calibrated output value serially.
- After sending the data, DHT11 returns to low power consumption mode and waits for the next command
from the microcontroller.
- The microcontroller has to wait for 20-40us
to get a response from the DHT11 sensor.
Applications of DHT11
Because of its small size, low cost and ability to sense two values, DHT11 has a wide range of applications:
- DHT11 is used in Home Automation Projects
to maintain constant atmospheric values by controlling the appliances(i.e. AC, Fan etc.) based on the sensor's readings.
- It is also used at weather stations
for temperature & humidity sensing.
- It is also used in automatic climate control
appliances.
- Environment monitoring devices
also utilize this sensor.
- Garden Monitoring Systems
also use DHT11 sensors.
So, that was all about the DHT11 temperature and humidity sensor. I have tried to cover this sensor from all angles. Let me know about your experience with the DHT11 sensor in the comments. Take care!!!