ESP32 AHT20 Temperature and Humidity Sensor

AHT20 Temperature and Humidity Sensor image

AHT20

Protocol: I2C

Overview

The AHT20 datasheet provides comprehensive technical details about the AHT20 digital temperature and humidity sensor, a highly accurate and reliable component designed for industrial-grade applications. This document includes information on the sensor's specifications, electrical characteristics, communication protocols, and recommended usage guidelines, ensuring users can integrate it seamlessly into their projects.

About AHT20 Temperature and Humidity Sensor

The AHT series, developed by AOSONG (Aosong Electronics Co., Ltd.), consists of high-precision digital temperature and humidity sensors.

Key Features

  • Upgraded Performance – The AHT20 offers higher accuracy and improved reliability compared to the AHT10.
  • Reliable Environmental Monitoring – Ideal for weather stations, indoor climate control, and industrial applications.
  • Compact & Efficient – Digital output with I²C interface for seamless integration.

🔗 Learn more about the AHT20 sensor.
🔗 Check out the AHT10 sensor for a more affordable option.

Where to Buy

AHT20 Temperature and Humidity Sensor

Starting from

4$ per unit

Amazon com
Amazon.com Ships worldwide
View Price
Amazon de
Amazon.de Ships to EU
View Price
Aliexpress
AliExpress Best value
View Price

Prices are subject to change. We earn from qualifying purchases as an Amazon Associate.

Technical Specifications

Interface I2C
Accuracy ±2% RH, ±0.3 °C
Operating Range -40°C to 85°C, 0–100% RH
Voltage 2.0V to 5.5V (typical 3.3V)

Pinout Configuration

The VCC pin is used to supply power to the sensor, and it typically requires 3.3V or 5V (refer to the datasheet for specific voltage requirements). The GND pin is the ground connection and must be connected to the ground of your ESP32.

The AHT20 pinout is simple and follows the I2C communication protocol:

  • SDA (Data Line): Used for transferring data between the sensor and the microcontroller (ESP32).
  • SCL (Clock Line): Provides the clock signal for synchronizing data transfer.
  • GND (Ground): Connect to the ground of the ESP32 to complete the circuit.
  • VCC (Power): Connect to the 3.3V or 5V power supply on the ESP32 to power the sensor.

Wiring with ESP32

Since AHT20 uses I2C protocol, simply connect SDA, SCL, VCC and GND pins to the ESP32. Make sure to configure the I2C pins accordingly.

Troubleshooting Guide

Common Issues

⚠️ Sensor Initialization Failure on ESP32

🔄 Communication Failure with ESPHome

🌡️ Temperature Readings Increasing Over Time

🔍 Device Address Detected but Read Failed on ESP32

Debugging Tips

🔍 Serial Monitor

⚡ Voltage Checks

Code Examples

Arduino Example

C++
🔧

ESP-IDF Example

C++
🏠

ESPHome Example

YAML
🛠️

PlatformIO Example

C++
🐍

MicroPython Example

Python

Conclusion

The ESP32 AHT20 Temperature and Humidity Sensor is a powerful environment sensor that offers excellent performance and reliability. With support for multiple development platforms including Arduino, ESP-IDF, ESPHome, PlatformIO, and MicroPython, it's a versatile choice for your IoT projects.

For optimal performance, ensure proper wiring and follow the recommended configuration for your chosen development platform.

Always verify power supply requirements and pin connections before powering up your project to avoid potential damage.