← All parts
Adafruit AHT20 Temp/Humidity
AdafruitN/A
Adafruit AHT20 sensor for temperature and humidity with I2C interface.
In stock
Specifications
2- Operating Voltage
- 2.7V to 5.5V (VIN) / Logic level same as VIN (SCL/SDA)
- Dimensions
- N/A
Pinout
4| Pin | Name | Functions | Notes |
|---|---|---|---|
| VIN | Power | POWER | 2.7V to 5.5V |
| GND | Ground | GND | |
| SCL | I2C Clock | I2C | |
| SDA | I2C Data | I2C |
Interactive pinout
Highlight:
N/A
Click a pin to copy its name · tap a tag above to spotlight a bus.
Starter code
Community starter examples — minimal, unofficial, and provided to get you wiring fast. Verify against the manufacturer datasheet before relying on them.
Arduino (C++)
Arduino library: Adafruit AHTX0
arduino
// AHT20 temperature + humidity (I2C) — community starter example
#include <Adafruit_AHTX0.h>
Adafruit_AHTX0 aht;
void setup() {
Serial.begin(115200);
if (!aht.begin()) { Serial.println("AHT20 not found"); while (1) delay(10); }
}
void loop() {
sensors_event_t h, t;
aht.getEvent(&h, &t);
Serial.print("T="); Serial.print(t.temperature); Serial.print(" C RH=");
Serial.println(h.relative_humidity);
delay(1000);
}MicroPython
MicroPython library: ahtx0 (targetblank/micropython-ahtx0)
python
# AHT20 (ESP32) — community starter example
# lib: targetblank/micropython-ahtx0 (ahtx0.py on the board)
from machine import Pin, I2C
import ahtx0, time
i2c = I2C(0, scl=Pin(22), sda=Pin(21))
sensor = ahtx0.AHT20(i2c)
while True:
print(sensor.temperature, "C", sensor.relative_humidity, "%")
time.sleep(1)Wiring
| Pin | Arduino Uno R3 | ESP32 DevKitC (WROOM-32) | Notes |
|---|---|---|---|
| VCC | +5V | 3V3 | Breakout 3-5 V safe (chip is 2.2-5.5 V) |
| GND | GND | GND | |
| SCL | A5/SCL | GPIO22 | I2C clock |
| SDA | A4/SDA | GPIO21 | I2C data |
Typical uses
- Low-cost temperature + humidity
- Replacement for DHT-class sensors