DHT22 Temperature & Humidity Sensor: Specs, Wiring & 8 Project Ideas

The DHT22 (AM2302) is the go-to digital temperature and humidity sensor for student IoT builds: -40 to +80°C at ±0.5°C and 0-100% RH at ±2%, on a single data wire. This guide covers the real specs, how the single-wire protocol works, Arduino wiring, the mistakes that cause NaN readings, and 8 project ideas linked to real buildable projectech.in listings.

Written by Projectech9 min readPublished
For B.E./B.Tech Electronics, E&TC and IoT final-year students planning temperature and humidity sensing projects Topics: DHT22, AM2302, Arduino Uno, ESP32, Temperature Sensor, Humidity Sensor
Blueprint-style illustration of a DHT22 temperature and humidity sensor module on a dark navy grid.
In this guide

Every hostel room in India has the same argument: is it actually humid, or does it just feel humid? Settle it with a sensor the size of a postage stamp. The DHT22 reads both temperature and humidity on a single digital pin, costs less than a canteen lunch, and shows up in a surprising number of serious final-year projects — weather stations, incubators, greenhouses, poultry controllers.

This guide covers what the DHT22 really is, how its single-wire protocol works, the exact specifications, wiring for Arduino Uno, the five mistakes that ruin DHT22 readings, and eight project ideas — each linked to a real projectech.in listing that uses this sensor.

What is the DHT22?

The DHT22 (also sold as the AM2302) is a digital temperature and humidity sensor. Inside its small plastic housing sit a capacitive humidity sensing element and a thermistor, plus a tiny chip that converts both into a digital reading you fetch over a single data wire. You connect power, ground, and one data pin — no analog calibration, no ADC math.

What it is NOT: it is not a precision instrument. At ±0.5°C and ±2% RH it is good enough for weather logging, incubators, and room control, but not for laboratory calibration work. It is also not fast — the sensor needs up to 2 seconds between readings, so forget real-time control loops.

  • Temperature range: −40°C to +80°C, ±0.5°C accuracy
  • Humidity range: 0–100% RH, ±2% RH accuracy
  • Supply voltage: 3.3V to 5.5V — works with both Arduino and ESP32 logic
  • Protocol: single-wire digital (one data pin, not I2C, not SPI)
  • Sampling limit: at most one reading every 2 seconds
  • Upgrade over DHT11: the DHT11 manages only ±2°C and 20–80% RH — the DHT22 is meaningfully better on both axes

How the DHT22 works

The sensor does all the analog work internally and hands you clean digital numbers. The exchange between your microcontroller and the sensor goes like this:

  1. The microcontroller wakes the sensor. Your code pulls the data line LOW for at least 1 ms (the start signal), then releases it. The DHT22, which idles in low-power sleep, wakes up.
  2. The sensor acknowledges. The DHT22 pulls the line LOW for about 80 µs, then HIGH for 80 µs — a handshake that says it is ready to transmit.
  3. 40 bits stream out. The sensor sends 5 bytes: humidity high byte, humidity low byte, temperature high byte, temperature low byte, and a checksum byte. Each bit is encoded in the length of a HIGH pulse — roughly 26–28 µs means 0, about 70 µs means 1.
  4. Timing is everything. Your microcontroller measures each pulse width with microsecond precision. This is why long wires and interrupt-heavy code corrupt readings — the protocol has no clock line to fall back on.
  5. The checksum is verified. The library adds the first four bytes and compares against the fifth. A mismatch means the reading is discarded, which is why bad wiring shows up as failed reads rather than wrong numbers.
  6. The sensor sleeps again. After transmitting, the DHT22 goes back to sleep for at least 2 seconds. Asking for data faster than this returns stale or failed readings.

Key specifications

Parameter Value
Model DHT22 / AM2302
Temperature range −40°C to +80°C
Temperature accuracy ±0.5°C
Humidity range 0–100% RH
Humidity accuracy ±2% RH
Supply voltage 3.3V–5.5V DC
Signal Single-wire digital
Sampling period Minimum 2 seconds between reads
Typical current ~1.5 mA during measurement, ~50 µA standby
Typical cost (India) ₹150–₹250

Wiring it up: DHT22 + Arduino Uno

The common 3-pin module (VCC, DATA, GND) usually includes the pull-up resistor already. Bare 4-pin sensors need a 4.7k–10k resistor between VCC and DATA.

DHT22 pin Arduino Uno pin Notes
VCC 5V Also fine on 3.3V; 5V gives the most stable readings
DATA D2 (any digital pin works) Keep the wire short — under 1 m ideally, 20 m max per datasheet
GND GND Common ground with the Arduino
(bare sensor) pull-up 4.7k–10kΩ between VCC and DATA Skip if your module already has one (most do)

Warning: respect the 2-second rule in code. Call the read function at most once every 2 seconds — a millis()-based timer, not delay(). Reading faster returns checksum failures or repeated stale values, and beginners often mistake this for a dead sensor.

Common mistakes that kill DHT22 projects

1. Reading faster than every 2 seconds. The sensor physically needs ~2 s to take a new measurement. Polling in a tight loop gives NaN or stale data. Fix: gate reads behind a millis() timer set to 2000 ms or more.

2. Long, unshielded data wires. The timing-critical single-wire protocol degrades past a few meters, especially near motors or switching relays. Fix: keep the data wire under 1 m where possible; for distance, put the microcontroller near the sensor and send data wirelessly instead.

3. Mounting it next to a heat source. The sensor measures its own microclimate. Tucked against a voltage regulator, motor, or sunlit enclosure wall, it reports the hotspot, not the room. Fix: mount it in ventilated shade, away from anything warm, with airflow around the housing.

4. Expecting DHT11 speed and precision from DHT22 code (and vice versa). The two sensors share a footprint but differ in timing and resolution; libraries ask which one you have for a reason. Fix: pass DHT22 (not DHT11) to the sensor constructor, and never swap the sensor without updating the code.

5. Condensation in high-humidity builds. In incubators and greenhouses, water condensing on the sensor housing skews humidity high and can damage the element over months. Fix: mount the sensor vertically with the opening facing down, and keep it out of direct misting or drip lines.

Project ideas using the DHT22

Automatic Egg Incubator Controller

Eggs need ~37.5°C and 55–65% humidity held steady for 21 days, plus periodic turning. The DHT22 is the feedback element in this closed loop: the controller reads it every few seconds and switches a heater, humidifier, and turning servo through relays. A textbook control-systems project. Build it here: Automatic Egg Incubator Controller.

Arduino SD Card Data Logger

Log temperature and humidity to an SD card every few minutes for days or weeks — the raw material for every environmental study, from hostel-room climate to server-room monitoring. The DHT22's digital output means no ADC calibration, and the 2-second sampling limit is irrelevant at logging intervals. Build it here: Arduino SD Card Data Logger.

Automated Poultry Coop Controller

Chicks are as fussy as hatching eggs: wrong temperature or humidity in the brooder kills them. This controller holds brooder conditions automatically, runs ventilation fans, and can send alerts — farm automation scaled to a student budget. Build it here: Automated Poultry Coop Controller.

Automatic Room Fan Speed Controller

Instead of a fan's fixed speed steps, the controller reads room temperature and humidity and varies fan speed continuously via PWM or a regulator — comfort plus energy saving, with the logic simple enough to explain confidently in a viva. Build it here: Automatic Room Fan Speed Controller.

Autonomous Greenhouse Agent with ESP32 and Local LLM

A greenhouse that senses its own climate with the DHT22, then uses an ESP32 running a local language model to decide watering and ventilation actions and explain them. The sensor is the humble foundation under an ambitious AI-on-the-edge build. Build it here: Autonomous Greenhouse Agent.

E-Paper Weather Display Station

An ESP32 reads the DHT22, fetches forecast data over Wi-Fi, and renders everything on a low-power e-paper display that holds its image with no power draw — a weather station you can glance at like a wall clock. Build it here: E-Paper Weather Display Station.

Egg Incubator Temperature and Humidity Monitor

The monitoring-focused sibling of the full incubator controller: precise logging and display of chamber conditions with alarms when temperature or humidity drift out of the hatching band — ideal if your project emphasizes measurement and alerting over actuation. Build it here: Egg Incubator Temperature & Humidity Monitor.

IoT Weather Station with Mobile Dashboard

The classic: DHT22 plus rain, pressure, and wind sensors feeding a live mobile dashboard over Wi-Fi. The DHT22 handles the two readings every weather report starts with, and the dashboard makes the whole thing demo-ready. Build it here: IoT Weather Station with Mobile Dashboard.

Frequently asked questions

DHT22 or DHT11 — which should I buy? The DHT22, unless every rupee counts. The DHT11 is cheaper but limited to ±2°C accuracy and 20–80% RH range with 1°C/1% resolution, while the DHT22 gives ±0.5°C, 0–100% RH, and 0.1 resolution on both. For a final-year project, the DHT22's better numbers are worth the small price difference.

Can the DHT22 work outdoors? The sensor element can, but the bare module cannot survive rain. Mount it inside a ventilated radiation shield (a stack of white plastic bowls works) with the opening facing down, and keep the electronics dry. Expect to replace outdoor sensors yearly as the humidity element drifts.

Why does my DHT22 show NaN? Almost always one of three things: you are reading faster than every 2 seconds, the data wire is too long or missing its pull-up resistor, or the library is configured for DHT11. Fix the timing first — it solves the majority of NaN cases.

How accurate is the DHT22 really? ±0.5°C and ±2% RH under normal room conditions, per the datasheet. That is fine for weather logging, room control, and incubators, but it is not a calibrated instrument — do not use it where safety or commerce depends on the number.

Can I use it with an ESP32? Yes. Power it from 3.3V or 5V (the sensor accepts both) and connect data to any GPIO. One caution: the ESP32's Wi-Fi interrupts can occasionally disturb the timing-critical reads, so a failed-read retry in code is good practice.

What is a better sensor if I outgrow the DHT22? The BME280 adds barometric pressure with better accuracy (±0.5°C, ±3% RH, ±1 hPa) over I2C, and the SHT31 is a step up again. But for most student projects the DHT22 is the sweet spot of price, simplicity, and good-enough accuracy.

Where to go next

Pick the idea above that fits your timeline — a data logger for a quick win, a weather station for a full IoT build, an incubator for control systems depth — and open its listing to check the parts and scope. If you need a variation (different sensors, a bigger display, GSM alerts instead of Wi-Fi), the order page takes custom builds around the same DHT22 core.

More project guides

More in IoT & Embedded