DHT22 Sensor
Digital sensor commonly used for approximate humidity and temperature sensing.
What is the DHT22 Sensor and what is it used for?
Digital sensor commonly used for approximate humidity and temperature sensing. Makers use it to display ambient measurements.
Room climate monitoring
Sensors convert a physical quantity into an electrical signal. Calibrate, verify module supply, interfaces and environmental limits.
Key specifications
| Sensor spec | Value |
|---|---|
| Measures | Temperature and relative humidity |
| Range | −40 to 80 °C; 0 to 100 %RH |
| Accuracy | ±0.5 °C; ±2 to 5 %RH |
| Interface | Single-wire digital (its own protocol, not 1-Wire) |
| Supply voltage | 3.3 to 6 V |
| Operating temperature | −40 to 80 °C |
Pinout
How to use it
Read at most once every 2 seconds. On a 3-pin module the pull-up is already fitted. Use the DHT sensor library by Adafruit.
#include <DHT.h>
DHT dht(4, DHT22);
void setup() { Serial.begin(115200); dht.begin(); }
void loop() {
Serial.printf("%.1f C %.1f %%\n", dht.readTemperature(), dht.readHumidity());
delay(2000);
}Applications
Builds that use it
ESP32 web dashboard
Humidity display with OLED
Sensor fault detector
ESP-NOW sensor network without a router
Heat index and comfort display
Bluetooth serial terminal control
MicroPython on Pico with sensors
Log sensor data to Google Sheets
Alternatives
- BME280 Environmental SensorFaster I2C, adds pressure
Common questions
What is the DHT22 Sensor used for?
In products: room climate monitoring. In maker projects: display ambient measurements.
How does the DHT22 Sensor work?
Sensors convert a physical quantity into an electrical signal. Calibrate, verify module supply, interfaces and environmental limits.
What voltage does the DHT22 Sensor need?
3.3 to 6 V.
How do I connect the DHT22 Sensor to an Arduino or ESP32?
Single-wire digital (its own protocol, not 1-Wire). Pins: 1 VCC (3.3 to 5 V), 2 DATA (Signal, with 10 kΩ pull-up to VCC (modules include it)), 3 NC (Not connected), 4 GND (Ground).
What can I use instead of the DHT22 Sensor?
BME280 Environmental Sensor.
