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

How to Use AHT20+BMP280: Examples, Pinouts, and Specs

Image of AHT20+BMP280
Cirkit Designer LogoDesign with AHT20+BMP280 in Cirkit Designer

AHT20 + BMP280 Sensor Module Documentation

1. Introduction

The AHT20 + BMP280 Sensor Module is a versatile environmental sensing device that combines two powerful sensors in a single module. The AHT20 is a high-precision temperature and humidity sensor, while the BMP280 is a barometric pressure sensor capable of measuring atmospheric pressure and altitude. Together, they provide a comprehensive solution for environmental monitoring applications.

Common Applications:

  • Weather stations
  • IoT (Internet of Things) devices
  • HVAC (Heating, Ventilation, and Air Conditioning) systems
  • Altitude measurement for drones and other vehicles
  • Environmental data logging
  • Smart agriculture systems

This module is commonly used with microcontrollers like the Arduino UNO, ESP32, and Raspberry Pi due to its I2C communication interface, which simplifies integration.


2. Technical Specifications

AHT20 Sensor Specifications:

Parameter Value
Supply Voltage 2.0V to 5.5V
Operating Current 0.25 mA (average)
Temperature Range -40°C to 85°C
Temperature Accuracy ±0.3°C
Humidity Range 0% to 100% RH
Humidity Accuracy ±2% RH
Communication Protocol I2C
I2C Address 0x38

BMP280 Sensor Specifications:

Parameter Value
Supply Voltage 1.71V to 3.6V
Operating Current 2.7 µA (in normal mode)
Pressure Range 300 hPa to 1100 hPa
Pressure Accuracy ±1 hPa
Temperature Range -40°C to 85°C
Temperature Accuracy ±1°C
Communication Protocol I2C or SPI
I2C Address 0x76 (default) or 0x77 (optional)

Pin Configuration:

Pin Description
VCC Power supply (3.3V or 5V)
GND Ground
SDA I2C data line
SCL I2C clock line

3. Usage Instructions

Connecting the AHT20 + BMP280 Module to an Arduino UNO:

  1. Wiring:

    • Connect the module's VCC pin to the Arduino's 5V pin.
    • Connect the GND pin to the Arduino's GND.
    • Connect the SDA pin to the Arduino's A4 pin (I2C data line).
    • Connect the SCL pin to the Arduino's A5 pin (I2C clock line).
  2. Install Required Libraries:

    • Install the Adafruit_AHTX0 library for the AHT20 sensor.
    • Install the Adafruit_BMP280 library for the BMP280 sensor.
    • These libraries can be installed via the Arduino IDE Library Manager.
  3. Sample Code: Below is an example Arduino sketch to read temperature, humidity, and pressure data from the AHT20 and BMP280 sensors.

#include <Wire.h>
#include <Adafruit_AHTX0.h>  // Library for AHT20
#include <Adafruit_BMP280.h> // Library for BMP280

// Create sensor objects
Adafruit_AHTX0 aht;
Adafruit_BMP280 bmp;

void setup() {
  Serial.begin(9600);
  while (!Serial); // Wait for Serial Monitor to open

  // Initialize AHT20 sensor
  if (!aht.begin()) {
    Serial.println("Failed to initialize AHT20 sensor!");
    while (1);
  }
  Serial.println("AHT20 sensor initialized.");

  // Initialize BMP280 sensor
  if (!bmp.begin(0x76)) { // Default I2C address for BMP280
    Serial.println("Failed to initialize BMP280 sensor!");
    while (1);
  }
  Serial.println("BMP280 sensor initialized.");
}

void loop() {
  // Read data from AHT20
  sensors_event_t humidity, temp;
  aht.getEvent(&humidity, &temp);

  // Read data from BMP280
  float pressure = bmp.readPressure() / 100.0F; // Convert to hPa
  float altitude = bmp.readAltitude(1013.25);  // Adjust sea level pressure as needed

  // Print sensor data to Serial Monitor
  Serial.print("Temperature (AHT20): ");
  Serial.print(temp.temperature);
  Serial.println(" °C");

  Serial.print("Humidity (AHT20): ");
  Serial.print(humidity.relative_humidity);
  Serial.println(" %");

  Serial.print("Pressure (BMP280): ");
  Serial.print(pressure);
  Serial.println(" hPa");

  Serial.print("Altitude (BMP280): ");
  Serial.print(altitude);
  Serial.println(" m");

  Serial.println("-----------------------------");
  delay(2000); // Wait 2 seconds before next reading
}

Important Considerations:

  • Ensure proper pull-up resistors (typically 4.7kΩ) are connected to the SDA and SCL lines if not already included on the module.
  • Use a stable power supply to avoid noise in sensor readings.
  • If using multiple I2C devices, ensure they have unique addresses or use an I2C multiplexer.

4. Troubleshooting and FAQs

Common Issues and Solutions:

  1. Problem: The sensors are not detected by the Arduino.

    • Solution: Check the wiring and ensure the SDA and SCL lines are correctly connected. Verify the I2C addresses of the sensors.
  2. Problem: Incorrect or fluctuating readings.

    • Solution: Ensure a stable power supply and avoid placing the sensors near heat sources or high-humidity areas.
  3. Problem: Compilation errors when uploading the code.

    • Solution: Ensure the required libraries (Adafruit_AHTX0 and Adafruit_BMP280) are installed and up to date.
  4. Problem: Altitude readings are inaccurate.

    • Solution: Adjust the sea-level pressure value in the code (1013.25 hPa by default) to match your local atmospheric pressure.

FAQs:

Q1: Can I use this module with a 3.3V microcontroller?
A1: Yes, the module supports both 3.3V and 5V logic levels.

Q2: Can I use SPI communication for the BMP280?
A2: Yes, the BMP280 supports SPI, but the AHT20 only supports I2C. For simplicity, use I2C for both sensors.

Q3: How do I extend the I2C cable length?
A3: Use shielded cables and lower the I2C clock speed to reduce noise and signal degradation.


This documentation provides a comprehensive guide to using the AHT20 + BMP280 sensor module. Whether you're a beginner or an experienced user, this guide will help you integrate the module into your projects effectively.

Explore Projects Built with AHT20+BMP280

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
ESP32-Based BMP280 Barometric Pressure Sensor Interface
Image of Esp32 and Bmp280: A project utilizing AHT20+BMP280 in a practical application
This circuit connects an ESP32 development board with a BMP280 sensor. The ESP32 provides power to the BMP280 and communicates with it via I2C, using GPIO 22 and GPIO 21 as the serial clock line (SCL) and serial data line (SDA), respectively. The purpose of this circuit is likely to read atmospheric pressure and temperature data from the BMP280 sensor.
Cirkit Designer LogoOpen Project in Cirkit Designer
ESP32 and BME280 Sensor-Based Wi-Fi Weather Station
Image of BME280_ESP32: A project utilizing AHT20+BMP280 in a practical application
This circuit consists of an ESP32 microcontroller connected to a BME/BMP280 sensor. The ESP32 reads temperature, pressure, and humidity data from the sensor via I2C communication and prints the data to the Serial Monitor.
Cirkit Designer LogoOpen Project in Cirkit Designer
ESP32-Based Environmental Sensing Station with Hall Effect Sensors and Logic Level Conversion
Image of Stazione meteo: A project utilizing AHT20+BMP280 in a practical application
This circuit is designed to collect environmental data using an ESP32 microcontroller connected to a BMP280 pressure sensor, an LTR390 UV light sensor, and a DHT22 temperature and humidity sensor. It also includes multiple 3144 Hall effect sensors interfaced through bi-directional logic level converters, indicating mixed voltage operation. The ESP32 serves as the central hub for sensor data acquisition and processing.
Cirkit Designer LogoOpen Project in Cirkit Designer
ESP32 and INA3221-Based Smart Power Monitoring System with Bluetooth and Environmental Sensing
Image of NMEA2000 Engine Interface: A project utilizing AHT20+BMP280 in a practical application
This circuit is a sensor monitoring and communication system that uses an ESP32 microcontroller to read data from a BME/BMP280 environmental sensor and an INA3221 power monitor. The ESP32 communicates with the sensors via I2C and transmits data wirelessly using an HC-05 Bluetooth module. Additionally, the circuit includes optocouplers and diodes for signal isolation and protection.
Cirkit Designer LogoOpen Project in Cirkit Designer

Explore Projects Built with AHT20+BMP280

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 Esp32 and Bmp280: A project utilizing AHT20+BMP280 in a practical application
ESP32-Based BMP280 Barometric Pressure Sensor Interface
This circuit connects an ESP32 development board with a BMP280 sensor. The ESP32 provides power to the BMP280 and communicates with it via I2C, using GPIO 22 and GPIO 21 as the serial clock line (SCL) and serial data line (SDA), respectively. The purpose of this circuit is likely to read atmospheric pressure and temperature data from the BMP280 sensor.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of BME280_ESP32: A project utilizing AHT20+BMP280 in a practical application
ESP32 and BME280 Sensor-Based Wi-Fi Weather Station
This circuit consists of an ESP32 microcontroller connected to a BME/BMP280 sensor. The ESP32 reads temperature, pressure, and humidity data from the sensor via I2C communication and prints the data to the Serial Monitor.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of Stazione meteo: A project utilizing AHT20+BMP280 in a practical application
ESP32-Based Environmental Sensing Station with Hall Effect Sensors and Logic Level Conversion
This circuit is designed to collect environmental data using an ESP32 microcontroller connected to a BMP280 pressure sensor, an LTR390 UV light sensor, and a DHT22 temperature and humidity sensor. It also includes multiple 3144 Hall effect sensors interfaced through bi-directional logic level converters, indicating mixed voltage operation. The ESP32 serves as the central hub for sensor data acquisition and processing.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of NMEA2000 Engine Interface: A project utilizing AHT20+BMP280 in a practical application
ESP32 and INA3221-Based Smart Power Monitoring System with Bluetooth and Environmental Sensing
This circuit is a sensor monitoring and communication system that uses an ESP32 microcontroller to read data from a BME/BMP280 environmental sensor and an INA3221 power monitor. The ESP32 communicates with the sensors via I2C and transmits data wirelessly using an HC-05 Bluetooth module. Additionally, the circuit includes optocouplers and diodes for signal isolation and protection.
Cirkit Designer LogoOpen Project in Cirkit Designer