

The Adafruit AHT20 is a digital sensor designed to measure temperature and humidity with high accuracy and precision. It features an I2C interface, making it easy to integrate into a wide range of projects, from environmental monitoring systems to IoT applications. The sensor is compact, reliable, and ideal for applications requiring precise environmental data.








The Adafruit AHT20 sensor offers the following key technical details:
| Parameter | Value |
|---|---|
| Supply Voltage | 2.0V to 5.5V |
| Operating Current | ~350 µA (measuring) |
| Standby Current | <1 µA |
| Temperature Range | -40°C to 85°C |
| Temperature Accuracy | ±0.3°C |
| Humidity Range | 0% to 100% RH |
| Humidity Accuracy | ±2% RH |
| Communication Interface | I2C |
| I2C Address | 0x38 |
| Dimensions | 15mm x 15mm x 2mm |
The Adafruit AHT20 sensor has four pins, as described in the table below:
| Pin | Name | Description |
|---|---|---|
| 1 | VIN | Power supply input (2.0V to 5.5V) |
| 2 | GND | Ground connection |
| 3 | SCL | I2C clock line |
| 4 | SDA | I2C data line |
Below is an example of how to use the Adafruit AHT20 sensor with an Arduino UNO. This code uses the Adafruit AHT20 library, which can be installed via the Arduino Library Manager.
#include <Wire.h>
#include <Adafruit_AHTX0.h>
// Create an instance of the AHT20 sensor
Adafruit_AHTX0 aht;
void setup() {
Serial.begin(9600);
while (!Serial) {
delay(10); // Wait for Serial Monitor to open
}
Serial.println("Adafruit AHT20 Temperature and Humidity Sensor Test");
// Initialize the sensor
if (!aht.begin()) {
Serial.println("Failed to find AHT20 sensor. Check wiring!");
while (1) {
delay(10); // Stay in loop if initialization fails
}
}
Serial.println("AHT20 sensor initialized successfully!");
}
void loop() {
// Get sensor readings
sensors_event_t humidity, temp;
aht.getEvent(&humidity, &temp);
// Print temperature and humidity to Serial Monitor
Serial.print("Temperature: ");
Serial.print(temp.temperature);
Serial.println(" °C");
Serial.print("Humidity: ");
Serial.print(humidity.relative_humidity);
Serial.println(" %");
delay(2000); // Wait 2 seconds before next reading
}
Sensor Not Detected
Inaccurate Readings
I2C Communication Errors
Q: Can the AHT20 operate at 5V logic levels?
Q: How often can I take readings from the sensor?
Q: Is the sensor waterproof?
This documentation provides a comprehensive guide to using the Adafruit AHT20 Temperature and Humidity Sensor effectively in your projects.