Stufin
Home Quick Cart Profile

DHT22 Humidity and Temperature Sensor Module (AM2302)

Buy Now on Stufin

Temperature measurement

0.5C (max) accuracy

Humidity measurement

2% RH (max) accuracy

  • Digital Output:

The sensor module provides a digital output, eliminating the need for analog-to-digital converters (ADCs) and reducing errors.

  • Wide Operating Range:

Temperature

10 seconds

Humidity

10-30 seconds

  • Low Power Consumption:

Operating current

2.5mA (max)

Sleep current

0.5mA (max)

  • Simple Interface:

Single-bus digital output (3-5V tolerant)

Compatible with 3.3V and 5V microcontrollers

  • Compact Design:

Module size

27.5mm x 18.5mm x 10.5mm

Weight

10g (approx.)

Output protocol

Digital, single-bus

Power supply

3.3V or 5V

Output pins

3 (VCC, GND, OUT)

Operating temperature

-40C to 80C (-40F to 176F)

Storage temperature

-40C to 125C (-40F to 257F)

Applications

The DHT22 Humidity and Temperature Sensor Module is suitable for a wide range of applications, including

Environmental monitoring systems

Home automation and HVAC systems

Weather stations and forecasting systems

Industrial automation and process control

IoT projects and smart devices

Medical and healthcare equipment

Conclusion

The DHT22 Humidity and Temperature Sensor Module (AM2302) is a reliable and accurate sensor module ideal for measuring relative humidity and temperature in various applications. Its compact design, low power consumption, and simple interface make it a popular choice for IoT projects and other systems requiring environmental monitoring.

Pin Configuration

  • DHT22 Humidity and Temperature Sensor Module (AM2302) Pinout Explanation
  • The DHT22 Humidity and Temperature Sensor Module (AM2302) is a popular IoT component used to measure atmospheric humidity and temperature. The module has four pins, which are explained below:
  • Pin 1: VCC (Power Supply)
  • Function: Provides power to the sensor module
  • Voltage: Typically 3.3V or 5V, depending on the specific module and application
  • Connection: Connect to the power supply of your microcontroller or development board (e.g., Arduino, Raspberry Pi)
  • Pin 2: Data (Signal)
  • Function: Transmits digital humidity and temperature data to the microcontroller
  • Signal Type: Single-wire digital signal
  • Connection: Connect to a digital input pin on your microcontroller or development board (e.g., Arduino's digital pin 2-13)
  • Pin 3: N/C (No Connection)
  • Function: Not connected internally; reserved for future use or debugging
  • Connection: Leave unconnected
  • Pin 4: GND (Ground)
  • Function: Provides a common ground reference for the sensor module
  • Connection: Connect to the ground pin on your microcontroller or development board (e.g., Arduino's GND pin)
  • Connection Structure:
  • When connecting the DHT22 module to your microcontroller or development board, follow this structure:
  • VCC (Pin 1) Power Supply (3.3V or 5V)
  • Data (Pin 2) Digital Input Pin (e.g., Arduino's digital pin 2-13)
  • N/C (Pin 3) No Connection
  • GND (Pin 4) Ground (e.g., Arduino's GND pin)
  • Important Notes:
  • The DHT22 module has an internal pull-up resistor, so an external pull-up resistor is not required.
  • The module's signal pin (Pin 2) is an open-drain output, which means it can only pull the signal low. A pull-up resistor is required on the microcontroller side to maintain a high signal level when the data pin is not actively driven low.
  • The DHT22 module is sensitive to power supply noise and electrostatic discharge. Ensure a clean power supply and handle the module with anti-static precautions to avoid damage.
  • By following this pinout explanation and connection structure, you can successfully integrate the DHT22 Humidity and Temperature Sensor Module (AM2302) into your IoT project.

Code Examples

DHT22 Humidity and Temperature Sensor Module (AM2302) Documentation
Overview
The DHT22 Humidity and Temperature Sensor Module (AM2302) is a low-cost, highly accurate sensor module that measures both temperature and humidity. It is widely used in IoT projects, weather stations, and other applications where environmental monitoring is required.
Pinouts and Connections
The DHT22 module has four pins:
VCC: Connect to a 3.3V or 5V power source
 GND: Connect to Ground
 DATA: Connect to a digital I/O pin on the microcontroller (e.g., Arduino, Raspberry Pi)
Technical Specifications
Temperature Range: -40C to 80C
 Humidity Range: 0% to 100%
 Accuracy:
	+ Temperature: 0.5C
	+ Humidity: 2%
 Power Consumption: 2.5mA (average)
Code Examples
### Example 1: Using DHT22 with Arduino
Connect the DHT22 module to an Arduino board as follows:
VCC to Arduino's 5V pin
 GND to Arduino's GND pin
 DATA to Arduino's digital pin 2
```cpp
#include "DHT.h"
#define DHTPIN 2     // Digital pin connected to the DHT sensor
DHT dht(DHTPIN, DHT22);  // Initialize DHT sensor for DHT22
void setup() {
  Serial.begin(9600);
  dht.begin();
}
void loop() {
  delay(2000);  // Wait 2 seconds between measurements
float humidity = dht.readHumidity();
  float temperature = dht.readTemperature();
if (isnan(humidity) || isnan(temperature)) {
    Serial.println("Error reading from DHT sensor!");
  } else {
    Serial.print("Humidity: ");
    Serial.print(humidity);
    Serial.print("%  Temperature: ");
    Serial.print(temperature);
    Serial.println("C");
  }
}
```
### Example 2: Using DHT22 with Raspberry Pi (Python)
Connect the DHT22 module to a Raspberry Pi as follows:
VCC to Raspberry Pi's 3.3V pin
 GND to Raspberry Pi's GND pin
 DATA to Raspberry Pi's GPIO pin 4
```python
import Adafruit_DHT
DHT_SENSOR = Adafruit_DHT.DHT22
DHT_PIN = 4  # GPIO pin connected to the DHT sensor
while True:
    humidity, temperature = Adafruit_DHT.read_retry(DHT_SENSOR, DHT_PIN)
if humidity is not None and temperature is not None:
        print('Humidity: {:.1f}%'.format(humidity))
        print('Temperature: {:.1f}C'.format(temperature))
    else:
        print('Error reading from DHT sensor!')
time.sleep(2)  # Wait 2 seconds between measurements
```
### Example 3: Using DHT22 with ESP32 (MicroPython)
Connect the DHT22 module to an ESP32 board as follows:
VCC to ESP32's 3.3V pin
 GND to ESP32's GND pin
 DATA to ESP32's GPIO pin 4
```python
import dht
import machine
dht_sensor = dht.DHT22(machine.Pin(4))  # Initialize DHT sensor on GPIO pin 4
while True:
    try:
        humidity, temperature = dht_sensor.read()
        print('Humidity: {:.1f}%'.format(humidity))
        print('Temperature: {:.1f}C'.format(temperature))
    except RuntimeError as e:
        print('Error reading from DHT sensor:', e)
machine.sleep(2000)  # Wait 2 seconds between measurements
```
Notes
Make sure to install the required libraries and modules for each example before running the code.
 The DHT22 sensor may take a few seconds to stabilize after power-on, so it's recommended to add a short delay before taking the first measurement.
 The examples above are just a starting point, and you may need to adjust the code to suit your specific project requirements.