DHT22 (AM2302) temperature + humidity with ESP32
Supply 3.3-5 V
Bus ONEWIRE
Measures temperature, humidity
Pins and ESP32 wiring
| Pin | Role | ESP32 pin | Notes |
|---|---|---|---|
| VCC | Power | 3V3 | |
| DATA | One-wire data | D25 | Needs a 10 kΩ pull-up (included on 3-pin modules) |
| GND | Ground | GND |
Suggested wiring for the 30-pin ESP32 DevKit, avoiding flash, input-only and strapping pins. BoardPilot checks it for you as you wire.
Good to know
- Read it at most once every 2 seconds. Faster reads return the old value or fail. (Aosong AM2302 datasheet, Collecting period 2 s)
Sources
- Aosong AM2302 datasheet, Single-bus communication; pull-up resistor on DATA
Try it in 3D in BoardPilot
DHT22 (AM2302) temperature + humidity on other boards: wiring and code
Arduino Mega 2560 R3 Arduino Nano Arduino Uno R3 WeAct Black Pill STM32F411CE ESP32-C3-DevKitM-1 ESP32-S3-DevKitC-1 Nordic nRF52840 DK NUCLEO-F401RE Raspberry Pi Pico 2 Raspberry Pi Pico W Raspberry Pi Pico Teensy 4.1
Learn the basics
Lesson: GPIO: pins in and out GPIO Pull-up resistor
Related parts
AM2301 (DHT21) wired temperature + humidityDHT11 temperature + humidityDS18B20 module (KY-001 style)DS18B20 temperature sensor (TO-92)DS18B20 waterproof temperature probe
Part data: CC BY 4.0, free to reuse with credit to BoardPilot.