Cirkit Designer Logo
Cirkit Designer
Your all-in-one circuit design IDE
Home / 
Component Documentation

How to Use Adafruit AHT20 Temperature and Humidity Sensor: Examples, Pinouts, and Specs

Image of Adafruit AHT20 Temperature and Humidity Sensor
Cirkit Designer LogoDesign with Adafruit AHT20 Temperature and Humidity Sensor in Cirkit Designer

Introduction

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.

Explore Projects Built with Adafruit AHT20 Temperature and Humidity Sensor

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
Raspberry Pi Pico-Based Temperature and Humidity Monitoring System
Image of rpi pico with aht20: A project utilizing Adafruit AHT20 Temperature and Humidity Sensor in a practical application
This circuit connects an Adafruit AHT20 Temperature and Humidity Sensor to a Raspberry Pi Pico microcontroller. The AHT20 sensor communicates with the Raspberry Pi Pico via I2C protocol, using SCL and SDA lines for clock and data respectively. The sensor is powered by the Pico, with connections for VCC and GND to provide the necessary power supply.
Cirkit Designer LogoOpen Project in Cirkit Designer
Arduino Nano Weather Station with AHT10 Sensor and Wi-Fi Connectivity
Image of Grain Moisture Monitoring: A project utilizing Adafruit AHT20 Temperature and Humidity Sensor in a practical application
This circuit uses an Arduino Nano to read temperature and humidity data from an AHT10 sensor, display the data on a Serial Enabled 16x2 LCD, and transmit it over WiFi using an ESP8266-01 module. Power is managed through a Step Down Module and a Mini 360 Buck Converter to provide the necessary voltages for the components.
Cirkit Designer LogoOpen Project in Cirkit Designer
Arduino UNO with HTU21D-F Sensor for Temperature and Humidity Monitoring
Image of Interfacing HTU21D Temperature and Humidity Sensor with Arduino UNO: A project utilizing Adafruit AHT20 Temperature and Humidity Sensor in a practical application
This circuit connects an Arduino UNO microcontroller to an Adafruit HTU21D-F Temperature & Humidity Sensor. The Arduino is programmed to read temperature and humidity data from the sensor and output the readings to the Serial Monitor at half-second intervals. The sensor is powered by the Arduino's 5V output and communicates with the microcontroller via the I2C protocol using the SCL and SDA lines.
Cirkit Designer LogoOpen Project in Cirkit Designer
Arduino Nano-Based Weather Station with Wi-Fi Connectivity and Multiple AHT10 Sensors
Image of PS2_Group 5: A project utilizing Adafruit AHT20 Temperature and Humidity Sensor in a practical application
This circuit features an Arduino Nano microcontroller interfacing with three AHT10 temperature and humidity sensors, an ESP8266-01 WiFi module, and a 16x2 LCD display. It includes power regulation components to step down voltage and manage power distribution, and rocker switches for user input. The setup is designed for environmental monitoring and data display with potential for wireless communication.
Cirkit Designer LogoOpen Project in Cirkit Designer

Explore Projects Built with Adafruit AHT20 Temperature and Humidity Sensor

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
Image of rpi pico with aht20: A project utilizing Adafruit AHT20 Temperature and Humidity Sensor in a practical application
Raspberry Pi Pico-Based Temperature and Humidity Monitoring System
This circuit connects an Adafruit AHT20 Temperature and Humidity Sensor to a Raspberry Pi Pico microcontroller. The AHT20 sensor communicates with the Raspberry Pi Pico via I2C protocol, using SCL and SDA lines for clock and data respectively. The sensor is powered by the Pico, with connections for VCC and GND to provide the necessary power supply.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of Grain Moisture Monitoring: A project utilizing Adafruit AHT20 Temperature and Humidity Sensor in a practical application
Arduino Nano Weather Station with AHT10 Sensor and Wi-Fi Connectivity
This circuit uses an Arduino Nano to read temperature and humidity data from an AHT10 sensor, display the data on a Serial Enabled 16x2 LCD, and transmit it over WiFi using an ESP8266-01 module. Power is managed through a Step Down Module and a Mini 360 Buck Converter to provide the necessary voltages for the components.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of Interfacing HTU21D Temperature and Humidity Sensor with Arduino UNO: A project utilizing Adafruit AHT20 Temperature and Humidity Sensor in a practical application
Arduino UNO with HTU21D-F Sensor for Temperature and Humidity Monitoring
This circuit connects an Arduino UNO microcontroller to an Adafruit HTU21D-F Temperature & Humidity Sensor. The Arduino is programmed to read temperature and humidity data from the sensor and output the readings to the Serial Monitor at half-second intervals. The sensor is powered by the Arduino's 5V output and communicates with the microcontroller via the I2C protocol using the SCL and SDA lines.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of PS2_Group 5: A project utilizing Adafruit AHT20 Temperature and Humidity Sensor in a practical application
Arduino Nano-Based Weather Station with Wi-Fi Connectivity and Multiple AHT10 Sensors
This circuit features an Arduino Nano microcontroller interfacing with three AHT10 temperature and humidity sensors, an ESP8266-01 WiFi module, and a 16x2 LCD display. It includes power regulation components to step down voltage and manage power distribution, and rocker switches for user input. The setup is designed for environmental monitoring and data display with potential for wireless communication.
Cirkit Designer LogoOpen Project in Cirkit Designer

Common Applications and Use Cases

  • Weather stations and environmental monitoring
  • HVAC systems
  • IoT devices and smart home automation
  • Agricultural monitoring
  • Data logging and scientific experiments

Technical Specifications

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

Pin Configuration and Descriptions

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

Usage Instructions

How to Use the Component in a Circuit

  1. Power the Sensor: Connect the VIN pin to a 3.3V or 5V power source and the GND pin to ground.
  2. Connect I2C Lines: Connect the SCL pin to the I2C clock line and the SDA pin to the I2C data line of your microcontroller.
  3. Pull-Up Resistors: Ensure that the I2C lines (SCL and SDA) have pull-up resistors (typically 4.7kΩ). Many development boards, like the Arduino UNO, already include these resistors.
  4. Address Selection: The AHT20 has a fixed I2C address of 0x38, so no additional configuration is needed for address selection.

Important Considerations and Best Practices

  • Power Supply: Ensure a stable power supply within the specified voltage range to avoid inaccurate readings.
  • I2C Bus Speed: The sensor supports standard I2C speeds (100 kHz) and fast mode (400 kHz). Use a compatible speed for your microcontroller.
  • Environmental Factors: Avoid exposing the sensor to extreme conditions (e.g., condensation or dust) to maintain accuracy and longevity.
  • Warm-Up Time: Allow the sensor a brief warm-up period (e.g., 10 seconds) after powering it on for optimal performance.

Example Code for Arduino UNO

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
}

Troubleshooting and FAQs

Common Issues and Solutions

  1. Sensor Not Detected

    • Cause: Incorrect wiring or I2C address mismatch.
    • Solution: Double-check the wiring and ensure the sensor is connected to the correct I2C pins. Verify that the I2C address is set to 0x38 in your code.
  2. Inaccurate Readings

    • Cause: Environmental interference or insufficient warm-up time.
    • Solution: Ensure the sensor is in a stable environment and allow it to warm up for at least 10 seconds after powering on.
  3. I2C Communication Errors

    • Cause: Missing pull-up resistors or incorrect I2C bus speed.
    • Solution: Add 4.7kΩ pull-up resistors to the SCL and SDA lines if not already present. Check that the I2C bus speed is compatible with the sensor.

FAQs

  • Q: Can the AHT20 operate at 5V logic levels?

    • A: Yes, the AHT20 is compatible with both 3.3V and 5V logic levels.
  • Q: How often can I take readings from the sensor?

    • A: The sensor can provide readings approximately every 2 seconds. Avoid polling it too frequently to ensure accurate data.
  • Q: Is the sensor waterproof?

    • A: No, the AHT20 is not waterproof. Use a protective enclosure if deploying it in humid or wet environments.

This documentation provides a comprehensive guide to using the Adafruit AHT20 Temperature and Humidity Sensor effectively in your projects.