Summary
DHT11 is a low-cost option for basic temperature and humidity monitoring, while DHT22 offers better accuracy and a wider measurement range. Compare their specifications, price, wiring, libraries, and use cases before choosing.
DHT11 is the better choice for low-cost projects where basic temperature and humidity readings are enough. DHT22 is worth the extra cost when you need a wider temperature and humidity range, better accuracy, and finer resolution. Both use a digital single-data-line interface and can work with Arduino, ESP32, and other microcontrollers.
DHT11 vs DHT22: Quick Comparison
| Feature | DHT11 | DHT22 |
|---|---|---|
| Temperature range | 0°C to 50°C | -40°C to 80°C |
| Temperature accuracy | ±2°C | ±0.5°C |
| Humidity range | 20–80% RH* | 0–100% RH |
| Humidity accuracy | ±5% RH | ±2–5% RH |
| Resolution | 1°C / 1% RH | 0.1°C / 0.1% RH |
| Maximum sampling rate | 1 reading/second | 1 reading/2 seconds |
| Output | Digital | Digital |
| Interface | Single data line | Single data line |
| Typical use | Basic monitoring, learning projects | Weather monitoring, IoT, applications needing better accuracy |
| Price | Lower | Higher |
*Specifications can vary between sensor modules and manufacturers. The commonly cited DHT11 operating range is 20–80% RH, while some modules specify a broader usable range.
What Is the Difference Between DHT11 and DHT22?
The main difference is measurement range and accuracy.
Both sensors measure temperature using a thermistor and humidity using a capacitive humidity element. They provide calibrated digital output through a data pin, so the microcontroller does not need to perform the analog-to-digital conversion itself.
DHT11 is designed as a basic, low-cost sensor. DHT22 provides a wider operating range, higher temperature accuracy, and finer resolution.
For a simple Arduino classroom project, DHT11 is usually sufficient. For environmental monitoring where measurement accuracy matters more, DHT22 is the better option.
DHT11 vs DHT22 Accuracy and Range
The difference becomes clear when comparing their specifications.
DHT11
- Temperature range: 0°C to 50°C
- Temperature accuracy: ±2°C
- Humidity range: approximately 20–80% RH
- Humidity accuracy: ±5% RH
- Resolution: approximately 1°C and 1% RH
DHT22
- Temperature range: -40°C to 80°C
- Temperature accuracy: ±0.5°C
- Humidity range: 0–100% RH
- Humidity accuracy: ±2–5% RH
- Resolution: 0.1°C and 0.1% RH
DHT22 therefore provides a much wider temperature range and better temperature accuracy than DHT11.
Which one is more accurate?
DHT22 is more accurate.
If your project needs to distinguish between 25.2°C and 25.8°C, DHT22 is more appropriate. If knowing that the room is approximately 25°C is enough, DHT11 can do the job.
DHT11 vs DHT22 Sampling Rate
Neither sensor is designed for high-speed temperature or humidity measurement.
DHT11 can generally be read at up to once per second, while DHT22 requires approximately two seconds between readings.
This matters for projects that continuously log environmental data.
For example:
- Room temperature display: DHT11 is sufficient.
- Weather station: DHT22 is generally preferable.
- Fast-changing industrial process: Neither is ideal; consider a faster sensor.
A higher sampling rate is not automatically better if the physical quantity being measured changes slowly. Temperature and humidity normally change much more slowly than motion or distance.
Is DHT22 Worth the Extra Cost?
DHT22 is worth the extra cost when you actually need its wider range or better accuracy.
Current Robocraze listings show a DHT11 module at around ₹59 and a DHT22 AM2302 module at around ₹104, although prices can change with product version and promotions. That means the DHT22 currently costs roughly ₹45 more in these listings.
For a project using several sensors, this difference can add up. If the project only needs basic room temperature and humidity readings, DHT11 can reduce the total component cost.
When Is DHT11 Good Enough?
Choose DHT11 when:
- Cost is the main consideration.
- You are building a beginner Arduino project.
- You only need approximate room temperature.
- The project operates within 0–50°C.
- ±2°C temperature accuracy is acceptable.
- ±5% RH humidity accuracy is acceptable.
- You are building a basic weather or environmental monitoring project.
- You are teaching students the basics of sensors and digital communication.
For example, an Arduino project that turns on a fan when the temperature exceeds 30°C does not necessarily need DHT22-level accuracy.
When Should You Choose DHT22?
Choose DHT22 when:
- You need better temperature accuracy.
- Your project operates below 0°C or above 50°C.
- Humidity readings need to cover a wider range.
- You need 0.1°C temperature resolution.
- You are building a more capable weather station.
- You are developing an IoT environmental monitoring system.
- The additional sensor cost is acceptable.
DHT11 vs DHT22 Wiring Differences
The basic wiring is similar for both sensors.
Both sensors use:
- VCC
- DATA
- NC
- GND
The sensor sends digital data through a single data line. Robocraze notes that the DHT22 uses a single-wire data connection, but it is not compatible with the Dallas 1-Wire protocol.
Basic connection
| Sensor pin | Arduino connection |
|---|---|
| VCC | 5V |
| DATA | Digital GPIO |
| NC | Leave unconnected |
| GND | GND |
Bare sensors generally require an appropriate pull-up resistor between VCC and the data line. Some breakout modules already include this resistor, so check the module before adding another one. Adafruit recommends a 4.7K–10K pull-up for its DHT sensors.
Are DHT11 and DHT22 wired the same way?
The basic wiring is similar, but always check the pinout of your specific module.
Sensor modules may arrange pins differently from the bare four-pin sensor package.
DHT11 vs DHT22 Library Setup
Both sensors can be used with popular Arduino libraries.
A commonly used approach is the DHT sensor library, where you specify the sensor type in the program.
For example:
#define DHTPIN 2
#define DHTTYPE DHT11
For DHT22:
#define DHTPIN 2
#define DHTTYPE DHT22
The rest of the program can remain largely similar because both sensors provide temperature and humidity through the same general library interface.
Adafruit provides an Arduino DHT library and examples for DHT sensors.
Important setup point
Do not set the wrong sensor type in your code.
If you physically connect a DHT22 but configure the library as DHT11, the readings may not work correctly.
DHT11 vs DHT22 for Arduino and ESP32
Both sensors can be used with common microcontrollers such as:
- Arduino Uno
- Arduino Mega
- ESP32
- ESP8266
- Raspberry Pi
However, always check the logic voltage and breakout-board specifications before connecting the sensor.
Many DHT11 and DHT22 modules support approximately 3.3–5V operation, but the exact voltage range depends on the module or sensor version. For example, the DHT22 datasheet specifies a 3.3–5.5V supply range.
This is especially important with ESP32, which uses 3.3V GPIO.
DHT11 vs DHT22: Which One Should You Buy?
Use this quick decision guide:
| Your requirement | Recommended sensor |
|---|---|
| Basic temperature and humidity project | DHT11 |
| Lowest possible cost | DHT11 |
| Beginner Arduino project | DHT11 |
| Classroom experiment | DHT11 |
| Better temperature accuracy | DHT22 |
| Wider temperature range | DHT22 |
| Wider humidity range | DHT22 |
| Weather station | DHT22 |
| IoT environmental monitoring | DHT22 |
| Temperature below 0°C | DHT22 |
Are There Better Alternatives to DHT11 and DHT22?
Yes. DHT11 and DHT22 are useful for basic projects, but newer sensors can offer better performance and interfaces.
SHT31
SHT31 is a digital temperature and humidity sensor with an I2C interface and higher accuracy than the traditional DHT family. It is a better option when measurement accuracy and a modern digital interface are priorities.
BME280
BME280 measures temperature, humidity, and atmospheric pressure. It is useful for weather stations, environmental monitoring and IoT projects where pressure data is also required.
Which should you choose?
- Low-cost basic project: DHT11
- Better accuracy and range: DHT22
- Higher-accuracy temperature/humidity sensing: SHT31
- Temperature + humidity + pressure: BME280
If the project only requires basic temperature and humidity readings, upgrading from DHT11 to DHT22 may be enough. For more advanced environmental sensing, newer sensors can offer better performance and communication options.
DHT11 vs DHT22: Final Verdict
Choose DHT11 when low cost and basic environmental monitoring are the priorities. Choose DHT22 when you need better accuracy, wider temperature and humidity ranges, and finer resolution.
For most beginner Arduino projects, DHT11 is enough. If you are building a weather station, IoT monitoring system, or any project where measurement accuracy matters, DHT22 is the better choice.
Excerpt
Frequently Asked Questions
What is the difference between DHT11 and DHT22?
DHT22 offers a wider temperature and humidity range, better temperature accuracy, and finer resolution than DHT11. DHT11 is cheaper and suitable for basic monitoring and learning projects. Adafruit Learning System
Is DHT22 worth the extra cost?
Yes, if you need better accuracy or a wider measurement range. If your project only requires approximate room temperature and humidity readings, DHT11 can provide better value.
How accurate is DHT11?
DHT11 is typically specified at ±2°C for temperature and ±5% RH for humidity within its specified operating range. Adafruit Learning System
Can I swap DHT11 for DHT22 without code changes?
The wiring and basic library setup are similar, but you must change the sensor type in your code from DHT11 to DHT22. You should also check the sensor's pinout and electrical specifications before replacing it.
DHT11 to DHT22. You should also check the sensor's pinout and electrical specifications before replacing it.