Global high-mix volume high-speed PCBA manufacturer
9:00 -18:00, Mon. - Fri. (GMT+8)
9:00 -12:00, Sat. (GMT+8)
(Except Chinese public holidays)
HomePage > Blog > Knowledge Base > DHT11 vs DHT22: Which Arduino Temperature and Humidity Sensor Is Better?
Selecting appropriate sensors remains essential during Arduino project development because it determines both accuracy and system functionality. The temperature and humidity sensor category features two main products: DHT11 and DHT22. These sensors are extensively used in diverse applications, including home automation systems and weather stations, because they offer cost-effective solutions and straightforward operation.
The initial similarity between these sensors masks fundamental differences that influence your project performance. This blog has got you covered. You’ll get a clear, simple comparison of DHT11 vs DHT22. The information will assist you in picking the sensor that best matches your requirements.
DHT stands for Digital Humidity and Temperature. These modules have two main jobs:
• Measure temperature
• Measure humidity
DHT sensors operate using simple internal components. Inside each sensor, a capacitive humidity sensor and a thermistor measure environmental conditions. These measurements are processed by an onboard chip, which outputs the data as a digital signal.
Internally, the sensor processes analog signals. But it converts them to digital data before sending them to your Arduino—saving you from messing with ADCs or signal filtering. That’s why beginners love them. Additionally, you only need one wire to get the data. This makes DHT sensors perfect for projects with limited pins.
You’ll see them used in:
• Weather stations
• Greenhouse monitoring
• Smart thermostats
• IoT projects
There are two main types: DHT11 and DHT22. Here's a closer look at each.
Humidity sensors measure how much water vapor is in the air. They don’t detect water droplets directly. Instead, they detect how moisture affects electrical properties.
There are a few types, but the DHT11 and DHT22 both use capacitive sensing. Here's how it works:
• Inside the sensor is a tiny layer of moisture-absorbing material (usually a polymer or ceramic).
• This layer lies between two electrodes, like a basic capacitor.
• As humidity increases, more water vapor gets absorbed.
• The material’s capacitance changes and the sensor notices this shift.
• That change is converted into a digital humidity value.
They also include a built-in thermistor to read the temperature. This matters because warm air holds more moisture than cold air. So, the sensor adjusts for that automatically.
Here’s what makes capacitive sensors (like DHTs) a good choice:
• Stable readings over time.
• Low power consumption.
• Compact size, perfect for embedded systems.
• Easy digital output — no ADC required on your Arduino.
Capacitive humidity sensors don't directly "sense" water droplets. Instead, they respond to changes in the dielectric constant caused by moisture in the air. That shift alters the capacitor's value, which the sensor's chip interprets. These sensors are factory-calibrated, meaning you don't need to manually tweak their response curve.
Other sensor types exist, like resistive or thermal, but for most hobby and IoT projects, capacitive sensors are the sweet spot.
Let’s start with the cheaper one. The DHT11 is a basic Arduino humidity sensor that's widely used for beginner projects. It’s a great choice if your project doesn’t need super accuracy.
Here’s what it offers:
• Temp range: 0°C to 50°C
• Humidity range: 20% to 90%
• Temp accuracy: ±2°C
• Humidity accuracy: ±5%
• Sampling rate: 1 reading per second
• Voltage: 3.3V to 5V
• Output: Digital signal
It’s fast enough for most indoor projects. You can get readings every second. That’s more than enough for a room sensor.
The module is simple. Usually, you get a blue module with 3 or 4 pins. The DHT11 pinout is straightforward:
• VCC
• Data
• NC
• GND
The pull-up resistor on the data line is required. Otherwise, your readings might be unreliable. However, DHT11 has limits. It struggles in cold environments and won't function properly below 0°C. Additionally, if your project requires temperature accuracy better than ±2°C, the DHT11 may not be suitable.
Use cases:
• Home sensors
• School projects
• Basic Arduino displays
It’s also not ideal for outdoor or long-term setups. It has limited calibration accuracy, especially near-range extremes. It can get unstable with time and high moisture exposure.
Time is money in your projects – and PCBasic gets it. PCBasic is a PCB assembly company that delivers fast, flawless results every time. Our comprehensive PCB assembly services include expert engineering support at every step, ensuring top quality in every board. As a leading PCB assembly manufacturer, we provide a one-stop solution that streamlines your supply chain. Partner with our advanced PCB prototype factory for quick turnarounds and superior results you can trust.
DHT22 is more advanced. It offers improved accuracy, a broader operating range, and is better suited for applications that require more reliable data.
Specifications:
• Temp range: -40°C to 80°C
• Humidity range: 0% to 100%
• Temp accuracy: ±0.5°C
• Humidity accuracy: ±2% to 5%
• Sampling rate: Every 2 seconds
• Voltage: 3V to 6V
• Output: 16-bit digital data
At first glance, that 2-second delay might seem slow. However, for most monitoring applications, it’s fine. You rarely need data every second. Unlike DHT11, this one works in freezing conditions. This capability is crucial for weather stations.
DHT22 is slightly larger in size compared to the DHT11. Usually comes in a white casing. You'll find pre-soldered modules that are easy to plug into breadboards or headers. Moreover, DHT22 is slightly more sensitive to interference over long cables due to its slower communication protocol.
Thinking about the drawbacks? The DHT22 does come at a slightly higher cost. It’s also more sensitive to wiring quality—long cables that can introduce signal issues unless you use shielded wires or include capacitors for stability.
Use cases:
• Weather systems
• Smart farming
• HVAC control
• Industrial sensors
In short: if accuracy matters, go DHT22. If budget matters, stick with DHT11.
Let’s compare the two directly. Here’s a quick table to make things clearer:
Feature |
DHT11 |
DHT22 (AM2302) |
Temperature Range |
0°C to 50°C |
-40°C to 80°C |
Humidity Range |
20% to 90% RH |
0% to 100% RH |
Temperature Accuracy |
±2°C |
±0.5°C |
Humidity Accuracy |
±5% RH |
±2% RH |
Sampling Rate |
1 Hz (1 reading/sec) |
0.5 Hz (1 reading/2 sec) |
Power Supply |
3.3V to 5.5V |
3.3V to 6V |
Signal Output |
Digital (single wire) |
Digital (single wire) |
Price |
Lower |
Slightly higher |
Size |
Smaller |
Larger |
Now, let’s talk about real-world use.
• Accuracy: DHT22 wins by far. If you need precise environmental readings, don’t compromise.
• Range: Again, DHT22. It can read freezing temperatures and 100% humidity. DHT11 just can’t.
• Price: DHT11 is cheaper. If you're building multiple sensors for a classroom or a hobby project, it's a cost-saver.
• Speed: DHT11 sends data every second. DHT22 sends it every two. But in most applications, that 1-second delay isn’t noticeable.
• Durability: DHT22 tends to last longer in harsh conditions.
If you're asking yourself “what’s the best humidity sensor for Arduino?”—well, it depends. For projects that require higher accuracy and reliability, particularly in outdoor or extreme conditions, the DHT22 is the better choice. For fast prototyping and basic use, DHT11 is enough.
Both sensors connect to Arduino in the same way.
You’ll need:
• A DHT11 or DHT22 sensor
• Arduino board (Uno, Nano, etc.)
• Jumper wires
• A 10k ohm pull-up resistor (important!)
DHT11 pinout and DHT22 pinout are usually:
1. VCC
2. Data
3. NC (Not Connected)
4. GND
Some modules only have 3 pins. That’s fine. In some modules, the third pin (NC) may be omitted, leaving only VCC, Data, and GND.
Step-by-step setup:
• Connect VCC to 5V on Arduino (3.3V also works)
• Connect GND to GND
• Connect the Data pin to any digital pin (e.g., D2)
• Place a 10k resistor between VCC and Data (pull-up)
Then, install the DHT library using Adafruit. Open the Arduino IDE. Go to:
Sketch → Include Library → Manage Libraries → Search "DHT" → Install “DHT sensor library” by Adafruit
Once installed, go to:
File → Examples → DHT Sensor Library → DHT tester
Pick your sensor type:
#define DHTTYPE DHT11 // or DHT22
Upload the code and open the Serial Monitor. You’ll start seeing temperature and humidity values printed.
Here are the common issues and their solutions.
Issue |
Possible Cause |
Suggested Fix |
No readings |
Missing or incorrect pull-up resistor |
Check that a 10kΩ resistor is properly connected between VCC and the data line. |
NaN (Not a Number) |
Wrong pin or incorrect sensor type defined in the code |
Verify the pin number and make sure #define DHTTYPE DHT11 or DHT22 matches your sensor |
Unstable with long wires |
Signal degradation due to cable length |
Use a capacitor across VCC and GND, or switch to shielded cables |
These sensors are beginner-friendly. You’ll get them working in under 5 minutes if wired right.
DHT11 vs DHT22 — which one should you choose? If you're experimenting or learning the basics, DHT11 is affordable and straightforward, making it ideal for beginners. However, it comes with limitations: reduced accuracy, a narrower measurement range, and poor performance in cold environments.
DHT22, on the other hand, is for those who want better performance. It’s more accurate. Handles extreme conditions. Costs a bit more, but not by much.
If your project involves monitoring plants, smart homes, outdoor stations or precise climate control, then go with DHT22. It's worth it. But if it’s a school demo or weekend build? DHT11 will do the job.
The best part is that both work seamlessly with Arduino. Once connected, you simply upload the code and start monitoring. Now that you understand their differences, you can pick the right sensor for your project. Whether you want to measure humidity in a greenhouse or log temperatures in your garage, you've got the tools.
Assembly Enquiry
Instant Quote