- All products
- Sensors & Modules
- Temp + Humidity
- DHT22 AM2302 Digital Temperature & Humidity Sensor Module
- Temp + Humidity
Features
- Temperature and humidity measurement: Measures both environmental temperature and relative humidity using integrated sensing elements.
- Capacitive humidity sensing: Detects changes in moisture in the surrounding air through changes in capacitance.
- NTC thermistor: Measures temperature using a temperature-sensitive resistor.
- Calibrated digital output: Provides factory-calibrated temperature and humidity readings through a single data pin.
- Wide measurement range: Measures temperatures from -40°C to 80°C and relative humidity from 0% to 100% RH.
- High resolution: Provides 0.1°C temperature and 0.1% RH humidity resolution.
- Low power consumption: Suitable for battery-powered and continuously operating monitoring systems.
- Single-bus communication: Requires one digital data connection and does not use I2C or SPI.
- Microcontroller compatibility: Can be interfaced with Arduino, ESP8266, ESP32, and other compatible microcontrollers.
- Sampling interval: Requires at least 2 seconds between measurement requests.
Principle of Operation
The DHT22 uses two sensing elements and an internal signal-processing circuit to measure temperature and humidity.

Internal Working
- Humidity sensing element: A capacitive sensing element changes its capacitance according to the moisture content of the surrounding air. The internal electronics measure this change and convert it into a relative humidity value.
- Temperature sensing element: An NTC thermistor changes its electrical resistance as temperature changes. The sensor measures this resistance variation and converts it into a temperature reading.
- Internal controller: An integrated circuit processes the signals, applies the sensor's factory calibration data, and prepares the measurements for digital transmission.
- Digital communication: The sensor sends the processed measurements through a single data pin using a proprietary timing-based protocol. It does not use the Dallas 1-Wire protocol, despite the single-wire connection.
Interaction with a Microcontroller
- Power supply: Connect VCC and GND to a suitable power source within the sensor's specified operating voltage range.
- Data connection: Connect the DATA pin to a digital GPIO pin on the microcontroller.
- Start signal: The microcontroller initiates communication by pulling the data line low for the required period and then releasing it.
- Data transmission: The sensor responds with a 40-bit data frame containing humidity, temperature, and checksum information.
- Data processing: A compatible software library decodes the signal and provides temperature and humidity values for the application.
The 40-bit data frame contains 8 bits for humidity integer, 8 bits for humidity decimal, 8 bits for temperature integer, 8 bits for temperature decimal, and 8 bits for the checksum.
Pinout

| Pin | Name | Description |
| 1 | VCC | Power supply, typically 3.3V to 5.5V. |
| 2 | DATA | Digital data communication for temperature and humidity readings. |
| 3 | NC | No connection. Leave this pin unconnected. |
| 4 | GND | Ground connection. |
Note: The pin sequence shown applies to the standalone four-pin sensor. Some breakout modules use a three-pin arrangement labelled VCC, DATA, and GND. Check the actual pin labels before connecting power. Reversing VCC and GND can damage the sensor.
Wiring and Connection
Connect the four-pin DHT22 sensor to an Arduino Uno as follows:

| DHT22 Pin | Arduino Uno |
| Pin 1 - VCC | 5V |
| Pin 2 - DATA | Digital pin 2 |
| Pin 3 - NC | Not connected |
| Pin 4 - GND | GND |
For a standalone sensor, connect a 4.7kΩ to 10kΩ pull-up resistor between VCC and DATA. Some breakout modules already include this resistor, so an additional resistor may not be required.
When using a 3.3V microcontroller such as an ESP32 or ESP8266, ensure that the DATA line is pulled up to 3.3V rather than 5V. Connect the DATA pin to a digital GPIO, not an analog input for analog measurement.
Library
The SimpleDHT library provides functions for communicating with the DHT22 sensor using Arduino IDE.

- Download the SimpleDHT library from GitHub.
- Open the Arduino IDE.
- Select Sketch → Include Library → Add .ZIP Library.
- Locate and select the downloaded SimpleDHT ZIP file.
- Wait for the Arduino IDE to complete the installation.
After installation, include SimpleDHT.h in your Arduino sketch.
Code
The following example reads temperature and humidity from the DHT22 connected to digital pin 2 and displays the results in the Serial Monitor. It waits 2.5 seconds between readings to respect the sensor's minimum sampling interval.
#include "SimpleDHT.h"
// Connect DHT22 DATA to Arduino digital pin 2
int pinDHT22 = 2;
SimpleDHT22 dht22(pinDHT22);
void setup() {
Serial.begin(115200);
Serial.println("DHT22 Temperature and Humidity Sensor");
}
void loop() {
float temperature = 0;
float humidity = 0;
// Read temperature and humidity
int err = dht22.read2(&temperature, &humidity, NULL);
if (err != SimpleDHTErrSuccess) {
Serial.print("Failed to read DHT22, error code: ");
Serial.println(err);
delay(2500);
return;
}
// Display sensor readings
Serial.print("Temperature: ");
Serial.print(temperature, 1);
Serial.println(" °C");
Serial.print("Humidity: ");
Serial.print(humidity, 1);
Serial.println(" % RH");
// Wait before the next measurement
delay(2500);
}
Upload the sketch to the Arduino and open the Serial Monitor at 115200 baud to view the readings.
Applications
- Weather stations: Collecting temperature and humidity measurements for local weather monitoring.
- Home automation: Controlling fans, ventilation, and humidifiers according to environmental readings.
- HVAC systems: Monitoring indoor temperature and humidity for climate-control applications.
- Greenhouses: Monitoring environmental conditions to help maintain suitable growing conditions.
- Data logging: Recording temperature and humidity changes over time for analysis.
- IoT projects: Sending environmental measurements to connected monitoring systems using ESP8266 or ESP32.
- Laboratories: Monitoring environmental conditions during experiments and equipment operation.
- Food storage: Monitoring temperature and humidity in storage areas and transport environments.
- Industrial monitoring: Measuring environmental conditions in manufacturing and storage facilities.
- Climate-controlled storage: Monitoring conditions in areas used to store documents, artwork, and other sensitive materials.
- Agricultural monitoring: Collecting environmental data to support crop and greenhouse management.
- Educational projects: Demonstrating digital sensing, microcontroller interfacing, and data logging.
Specifications
| Model | DHT22 / AM2302 |
| Sensor type | Digital temperature and humidity sensor |
| Humidity sensing element | Capacitive |
| Temperature sensing element | NTC thermistor |
| Operating voltage | 3.3V to 5.5V |
| Operating current | Approximately 0.5mA during measurement; approximately 15µA in standby (typical) |
| Temperature range | -40°C to 80°C |
| Temperature resolution | 0.1°C |
| Temperature accuracy | Typically ±0.5°C; consult the exact sensor datasheet for specified limits |
| Humidity range | 0% to 100% RH |
| Humidity resolution | 0.1% RH |
| Humidity accuracy | Typically ±2% RH |
| Communication | Proprietary single-bus digital protocol |
| Sampling interval | At least 2 seconds |
| Pin configuration | VCC, DATA, NC, GND |
| Body dimensions | Approximately 39 x 23 mm (as supplied) |
| Pin spacing | 2.54 mm |
Comparison: DHT22 vs. DHT11
The DHT22 and DHT11 both measure temperature and relative humidity, but they differ in measurement range, resolution, and accuracy. The DHT22 is suitable for projects requiring a wider measurement range and more detailed readings, while the DHT11 is a lower-cost option for basic environmental monitoring.

| Specification | DHT22 | DHT11 |
| Temperature range | -40°C to 80°C | 0°C to 50°C |
| Typical temperature accuracy | ±0.5°C | ±2°C |
| Temperature resolution | 0.1°C | 1°C |
| Humidity range | 0% to 100% RH | 20% to 90% RH |
| Typical humidity accuracy | ±2% RH | ±5% RH |
| Humidity resolution | 0.1% RH | 1% RH |
| Sampling interval | At least 2 seconds | At least 1 second |
Selection guide: Choose the DHT22 when a wider measurement range and finer resolution are required. The DHT11 is suitable for simpler projects where lower cost is more important than measurement accuracy and range.
Resources
Features
- Temperature and humidity measurement: Measures both environmental temperature and relative humidity using integrated sensing elements.
- Capacitive humidity sensing: Detects changes in moisture in the surrounding air through changes in capacitance.
- NTC thermistor: Measures temperature using a temperature-sensitive resistor.
- Calibrated digital output: Provides factory-calibrated temperature and humidity readings through a single data pin.
- Wide measurement range: Measures temperatures from -40°C to 80°C and relative humidity from 0% to 100% RH.
- High resolution: Provides 0.1°C temperature and 0.1% RH humidity resolution.
- Low power consumption: Suitable for battery-powered and continuously operating monitoring systems.
- Single-bus communication: Requires one digital data connection and does not use I2C or SPI.
- Microcontroller compatibility: Can be interfaced with Arduino, ESP8266, ESP32, and other compatible microcontrollers.
- Sampling interval: Requires at least 2 seconds between measurement requests.
Principle of Operation
The DHT22 uses two sensing elements and an internal signal-processing circuit to measure temperature and humidity.

Internal Working
- Humidity sensing element: A capacitive sensing element changes its capacitance according to the moisture content of the surrounding air. The internal electronics measure this change and convert it into a relative humidity value.
- Temperature sensing element: An NTC thermistor changes its electrical resistance as temperature changes. The sensor measures this resistance variation and converts it into a temperature reading.
- Internal controller: An integrated circuit processes the signals, applies the sensor's factory calibration data, and prepares the measurements for digital transmission.
- Digital communication: The sensor sends the processed measurements through a single data pin using a proprietary timing-based protocol. It does not use the Dallas 1-Wire protocol, despite the single-wire connection.
Interaction with a Microcontroller
- Power supply: Connect VCC and GND to a suitable power source within the sensor's specified operating voltage range.
- Data connection: Connect the DATA pin to a digital GPIO pin on the microcontroller.
- Start signal: The microcontroller initiates communication by pulling the data line low for the required period and then releasing it.
- Data transmission: The sensor responds with a 40-bit data frame containing humidity, temperature, and checksum information.
- Data processing: A compatible software library decodes the signal and provides temperature and humidity values for the application.
The 40-bit data frame contains 8 bits for humidity integer, 8 bits for humidity decimal, 8 bits for temperature integer, 8 bits for temperature decimal, and 8 bits for the checksum.
Pinout

| Pin | Name | Description |
| 1 | VCC | Power supply, typically 3.3V to 5.5V. |
| 2 | DATA | Digital data communication for temperature and humidity readings. |
| 3 | NC | No connection. Leave this pin unconnected. |
| 4 | GND | Ground connection. |
Note: The pin sequence shown applies to the standalone four-pin sensor. Some breakout modules use a three-pin arrangement labelled VCC, DATA, and GND. Check the actual pin labels before connecting power. Reversing VCC and GND can damage the sensor.
Wiring and Connection
Connect the four-pin DHT22 sensor to an Arduino Uno as follows:

| DHT22 Pin | Arduino Uno |
| Pin 1 - VCC | 5V |
| Pin 2 - DATA | Digital pin 2 |
| Pin 3 - NC | Not connected |
| Pin 4 - GND | GND |
For a standalone sensor, connect a 4.7kΩ to 10kΩ pull-up resistor between VCC and DATA. Some breakout modules already include this resistor, so an additional resistor may not be required.
When using a 3.3V microcontroller such as an ESP32 or ESP8266, ensure that the DATA line is pulled up to 3.3V rather than 5V. Connect the DATA pin to a digital GPIO, not an analog input for analog measurement.
Library
The SimpleDHT library provides functions for communicating with the DHT22 sensor using Arduino IDE.

- Download the SimpleDHT library from GitHub.
- Open the Arduino IDE.
- Select Sketch → Include Library → Add .ZIP Library.
- Locate and select the downloaded SimpleDHT ZIP file.
- Wait for the Arduino IDE to complete the installation.
After installation, include SimpleDHT.h in your Arduino sketch.
Code
The following example reads temperature and humidity from the DHT22 connected to digital pin 2 and displays the results in the Serial Monitor. It waits 2.5 seconds between readings to respect the sensor's minimum sampling interval.
#include "SimpleDHT.h"
// Connect DHT22 DATA to Arduino digital pin 2
int pinDHT22 = 2;
SimpleDHT22 dht22(pinDHT22);
void setup() {
Serial.begin(115200);
Serial.println("DHT22 Temperature and Humidity Sensor");
}
void loop() {
float temperature = 0;
float humidity = 0;
// Read temperature and humidity
int err = dht22.read2(&temperature, &humidity, NULL);
if (err != SimpleDHTErrSuccess) {
Serial.print("Failed to read DHT22, error code: ");
Serial.println(err);
delay(2500);
return;
}
// Display sensor readings
Serial.print("Temperature: ");
Serial.print(temperature, 1);
Serial.println(" °C");
Serial.print("Humidity: ");
Serial.print(humidity, 1);
Serial.println(" % RH");
// Wait before the next measurement
delay(2500);
}Upload the sketch to the Arduino and open the Serial Monitor at 115200 baud to view the readings.
Applications
- Weather stations: Collecting temperature and humidity measurements for local weather monitoring.
- Home automation: Controlling fans, ventilation, and humidifiers according to environmental readings.
- HVAC systems: Monitoring indoor temperature and humidity for climate-control applications.
- Greenhouses: Monitoring environmental conditions to help maintain suitable growing conditions.
- Data logging: Recording temperature and humidity changes over time for analysis.
- IoT projects: Sending environmental measurements to connected monitoring systems using ESP8266 or ESP32.
- Laboratories: Monitoring environmental conditions during experiments and equipment operation.
- Food storage: Monitoring temperature and humidity in storage areas and transport environments.
- Industrial monitoring: Measuring environmental conditions in manufacturing and storage facilities.
- Climate-controlled storage: Monitoring conditions in areas used to store documents, artwork, and other sensitive materials.
- Agricultural monitoring: Collecting environmental data to support crop and greenhouse management.
- Educational projects: Demonstrating digital sensing, microcontroller interfacing, and data logging.
Specifications
| Model | DHT22 / AM2302 |
| Sensor type | Digital temperature and humidity sensor |
| Humidity sensing element | Capacitive |
| Temperature sensing element | NTC thermistor |
| Operating voltage | 3.3V to 5.5V |
| Operating current | Approximately 0.5mA during measurement; approximately 15µA in standby (typical) |
| Temperature range | -40°C to 80°C |
| Temperature resolution | 0.1°C |
| Temperature accuracy | Typically ±0.5°C; consult the exact sensor datasheet for specified limits |
| Humidity range | 0% to 100% RH |
| Humidity resolution | 0.1% RH |
| Humidity accuracy | Typically ±2% RH |
| Communication | Proprietary single-bus digital protocol |
| Sampling interval | At least 2 seconds |
| Pin configuration | VCC, DATA, NC, GND |
| Body dimensions | Approximately 39 x 23 mm (as supplied) |
| Pin spacing | 2.54 mm |
Comparison: DHT22 vs. DHT11
The DHT22 and DHT11 both measure temperature and relative humidity, but they differ in measurement range, resolution, and accuracy. The DHT22 is suitable for projects requiring a wider measurement range and more detailed readings, while the DHT11 is a lower-cost option for basic environmental monitoring.

| Specification | DHT22 | DHT11 |
| Temperature range | -40°C to 80°C | 0°C to 50°C |
| Typical temperature accuracy | ±0.5°C | ±2°C |
| Temperature resolution | 0.1°C | 1°C |
| Humidity range | 0% to 100% RH | 20% to 90% RH |
| Typical humidity accuracy | ±2% RH | ±5% RH |
| Humidity resolution | 0.1% RH | 1% RH |
| Sampling interval | At least 2 seconds | At least 1 second |
Selection guide: Choose the DHT22 when a wider measurement range and finer resolution are required. The DHT11 is suitable for simpler projects where lower cost is more important than measurement accuracy and range.