AHT20 temperature and humidity sensor & vs AHT21 | datasheet
- Brands: Aosong (Guangzhou) Elec
- Download: -
- Price: inquiry
- In Stock: 15421
- Manufacturer: Aosong (Guangzhou) Elec
- Package: SMD

FREE delivery for orders over HK$250.00

Quick response, quick quotaton

Flash shipment,no worries after sales

Original channel,guarantee of the authentic products
AHT20+BMP280 Temperature Humidity and Air Pressure Module High precision Digital Temperature Humidit
AHT20
When you’re choosing a temperature and humidity sensor, the AHT20 is a great pick. It offers high accuracy, with humidity measurements accurate to around ±2% and temperature to about ±0.3°C. It covers a wide range too—humidity from 0 to 100% and temperature from -40°C to 85°C, ideal for most scenarios. It responds quickly, giving you immediate measurements when powered up.
The AHT20 also uses a standard I²C interface, making it simple to connect with microcontrollers or devices like Raspberry Pi. It’s very low power—just about 2µA in standby—perfect for battery-powered devices. Plus, its tiny 3×3×1 mm size helps you save PCB space. Its built-in noise filtering ensures reliable performance even in noisy industrial environments.
AHT20 Pinout

| Pin Number | Pin Name | Function Description |
|---|---|---|
| 1 | VDD | Positive Power Supply (2.2V to 5.5V) |
| 2 | SDA | I²C Data Line |
| 3 | GND | Ground |
| 4 | SCL | I²C Clock Line |
When connecting the AHT20 sensor for temperature and humidity measurement, wiring is straightforward. Provide a stable DC voltage (2.2~5.5V) to the VDD pin. Use pull-up resistors (typically 4.7kΩ to 10kΩ) to connect SDA and SCL pins to VDD, and then connect these lines to the I²C pins on your microcontroller. Ensure GND is properly grounded to reduce interference.
Its default I²C address is 0x38; avoid conflicts with other devices on the same bus. Keep your SDA and SCL wires short to reduce noise. Adding a 0.1μF ceramic capacitor between VDD and GND helps stabilize power. Lastly, protect the sensor from water and conductive liquids to maintain accurate measurements and prolong its life.
AHT20 Equivalent Humidity Sensor

| Parameter | AHT20 | SHT20 | HTU21D | SHT30 | HDC1080 |
|---|---|---|---|---|---|
| Humidity Measurement Range | 0 ~ 100% RH | 0 ~ 100% RH | 0 ~ 100% RH | 0 ~ 100% RH | 0 ~ 100% RH |
| Humidity Accuracy | ±2% RH | ±3% RH | ±2% RH | ±2% RH | ±2% RH |
| Temperature Measurement Range | -40°C ~ +85°C | -40°C ~ +125°C | -40°C ~ +125°C | -40°C ~ +125°C | -40°C ~ +125°C |
| Temperature Accuracy | ±0.3°C | ±0.3°C | ±0.3°C | ±0.2°C | ±0.2°C |
| Interface Type | I²C | I²C | I²C | I²C | I²C |
| Operating Voltage | 2.2 ~ 5.5V | 2.1 ~ 3.6V | 1.5 ~ 3.6V | 2.15 ~ 5.5V | 2.7 ~ 5.5V |
| Current Consumption (Typical) | 2µA (standby) | 0.15µA (standby) | 0.14µA (standby) | 0.2µA (standby) | 0.1µA (standby) |
| Package Size | 3.0×3.0×1.0mm | 3.0×3.0×1.1mm | 3.0×3.0×0.9mm | 2.5×2.5×0.9mm | 3.0×3.0×0.9mm |
When choosing replacement sensors, first check their I²C compatibility—even though most support I²C, their addresses might differ. Make sure the new sensor’s address doesn’t conflict with your existing setup. Also, match the voltage range carefully to avoid insufficient power or damage. Accuracy and measurement range matter too—select according to your actual requirements to ensure reliable data. Lastly, the package size and pin layout are similar, but double-check the PCB footprint to guarantee easy replacement.
In short, compare these factors carefully based on your specific needs, and pick the best sensor for your project.
AHT20 Arduino Wiring Example
| AHT20 Pin | Arduino Pin | Description |
|---|---|---|
| VDD | 3.3V or 5V | Sensor Power Supply |
| GND | GND | Common Ground |
| SDA | A4 (UNO), D21 (MEGA), GPIO21 (ESP32) | I²C Data Line |
| SCL | A5 (UNO), D22 (MEGA), GPIO22 (ESP32) | I²C Clock Line |
If you’re using the AHT20 sensor with your Arduino, connecting it is pretty straightforward. Just hook the sensor’s VDD pin to your Arduino’s 3.3V or 5V (depending on your board) and connect GND to Arduino’s ground. Then connect SDA and SCL pins from the sensor to the Arduino’s I²C pins—A4 (SDA) and A5 (SCL) for an UNO board, for example.
For the code, using Adafruit’s AHTX0 library will make your life easier. Install it directly in your Arduino IDE library manager and run the example provided. If your sensor isn’t responding, check your wiring carefully—especially SDA and SCL lines. Keep these wires short and neat to reduce interference. Also, ensure there are no I²C address conflicts with other devices.
This approach will help you quickly set up the AHT20 sensor to measure temperature and humidity in your Arduino projects.
AHT20 ESP32 Sensor Project
If you’re planning to use an ESP32 with the AHT20 sensor for monitoring temperature and humidity, wiring is straightforward. Power the sensor with the ESP32’s 3.3V pin, connect GND to ground, and hook the SDA pin to GPIO21 and SCL to GPIO22.
In Arduino IDE, just install the ESP32 board support and Adafruit’s AHTX0 library—it only takes a few minutes. After uploading the code, you’ll instantly see real-time temperature and humidity readings on your serial monitor, updating every few seconds.
Expanding your project later is simple too. You can send data over Wi-Fi to platforms like Thingspeak, add an OLED display for real-time viewing, or even create a mobile app for remote monitoring.
Remember that ESP32’s I²C pins run at 3.3V, and keep your wiring short to avoid interference.
AHT20 Humidity Sensor Accuracy
When you’re using an AHT20 sensor to measure humidity, it typically gives you accuracy around ±2% RH. Under normal conditions—around 25°C with humidity between 20% and 80%—it’s very accurate. However, if humidity is extremely high or low (below 20% or above 80%), you might see a slight increase in measurement error, but it remains reliable overall.
To get better accuracy, keep your sensor away from direct water droplets, dust, or condensation. Periodically checking and calibrating it after prolonged use will also help maintain accuracy.
Make sure air around the sensor flows freely to avoid local humidity spikes. Use a stable power supply—3.3V is ideal—to ensure consistent readings. And don’t forget to keep the sensor’s opening clean, free of dust or debris, for optimal performance.
AHT20 Raspberry Pi Circuit Diagram

If you want to set up your Raspberry Pi Pico with an AHT20 temperature and humidity sensor and an OLED display, it’s pretty simple. Connect both devices to the Pico’s 3.3V and ground pins. Hook the SDA wires together into GPIO0, and the SCL wires into GPIO1 to share the I²C bus.
Just double-check the I²C addresses—AHT20 is typically 0x38, while your OLED will usually be 0x3C. Keeping your connection wires short with standard jumper or Grove cables can help reduce signal interference.
Lastly, make sure your Pico’s I²C is enabled and you’ve installed the right libraries. Soon, you’ll have your temperature and humidity readings displayed clearly on the OLED.







