Skip to content
Free IDE

← Components

DHT22 (AM2302)

Digital temperature and humidity sensor. It talks to the ESP32 over a single data wire, with the dht module of MicroPython. Read it at most every 2 seconds.

Pinout

VCCDATANCGND
PinConnect toNote
VCC (1)3V3
DATA (2)GPIO (e.g. 4) with a ~10 kΩ pull-upmodules with a board already have the resistor
NC (3)leave unconnected
GND (4)GND
FastTeacherFor teachers

From the syllabus to a planned semester

  • Teaching plan and calendar built automatically
  • Class diary ready to paste into SIGA
  • Slides and exercise lists with answer keys
Meet FastTeacher

Free Community edition · Windows

MicroPython example

import dht
from machine import Pin
import time

sensor = dht.DHT22(Pin(4))

while True:
    sensor.measure()
    print(sensor.temperature(), "°C", sensor.humidity(), "%")
    time.sleep(2)

Specifications

ItemValueSource
Power supply3.3–6 VDatasheet AM2302/DHT22 (Aosong), cdn.sparkfun.com/assets/f/7/d/9/c/DHT22.pdf
Temperature−40 to 80 °C, ± 0.5 °C, resolution 0.1 °CDatasheet AM2302/DHT22 (Aosong), cdn.sparkfun.com/assets/f/7/d/9/c/DHT22.pdf
Humidity0–100 % RH, ± 2 % (max. ± 5 %), resolution 0.1 %Datasheet AM2302/DHT22 (Aosong), cdn.sparkfun.com/assets/f/7/d/9/c/DHT22.pdf
Interval between readings≥ 2 sDatasheet AM2302/DHT22 (Aosong), cdn.sparkfun.com/assets/f/7/d/9/c/DHT22.pdf
Pin orderVDD, DATA, NC, GNDDatasheet AM2302/DHT22 (Aosong), cdn.sparkfun.com/assets/f/7/d/9/c/DHT22.pdf

Values marked "Under review" will still be checked against the parts in the lab.

FastMindLocal AI assistant

The AI that remembers your life and lives on your computer

  • Long-term memory with the source of every answer
  • Works offline: your data stays on your PC
  • Reads PDFs, slides, photos and meeting recordings
Download free for Windows

Essential plan free forever

FastTeacherFor teachers

From the syllabus to a planned semester

  • Teaching plan and calendar built automatically
  • Class diary ready to paste into SIGA
  • Slides and exercise lists with answer keys
Meet FastTeacher

Free Community edition · Windows

FastMindLocal AI assistant

The AI that remembers your life and lives on your computer

  • Long-term memory with the source of every answer
  • Works offline: your data stays on your PC
  • Reads PDFs, slides, photos and meeting recordings
Download free for Windows

Essential plan free forever