DHT22

A factory-calibrated digital sensor that reports both relative humidity and temperature over a single data wire.

DHT22: Temperature and humidity

What is the DHT22?

The DHT22 (also sold as the AM2302) combines a capacitive humidity element and a thermistor with an onboard chip that outputs factory-calibrated readings as a digital signal. It runs on 3.3-5V and communicates over one bidirectional DATA line using a proprietary single-wire timing protocol, not Dallas 1-Wire or I2C, so it needs no device address and occupies a single GPIO.

It measures relative humidity across the full 0-100% RH range with a typical accuracy of about ±2% RH, and temperature from -40 to 80°C with accuracy near ±0.5°C. Both channels report to 0.1 resolution. Each measurement is sent as a 40-bit frame: 16 bits of humidity, 16 bits of temperature, and an 8-bit checksum the host uses to validate the read.

The DHT22 samples slowly. The datasheet limits polling to no more than once every 2 seconds (0.5 Hz), and faster requests tend to return stale or invalid data. After power is applied it needs roughly 1-2 seconds to stabilize before the first valid reading. Its slow update rate and modest accuracy make it well suited to ambient environmental monitoring rather than fast control loops.

DHT22 pinout

PinFunctionType
VCC + (3.3-5V)PowerPower in
DATA Out (Data)1-WireBidirectional (GPIO)
GND - (GND)PowerPower in

Specifications

Operating voltage
3.3 V (max 5 V)
Interface
1-Wire
Dimensions
15.1 × 25 × 7.7 mm

Verified from the Tinkered component library.

Circuit requirements

  • Power VCC from 3.3V or 5V and share a common ground with the microcontroller.
  • The DATA line idles high, so a pull-up resistor (commonly 4.7kΩ-10kΩ, with ~5.1kΩ recommended on short runs) must connect DATA to VCC. Many breakout boards include this resistor; bare 4-pin sensors do not.
  • The DATA pin is bidirectional and compatible with both 3.3V and 5V logic, so it wires directly to any Arduino digital GPIO without a level shifter.
  • Poll no faster than once every 2 seconds (0.5 Hz); requesting readings sooner returns cached or invalid data.
  • Allow about 1-2 seconds after power-up before the first read so the sensor can stabilize.
  • A 100nF decoupling capacitor between VCC and GND helps on longer cable runs or noisy supplies.

Board compatibility

The DHT22 connects to any of the microcontrollers supported in Tinkered. Mind the 3.3 V logic level on 3.3 V boards.

Simulate the DHT22 in your browser

The DHT22 is fully simulated in Tinkered. Wire it into a circuit, write your firmware, and read real values back with no physical hardware. Test your logic before you touch a breadboard.

Open it in the simulator

Common DHT22 mistakes

Leaving off the pull-up resistor

The single data line idles high and needs a pull-up (typically 4.7kΩ to 10kΩ) to VCC. Without it the bus never settles to a valid high, so reads time out or fail their checksum. Bare sensors usually omit the resistor even though breakout modules include it.

Polling faster than 0.5 Hz

The DHT22 refreshes only about once every 2 seconds. Reading it more often returns the previous cached value or a checksum error, which looks like a frozen or unreliable sensor rather than a timing limit.

Reading immediately after power-up

The sensor needs roughly one second to stabilize after power is applied. A read issued too early often fails, so add a short delay in setup() before the first request.

Treating it as 1-Wire or I2C

Despite the single data pin, the DHT22 uses its own timing-based protocol, not Dallas 1-Wire or I2C. It has no address and cannot share a bus, so give it a dedicated GPIO and a matching library such as DHT or DHTNEW.

Wiring by pin position instead of label

Bare 4-pin DHT22 parts leave one pin unused and order their pins differently than 3-pin AM2302 breakouts. Connecting power and data by position rather than by the labeled pins is a frequent cause of no response or an overheating sensor.

DHT22 datasheet

Official DHT22 datasheet

Popular DHT22 projects

Room climate monitor

Show live temperature and humidity on an LCD or OLED, refreshing every couple of seconds for a desk, greenhouse, or nursery readout.

Thermostat and fan controller

Switch a relay-driven fan, heater, or humidifier when temperature or humidity crosses a setpoint.

Data-logging weather station

Record indoor or outdoor readings to an SD card or push them to a cloud dashboard over Wi-Fi with an ESP32 or ESP8266.

Greenhouse or terrarium controller

Keep a plant tent or reptile enclosure in range by automating misting and ventilation from the sensor readings.

Build with the DHT22.

Drop the DHT22 into a circuit, write firmware, and simulate it in your browser, then deploy to real hardware. All in one editable Tinkered project.