LamaPLC: AHT20 / BMP280 Modul

AHT20 / BMP280 Modul This compact module integrates an AHT20 sensor for air temperature and humidity with a BMP280 sensor for air pressure, offering a complete overview of environmental conditions. Both sensors are popular for their accuracy and small size. Communication is straightforward through the I²C interface, compatible with various microcontrollers, with an operating voltage range of 2-5V.

Technical Details

  • Operating voltage: DC 2..5V
  • Sensors: AHT20, BMP280
  • Dimensions: 16 x 16.5 x 3 mm
  • Weight: 4 g
  • I²C Addresses
    • BMP280: 0x77
    • AHT20: 0x38
  • Air pressure
    • Measurement range: 300 to 1100 hPa
    • Resolution: 0.18 Pa
    • Accuracy: ±1 Pa
  • Humidity
    • Resolution: 0.024 %RH
    • Tolerance: ±2 %RH
    • Reproducibility: ±0.1 %RH
    • Response time: 8 seconds
    • Measurement range: 0-100 %RH
    • Long-term drift: <0.5 %RH/year
  • Temperature
    • Resolution: 0.01℃
    • Tolerance: ±0.3℃
    • Reproducibility: ±0.1℃
    • Response time: minimum 5 seconds, maximum 30 seconds
    • Measurement range: -40℃ to 85℃
    • Long-term drift: <0.04℃/year

If you'd like to support the development of the site with the price of a coffee — or a few — please do so here.

Here's a handy tip: you can quickly save this page as a PDF by clicking “export to PDF” in the menu on the right side of the screen.

2026/02/14 17:23

Arduino wiring

  • SCL: A5
  • GND: GND
  • SDA: A4
  • Vdd: 5V

Arduino code

For some reason, the Adafruit BMP280 library doesn't work reliably. It eventually freezes so severely that it only functions when the Arduino is powered off. I tried different parameter settings, but it didn't make a difference. It seems that the BMx280MI library written by Gregor Christandl works better.

// lamaPLC AHT20+BMP280 module test
// 2025.10.08. free code
 
#include <Arduino.h>
#include <Wire.h>
#include <Adafruit_AHTX0.h>
#include <BMx280I2C.h>
 
#define I2C_ADDRESS 0x77
 
Adafruit_AHTX0 aht;
 
BMx280I2C bmx280(I2C_ADDRESS);
 
void(* resetFunc) (void) = 0; //declare reset function @ address 0
 
void setup() {
  Serial.begin(9600);
  Wire.begin();
  Serial.println("AHT20+BMP280 module test");
 
  if  (!aht.begin()) {
    Serial.println("Could not find a valid AHT20 sensor, check wiring!"); 
    while (1);
  }
 
  if  (!bmx280.begin()) {
    Serial.println("Could not find a valid BMP280 sensor, check wiring!"); 
    while (1);
  }   
	bmx280.resetToDefaults();
 
	//set an oversampling setting for pressure and temperature measurements. 
	bmx280.writeOversamplingPressure(BMx280MI::OSRS_P_x16);
	bmx280.writeOversamplingTemperature(BMx280MI::OSRS_T_x16);
 
  Serial.println("AHT20 / BMP280 module ok");
}
 
void loop() {
  Serial.println("check ----------------------------------------------------------");
 
  //start AHT20 measurement
  sensors_event_t humidity, temp;
  aht.getEvent(&humidity, &temp);
  Serial.print("AHT 20 Temperature: "); Serial.print(temp.temperature); Serial.println(" degrees C");
  Serial.print("AHT 20 Humidity: "); Serial.print(humidity.relative_humidity); Serial.println("% rH");
 
	//start BMP280 measurement
	if (!bmx280.measure())
	{
		Serial.println("could not start measurement, is a measurement already running?");
		return;
	}
 
	//wait for the measurement to finish
	do
	{
		delay(100);
	} while (!bmx280.hasValue());
 
	Serial.print("BMP280 Pressure: "); Serial.print(bmx280.getPressure()); Serial.println(" Pa");
	Serial.print("BMP280 Pressure (64 bit): "); Serial.print(bmx280.getPressure64()); Serial.println(" Pa");
	Serial.print("BMP280 Temperature: "); Serial.print(bmx280.getTemperature()); Serial.println(" degrees C");
 
  Serial.println();
  delay(5000);
}

code in github: https://github.com/lamaPLC/AHT20-BMP280-Modul-Arduino-code

Output on the serial monitor:

check ----------------------------------------------------------
AHT 20 Temperature: 22.12 degrees C
AHT 20 Humidity: 62.55% rH
BMP280 Pressure: 99128.00 hPa
BMP280 Pressure (64 bit): 99125.84 hPa
BMP280 Temperature: 23.17 degrees C

Example codes

I²C topics on lamaPLC

PageDateTags
2025/05/31 21:56, , , , , , ,
2025/09/23 19:25, , , , , ,
2026/02/08 21:15, , , , , , , , ,
2026/02/10 16:04, , , , , , , , , , , , ,
2026/02/09 13:15, , , , , , , , , , , ,
2026/02/13 15:19, , , , , , , , , , ,
2026/02/13 21:22, , , , , , , , , ,
2026/02/09 13:25, , , , , , , , , , ,
2026/02/08 22:23, , , , , , , ,
2025/05/31 21:32, , , , , , , ,
2026/02/09 13:34, , , , , , , , , , , , , ,
2025/11/21 23:07, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
2023/07/01 15:29, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
2026/02/11 18:09, , , , , , , , ,
2026/02/09 13:55, , , , , , , , , , , , , , , ,
2026/02/11 21:07, , , ,
2026/02/09 13:39, , , , , , , , , , , , , , , , , , , , , , , , ,
2026/02/11 19:34, , , , , , , , , , ,
2026/02/11 21:07, , , , , , , , , ,
2026/02/12 19:34, , , , , , ,
2025/12/04 00:34, , , , , , , ,
2026/02/10 18:52, , , , , , , ,
2026/02/14 16:08, , , , , , , , , , , , ,
2026/02/08 23:27, , , , , , , , , , , , , , , ,
2026/02/09 13:48, , , , , , , , , , , , , ,
2025/11/22 19:12, , , ,
2025/11/22 18:48, , , , , ,
2026/02/11 21:07, , , ,
2026/02/09 16:09, , , , , , , , , , , , ,
2026/02/09 15:44, , , , , , , , , , ,
2026/02/09 15:56, , , , , , , ,
2026/02/11 21:07, , , , , , ,



This page has been accessed for: Today: 1, Until now: 82