

The AM2302 is a digital sensor designed to measure both humidity and temperature with high accuracy. It is widely used in environmental monitoring applications, such as weather stations, HVAC systems, and indoor air quality monitoring. The sensor features a single-wire communication interface, which simplifies integration with microcontrollers like Arduino, Raspberry Pi, and other embedded systems.
Key features of the AM2302 include:








The following table outlines the key technical details of the AM2302 sensor:
| Parameter | Value |
|---|---|
| Supply Voltage | 3.3V to 5.5V |
| Operating Current | 1.5 mA (measuring) |
| Standby Current | 40 µA |
| Humidity Range | 0% to 100% RH |
| Humidity Accuracy | ±2% RH (25°C, 20%–80% RH) |
| Temperature Range | -40°C to +80°C |
| Temperature Accuracy | ±0.5°C (25°C) |
| Communication Protocol | Single-wire digital interface |
| Sampling Period | ≥ 2 seconds |
The AM2302 sensor has four pins, as described in the table below:
| Pin Number | Name | Description |
|---|---|---|
| 1 | VCC | Power supply (3.3V to 5.5V) |
| 2 | DATA | Single-wire data communication pin |
| 3 | NC | Not connected (leave unconnected) |
| 4 | GND | Ground (0V reference) |
Note: A pull-up resistor (typically 10kΩ) is required on the DATA pin for proper communication.
To use the AM2302 sensor in a circuit, follow these steps:
Below is an example of how to use the AM2302 sensor with an Arduino UNO. This example uses the popular DHT library, which supports the AM2302.
#include "DHT.h"
// Define the pin where the sensor is connected
#define DHTPIN 2
// Define the sensor type (DHT22 is compatible with AM2302)
#define DHTTYPE DHT22
// Initialize the DHT sensor
DHT dht(DHTPIN, DHTTYPE);
void setup() {
Serial.begin(9600); // Start serial communication
Serial.println("AM2302 Sensor Test");
dht.begin(); // Initialize the sensor
}
void loop() {
delay(2000); // Wait at least 2 seconds between readings
// Read humidity and temperature
float humidity = dht.readHumidity();
float temperature = dht.readTemperature();
// Check if the readings are valid
if (isnan(humidity) || isnan(temperature)) {
Serial.println("Failed to read from AM2302 sensor!");
return;
}
// Print the results to the Serial Monitor
Serial.print("Humidity: ");
Serial.print(humidity);
Serial.print(" %\t");
Serial.print("Temperature: ");
Serial.print(temperature);
Serial.println(" °C");
}
No data or incorrect readings:
"Failed to read from AM2302 sensor!" message in Arduino:
Inconsistent or fluctuating readings:
Q: Can the AM2302 be used outdoors?
A: Yes, but it should be housed in a protective enclosure to shield it from direct exposure to water, dust, and extreme environmental conditions.
Q: What is the difference between the AM2302 and DHT22?
A: The AM2302 and DHT22 are functionally identical. The AM2302 is typically sold in a more robust casing, making it easier to handle and mount.
Q: Can I use the AM2302 with a 3.3V microcontroller?
A: Yes, the AM2302 operates within a voltage range of 3.3V to 5.5V, making it compatible with both 3.3V and 5V systems.
Q: How long does the sensor take to stabilize after power-up?
A: The sensor typically stabilizes within 1-2 seconds after power-up.