Spark Logic

AM2302 / DHT22 humidity and temperature sensor connection guide

AM2302 / DHT22 humidity and temperature sensor (Four-position sensor interface) connection guide. Read humidity and temperature.

Four-position sensor interface

4 contacts Current package

Aosong / ASAIR·

Read humidity and temperature

Required

For the 5 V circuit shown, use a GPIO compatible with 5 V and a 5.1 kΩ SDA pull-up to 5 V for cables under 30 m. Leave pin 3 (NC) open. With a 3.3 V supply and compatible GPIO, pull SDA up to 3.3 V and keep the cable at 1 m or less to limit supply voltage drop.

  • +5 V
    • Host 5 V
    • R1.1
  • Ground
    • Host ground
  • Data line
    • ↔
    • Host GPIO
    • R1.2
R1 5.1 kΩ between +5 V and Data line+5 VR1 5.1 kΩData line

Bench checks

  • Wait more than 2 s after power-up before sending a command. Drive SDA low for 1 ms (Table 7 allows 0.8–20 ms), then release SDA to high impedance and listen for the response.
  • Each reply contains the previous measurement. After a long pause, read twice at least 2 s apart and use the second reply for a fresh value.
  • Check that the low eight bits of the sum of the first four bytes equal the fifth byte before decoding.
  • Decode humidity as an unsigned big-endian value in tenths of percent. Decode temperature as sign and magnitude in tenths of a degree Celsius.

Aosong / ASAIR AM2302 Technical Manual V1.0, pp. 4–6, §§ 3, 5.1–5.3, and Table 7.

Four-position sensor interface wiring map

External wiring example · Read humidity and temperature

Highlighted contacts are used in this circuit. Select a contact to highlight its wiring nets.

Four-position sensor interface
Front view with the vented face toward you and leads below. Pin 1 is at the left.
Selected pin details

1 · VDD

Supply input · Power

Device supply. Place the bypass capacitor close to this pin.

Aosong / ASAIR AM2302 Technical Manual V1.0, pp. 4–6, §§ 3, 5.1–5.3, and Table 7.

Electrical limits · Pin in the reference

Models and documents

Aosong also markets AM2302 as DHT22. This map shows the four positions in the manufacturer manual. Pin 3 carries no signal.

AM2302 / DHT22
Equivalent product names for the documented Aosong sensor.