Code360 powered by Coding Ninjas X Code360 powered by Coding Ninjas X
Table of contents
What are DHT temperature sensors?
Types of DHT sensors
Features of DHT11
Features of DHT22
Working of DHT sensors
Difference between DHT11 and DHT22
Which one is better?
Frequently asked questions
What is DHT in IoT?
How do DHT sensors work?
How do DHT11 Sensors send data?
Last Updated: Mar 27, 2024

DHT based temperature sensing

Author Tashmit
0 upvote
Master Python: Predicting weather forecasts
Ashwin Goyal
Product Manager @


Humidity is the amount of water vapor in the air. Humidity in the atmosphere impacts a variety of physical, chemical, and biological processes. Humidity in industrial settings can have an impact on product costs, as well as staff health and safety. As a result, humidity measurement is critical in semiconductor and control system industries. The amount of moisture in a gas, a mixture of water vapor, nitrogen, argon, or pure gas, is determined by humidity measurement. Humidity sensors are categorised into two categories based on the measuring units. A relative humidity sensor and an absolute humidity sensor are the two types of humidity sensors. The DHT11 is a temperature and humidity sensor that is digital.

What are DHT temperature sensors?

The Digital Humidity and temperature sensors are:

  • Great tools for hobbyists.
  • Mainly consisting of two parts.
  • A capacitive humidity sensor and a thermistor.

It is working on a trivial chip that converts analog to digital conversion pushing an output of a digital signal with temperature and humidity.

It is a trite device, reasonably easy to use, and reads digital readings from any microcontroller.

Get the tech career you deserve, faster!
Connect with our expert counsellors to understand how to hack your way to success
User rating 4.7/5
1:1 doubt support
95% placement record
Akash Pal
Senior Software Engineer
326% Hike After Job Bootcamp
Himanshu Gusain
Programmer Analyst
32 LPA After Job Bootcamp
After Job

Types of DHT sensors

There are mainly two types of DHT sensors. 


The DHT11 is an essential digital temperature and humidity sensor at an economical price.

It measures the surrounding air with a capacitive humidity sensor and a thermistor while producing a digital signal output on the data pin. 

It's pretty simple to use, and a sought-after device for amateurs and hobbyists, but data collection needs careful scheduling ahead. 

One major negative of this particular sensor is that it collects new data periodically every 2 seconds,

so the values can be 2 seconds older while using our library.

Source: Link

Features of DHT11

  • Ultra-low-cost
  • 3 to 5V power and I/O
  • 2.5mA max current use during conversion.
  • Suitable for 20-80% humidity readings with 5% accuracy.
  • Suitable for 0-50°C temperature readings with a ±2°C accuracy.
  • No more than 1 Hz sampling rate (once every second)
  • Four pins with 0.1" spacing


In DHT22 ,a capacitive humidity sensor and a high precision temperature sensor are included, which is also known as RHT03 or AM2302.

To achieve high dependability and long-term stability, it employs specialised digital module acquisition technology as well as temperature and humidity sensor technology.

A capacitive sensor element and a high-precision temperature measuring portion are also included in the DHT22, which is paired to a high-performance 8-bit microprocessor.

As a result, it offers great quality, ultra-quick response, powerful anti-interference capability, and high cost performance.



Source: Link

Features of DHT22

  • Low cost
  • 3 to 5V power and I/O
  • 2.5mA is the max current used during conversion (while requesting data)
  • Good for 0-100% humidity readings with a 2-5% accuracy.
  • Good for -40 to 80°C temperature readings with a ±0.5°C accuracy
  • No more than 0.5 Hz sampling rate (once every 2 seconds)
  • 4 pins with 0.1" spacing (i.e. exactly similar).

Working of DHT sensors

The working of the sensors is quite easy to understand. They consist of humidity sensing components, a thermistor, and an IC on the back of the sensor.

For humidity, it uses the humidity sensing component which has two electrodes with moisture holding substrate between them. 

As the humidity changes, the substrate's conductivity or the resistance between these electrodes changes as well.

The IC measures and processes the change in resistance, preparing it for reading by a microcontroller.

These sensors, on the other hand, measure temperature via an NTC temperature sensor or a thermistor.

A thermistor is a variable resistor that changes resistance in response to temperature variations.

To give bigger variations in resistance with just slight changes in temperature, these sensors are created by sintering materials such as ceramics or polymers.

The word "NTC" stands for "Negative Temperature Coefficient," which signifies that resistance lowers as temperature rises.

You can also read 8051 Microcontroller Pin Diagram here.

Difference between DHT11 and DHT22

The DHT22 is the costlier version with some better specifications. Its temperature measuring range is between -40 to +125 degrees Celsius with a plus-minus 0.5-degree accuracy, while on the other hand, the DHT11 temperature measuring range is from 0 to 50 degrees Celsius with +-2 degrees accuracy.

There are two different variations of the DHT sensor, they look a bit similar and even have the same pinout, but at the same time have different characteristics. 

Here are the specs:

Which one is better?

As observed in the above comparison we can comprehend that The DHT22 is a little more accurate and more efficient over a slightly larger range,

Since both use a single digital pin and are quite slow and in that you can't query them more than once every second or two. The DHT22 outperforms the DHT11 in major aspects from temperature range, temperature accuracy, humidity range, and humidity accuracy.

The only downside of the DHT22 is, of course, the slightly higher price but you are paying for the better specs.

Therefore, if you want a sensor with a wider range and accuracy, go for the DHT22. If not, the DHT11 should work fine for your projects as well.

Overall, these DHT sensors are basic and slow temperature and humidity sensors that are suitable for beginners and hobbyists looking to do basic data logging. 

They both use a single digital pin and are a little slow where you can’t query them more than once every second.

Frequently asked questions

What is DHT in IoT?

For prototypes monitoring, the ambient humidity and temperature of a specified area, the DHT11 is a regularly used temperature and humidity sensor.

How do DHT sensors work?

It needs a capacitive humidity sensor and a thermistor to monitor the ambient air and delivers a digital signal on the data pin. Although it is simple to use, data collection requires careful planning.

How do DHT11 Sensors send data?

DHT11 switches from low-power consumption to operating mode when MCU delivers a start signal, waiting for MCU to complete the start signal. DHT11 provides a response signal to MCU with 40-bit data that includes relative humidity and temperature information after it's finished.


This article extensively discussed DHT sensors, DHT11 and DHT22 sensors, their working, and other features. We hope that this blog has helped you enhance your knowledge regarding DHT sensors and if you would like to learn more, check out our articles here. Do upvote our blog to help other ninjas grow. 

To enhance your knowledge you must visit Interview ExperienceSQLinterview prepBasics of Python, and  Coding mock test series. You can also practice at the Code studio test seriesCode Studio Interview ExperienceInterview BundleSQL problems

Happy Coding!

Previous article
Light Dependent Resistors (LDRs)
Next article
BMP Pressure Sensing
Live masterclass