Skip to Content

DHT22 AM2302 Digital Temperature & Humidity Sensor Module

The DHT22 (AM2302) is a digital temperature and humidity sensor designed for environmental monitoring and microcontroller-based projects. It combines a capacitive humidity sensing element with an NTC thermistor to measure relative humidity and temperature. Both measurements are transmitted through a single digital data pin using a proprietary timing-based communication protocol. With a temperature measurement range of -40°C to 80°C, humidity range of 0% to 100% RH, and 0.1 resolution for both measurements, the DHT22 is suitable for applications requiring more detailed measurements than the DHT11.

Package Includes

  • 1 x DHT22 / AM2302 Temperature and Humidity Sensor
DHT Temperature Humidity Sensor
40.95 AED 40.95 AED (Tax included)

Terms and Conditions
30-day money-back guarantee
Shipping: 2-3 Business Days

 

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.

IDUINO DHT22 Digital Temperature and Humidity Sensor, AM2302 Temp Humidity  Monitor Sensor Replace SHT15 SHT11 : Amazon.in: Industrial & Scientific

Internal Working

  1. 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.
  2. 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.
  3. Internal controller: An integrated circuit processes the signals, applies the sensor's factory calibration data, and prepares the measurements for digital transmission.
  4. 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

  1. Power supply: Connect VCC and GND to a suitable power source within the sensor's specified operating voltage range.
  2. Data connection: Connect the DATA pin to a digital GPIO pin on the microcontroller.
  3. Start signal: The microcontroller initiates communication by pulling the data line low for the required period and then releasing it.
  4. Data transmission: The sensor responds with a 40-bit data frame containing humidity, temperature, and checksum information.
  5. Data processing: A compatible software library decodes the signal and provides temperature and humidity values for the application.

How the DHT22 Sensor Works | Microcontroller Tutorials

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

DHT22 AM2302 temperature and humidity sensor 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 AM2302 sensor Arduino wiring diagram

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.

การติดตั้ง Library ของ DHT Sensor DHT11 , DHT21 , DHT22

  1. Download the SimpleDHT library from GitHub.
  2. Open the Arduino IDE.
  3. Select Sketch → Include Library → Add .ZIP Library.
  4. Locate and select the downloaded SimpleDHT ZIP file.
  5. 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.

Measure temperature and humidity with Arduino and DHT11-DHT22 sensor

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