The temperature and humidity sensor market for hobbyists has evolved significantly. While DHT11 and DHT22 dominated for years, a newer generation of I2C sensors has taken over — offering better accuracy, faster response, and lower power consumption. The two most popular options right now are the AHT20 and the BME280, and the choice between them determines not just cost but capabilities for your entire weather station, HVAC controller, or IoT sensor node project.
In this comprehensive comparison, we’ll examine every relevant aspect of both sensors — specifications, accuracy, wiring, library support, power consumption, and real-world performance — so you can make an informed choice for your specific application.
AHT20: Specifications and Overview
The AHT20 is manufactured by ASAIR (Aosong Electronic) and is the successor to the popular AHT10. It’s a fully calibrated, digital temperature and humidity sensor in a small reflow-solderable package. The AHT20 improved on the AHT10 primarily in humidity accuracy and response time.
AHT20 Key Specifications:
- Supply voltage: 2.0V – 5.5V
- Interface: I2C only (address: 0x38, fixed)
- Temperature range: -40°C to +85°C
- Temperature accuracy: ±0.3°C (typical)
- Humidity range: 0–100% RH
- Humidity accuracy: ±2% RH (typical, 20–80% RH)
- Humidity resolution: 0.024% RH
- Temperature resolution: 0.01°C
- Response time: ~5 seconds (humidity); ~8 seconds to 63% of temperature step
- Measurement time: 75 ms per reading
- Sleep current: 25 μA
- Active current: 23 mA (during measurement burst, brief)
- Package: WLCSP (3mm × 3mm) — usually on a breakout board
- Price (breakout board): ₹80–150
What Makes AHT20 Special: The AHT20 uses a MEMS-based capacitive humidity sensor element combined with a platinum resistance temperature sensor. The humidity element directly measures changes in dielectric properties of a polymer membrane as it absorbs water vapour. This technique is inherently stable and doesn’t suffer from the long-term drift seen in older resistive humidity sensors. The AHT20 is factory-calibrated with coefficients stored in OTP memory on the chip.
Comparison with DHT22: The AHT20 is widely considered a superior replacement for the DHT22. Advantages: I2C interface (no timing-sensitive single-wire protocol), better humidity accuracy (±2% vs ±2–5%), wider supply voltage range, much faster repeat readings. The DHT22 requires a 2-second wait between measurements; the AHT20 can read every 75ms.
BME280: Specifications and Overview
The BME280 is manufactured by Bosch Sensortec and combines three sensors in one chip: temperature, humidity, and barometric pressure. Originally designed for weather stations, indoor navigation, and IoT nodes, it became one of the most popular environmental sensors in the maker community. Its combination of three measurements in one package at a reasonable price point is hard to beat.
BME280 Key Specifications:
- Supply voltage: 1.71V – 3.6V (level shifting required for 5V systems)
- Interface: I2C (0x76 or 0x77) and SPI (up to 10 MHz)
- Temperature range: -40°C to +85°C
- Temperature accuracy: ±0.5°C (typical, ±1°C full range)
- Humidity range: 0–100% RH
- Humidity accuracy: ±3% RH (typical)
- Pressure range: 300–1100 hPa
- Pressure accuracy: ±1 hPa (absolute), ±0.12 hPa (relative) = ~1 m altitude resolution
- Humidity response time: 1 second (τ 63%)
- Sampling modes: Weather monitoring, humidity sensing, indoor navigation, gaming, forced (one-shot)
- Sleep current: 0.1 μA
- Normal mode current: 633 μA (all sensors at 1 Hz)
- Price (breakout board): ₹200–400
What Makes BME280 Special: The pressure sensor is the key differentiator. BME280 can compute altitude with about 1 metre resolution using the barometric formula. It also has sophisticated internal oversampling settings that let you trade speed for noise reduction. The BME280’s indoor navigation mode samples at 25 Hz with IIR filtering, providing extremely smooth readings. The sleep current of 0.1 μA is best-in-class for any combined sensor module.
BME280 vs BMP280: A common source of confusion. The BMP280 is the cheaper sibling — it has temperature and pressure but NO humidity sensor. If you buy a BMP280 module expecting humidity readings, you’ll be disappointed. Always verify the chip marking on the module you receive — some sellers mislabel BMP280 as BME280.
Head-to-Head Comparison
| Parameter | AHT20 | BME280 |
|---|---|---|
| Price | ₹80–150 | ₹200–400 |
| Sensors | Temperature + Humidity | Temperature + Humidity + Pressure |
| Temperature accuracy | ±0.3°C | ±0.5°C |
| Humidity accuracy | ±2% RH | ±3% RH |
| Pressure | Not available | ±1 hPa |
| Supply voltage | 2.0–5.5V | 1.71–3.6V |
| Sleep current | 25 μA | 0.1 μA |
| I2C address flexibility | Fixed (0x38 only) | 0x76 or 0x77 |
| SPI support | No | Yes (up to 10 MHz) |
| 5V Arduino compatible | Yes (native) | Needs level shift or 3.3V Arduino |
| Measurement time | 75 ms | Configurable (2–40 ms typical) |
Accuracy Deep Dive
Both sensors are significantly more accurate than the older DHT11 (±2°C temperature, ±5% humidity) and competitive with DHT22 at lower cost. However, there are nuances worth understanding.
Temperature Accuracy: AHT20 wins here with ±0.3°C vs BME280’s ±0.5°C. However, both sensors suffer from self-heating — the chip itself generates heat during operation and measurement. This is worst in enclosed enclosures. The BME280’s forced mode (one reading then sleep) minimises self-heating. AHT20 has less self-heating issue in typical usage due to its lower normal-mode power draw.
Humidity Accuracy: AHT20 (±2% RH) slightly edges out BME280 (±3% RH) in the specification. In practice, both sensors agree to within 2–3% in controlled testing at 25°C, 50% RH. At extremes (below 20% RH or above 80% RH), both sensors show more deviation from reference instruments.
Humidity Response: BME280 wins with a 1-second response time vs AHT20’s 5-second response. For applications where you need to track rapid humidity changes (someone walks into a room, a door opens to humid outdoor air), the BME280 reacts 5× faster.
Long-Term Stability: Both sensors use capacitive MEMS humidity elements with similar long-term stability. Expect ±0.5% RH/year drift over a 5-year period — substantially better than resistive humidity sensors.
Temperature Self-Heating Warning: If you read BME280 in normal mode (continuous sampling), the die temperature can be 1–3°C above ambient in an enclosure. Always use forced mode for weather station applications: trigger a measurement, read the result, then put the sensor back to sleep.
Wiring Both Sensors
AHT20 to Arduino Uno (5V System)
AHT20 Module → Arduino Uno
----------- -----------
VIN → 5V (AHT20 handles 2–5.5V natively)
GND → GND
SCL → A5
SDA → A4
// Fixed I2C address: 0x38 — cannot be changed
// Add 4.7kΩ pull-ups on SDA and SCL if not on module
BME280 to Arduino Uno (Level Shifting Required)
// Option 1: Use 3.3V pin from Arduino (limited current, check your board)
BME280 Module → Arduino Uno
------------ -----------
VIN → 3.3V
GND → GND
SCL → A5 (with 4.7kΩ pull-up to 3.3V)
SDA → A4 (with 4.7kΩ pull-up to 3.3V)
SDO/AD0 → GND → I2C address 0x76
or → 3.3V → I2C address 0x77
// Option 2: Use GY-BME280-5V module (has built-in level shifter)
// Connect VIN to 5V directly — module handles 3.3V internally
Tip: The GY-BME280-5V variant has an onboard voltage regulator and level shifter, making it 5V compatible out of the box. For 5V Arduino users, this variant saves the level shifting hassle.
GY-BME280-5V Temperature and Humidity Sensor
The 5V-compatible BME280 breakout — no level shifting needed for Arduino Uno. Get temperature, humidity, and pressure in a single module that connects directly to 5V systems.
Arduino Code Examples
AHT20 with Adafruit AHTx0 Library
#include <Wire.h>
#include <Adafruit_AHTX0.h>
Adafruit_AHTX0 aht;
void setup() {
Serial.begin(115200);
if (!aht.begin()) {
Serial.println("AHT20 not found! Check wiring.");
while (1) delay(10);
}
Serial.println("AHT20 Initialized");
}
void loop() {
sensors_event_t humidity, temp;
aht.getEvent(&humidity, &temp);
Serial.print("Temperature: ");
Serial.print(temp.temperature, 2);
Serial.print(" °C | Humidity: ");
Serial.print(humidity.relative_humidity, 2);
Serial.println(" %RH");
// Calculate Heat Index (feels-like temperature)
float heatIndex = computeHeatIndex(temp.temperature, humidity.relative_humidity);
Serial.print("Heat Index: ");
Serial.print(heatIndex, 1);
Serial.println(" °C");
delay(2000);
}
float computeHeatIndex(float t, float h) {
// Simplified heat index formula
if (t < 27 || h < 40) return t; // Only valid at high temps/humidity
return -8.78 + 1.611*t + 2.339*h - 0.1461*t*h
- 0.01230*t*t - 0.01642*h*h + 0.002212*t*t*h
+ 0.000723*t*h*h - 0.000003582*t*t*h*h;
}
BME280 with Forced Mode (Anti-Self-Heating)
#include <Wire.h>
#include <Adafruit_BME280.h>
Adafruit_BME280 bme;
void setup() {
Serial.begin(115200);
if (!bme.begin(0x76)) {
Serial.println("BME280 not found! Try 0x77 if using SDO=VCC");
while (1) delay(10);
}
// Configure for weather station mode (minimise self-heating)
bme.setSampling(Adafruit_BME280::MODE_FORCED,
Adafruit_BME280::SAMPLING_X1, // temperature
Adafruit_BME280::SAMPLING_X1, // pressure
Adafruit_BME280::SAMPLING_X1, // humidity
Adafruit_BME280::FILTER_OFF);
}
void loop() {
// In forced mode, each call to takeForcedMeasurement() wakes sensor,
// reads once, then returns to sleep — minimises self-heating
bme.takeForcedMeasurement();
float temp = bme.readTemperature();
float humidity = bme.readHumidity();
float pressure = bme.readPressure() / 100.0F; // hPa
float altitude = bme.readAltitude(1013.25); // sea-level pressure in hPa
Serial.print("T: "); Serial.print(temp, 2); Serial.print("°C | ");
Serial.print("H: "); Serial.print(humidity, 2); Serial.print("% | ");
Serial.print("P: "); Serial.print(pressure, 2); Serial.print("hPa | ");
Serial.print("Alt: "); Serial.print(altitude, 1); Serial.println("m");
delay(5000);
}
GY-BME280-3.3 Precision Altimeter Atmospheric Pressure Sensor
The 3.3V BME280 module for ESP32/ESP8266/STM32 projects — perfect for IoT weather nodes, altitude-aware drones, and home automation environment monitors.
Power Consumption Analysis
Power consumption matters greatly for battery-powered IoT deployments. Let’s compare the scenarios for a typical weather node reading every 60 seconds:
AHT20 Power Budget (reading every 60s):
- Active measurement (75 ms at ~23 mA peak): 75ms × 23 mA = 1.725 mAs
- Sleep (59.925 s at 25 μA): 59.925 s × 0.025 mA = 1.498 mAs
- Average current: ~54 μA
BME280 Power Budget (forced mode, reading every 60s):
- Forced measurement (2 ms at 633 μA): negligible
- Sleep (59.998 s at 0.1 μA): 59.998 s × 0.0001 mA = 0.006 mAs
- Average current: ~0.11 μA
Winner for battery life: BME280 by a very wide margin. On a 1000 mAh battery, AHT20 lasts ~21 months; BME280 in forced mode lasts over 1000 years theoretically (limited by self-discharge, but the point stands). For any long-term battery deployment, BME280 in forced mode is the clear choice.
Best Use Cases for Each
Choose AHT20 When:
- Budget is very tight — it’s roughly half the cost of BME280
- 5V Arduino compatibility without additional components
- Only temperature + humidity needed — you’ll never use the pressure sensor
- HVAC monitoring — temperature accuracy (±0.3°C) matters more than pressure
- Terrarium/vivarium monitoring — high accuracy humidity for reptile/amphibian habitats
- Indoor air quality panels connected to 5V systems
Choose BME280 When:
- Battery-powered outdoor IoT nodes where sleep current dominates battery life
- Weather station projects — pressure data enables storm forecasting
- Altitude measurement for drones, weather balloons, or rocketry
- ESP32/ESP8266 projects — both are 3.3V, no level shifting needed
- Fast humidity tracking — 1s response vs AHT20’s 5s
- Multiple sensors on one I2C bus — two addresses possible (0x76, 0x77)
Other Sensors to Consider
DHT20: Aosong’s newer version of the DHT series with I2C interface. Similar accuracy to AHT20 (same chip family) but with different protocol. Available in the SIP (System-in-Package) format.
DHT20 SIP Packaged Temperature and Humidity Sensor
The modern I2C successor to the DHT11/DHT22 series — same Aosong heritage as AHT20 with easy I2C interface, accurate readings, and Grove compatibility for quick projects.
SHT31: Sensirion’s premium humidity sensor. ±2% RH humidity, ±0.2°C temperature — slightly better than AHT20. More expensive (₹400–600) but with verified long-term stability data and industrial-grade certification. Worth the premium for professional deployments.
DHT11: The classic beginner sensor. Still cheap and functional but inferior to both AHT20 and BME280 in every metric. Only recommended for very first learning projects where breaking a sensor won’t hurt (it costs ₹30).
DHT11 Digital Relative Humidity and Temperature Sensor Module
The classic starter sensor for beginners learning temperature and humidity measurement with Arduino — simple one-wire protocol, widely documented, and extremely affordable.
Frequently Asked Questions
Is the AHT20 compatible with DHT22 code?
No. AHT20 uses I2C protocol, while DHT22 uses a custom single-wire protocol. You cannot use DHT.h library code with AHT20. You need the Adafruit AHTx0 library or similar I2C-based library. The hardware connection is also different (I2C uses SDA/SCL pins, not a single data pin).
Why does my BME280 always read 0% humidity?
You likely have a BMP280, not a BME280. They look identical on breakout boards and are often sold mixed together. Check the chip marking: BME280 has “BME2” printed on the tiny chip. BMP280 has “BMP2”. Alternatively, scan your I2C bus — BMP280 reports humidity register as 0 always, and some libraries will report 0% rather than an error.
Can I use AHT20 and BME280 on the same I2C bus?
Yes. AHT20 has address 0x38 (fixed), BME280 has address 0x76 or 0x77. No conflict. You can also use two BME280 sensors (one at 0x76, one at 0x77) on the same bus. This is useful for differential humidity measurements — inside vs outside, or top vs bottom of a room.
How accurate are these sensors for HVAC control?
Both are suitable for home HVAC control (±0.3–0.5°C temperature, ±2–3% humidity). For industrial HVAC (pharmaceutical, cleanroom, data center), you’d need calibrated instruments with traceable accuracy. Both sensors drift slightly over time and benefit from annual calibration against a reference hygrometer if precision is critical.
Does the BME280 need a heat guard or radiation shield outdoors?
Yes, for outdoor weather measurement. Direct sunlight heats the sensor casing and introduces error. Use a radiation shield (a stack of circular plates spaced for airflow, available 3D-printable or commercial). For indoor use or shaded outdoor installations, no shield is needed.
What is the minimum reading interval for AHT20?
75 ms is the measurement time, but you should wait at least 2 seconds between readings for the humidity sensor to stabilize, especially if humidity is changing. For stable environments, 500ms intervals are acceptable. The AHT20 has no explicit minimum interval limitation in the datasheet for the ADC, but thermal equilibration benefits from 1+ second intervals.
Conclusion: The Verdict
Both the AHT20 and BME280 are excellent sensors that leave older DHT-series sensors behind in every meaningful metric. Your choice should be guided by two factors: Do you need pressure/altitude measurement? And are you optimizing for battery life or 5V compatibility?
Get the AHT20 if you’re on a tight budget, working with 5V Arduino boards directly, and only need temperature and humidity. Its ±0.3°C accuracy is actually better than BME280 for temperature-only applications.
Get the BME280 if you want a complete environmental sensor (the pressure data is incredibly useful), if you’re running on batteries (0.1 μA sleep is extraordinary), or if you’re using 3.3V microcontrollers like ESP32.
For many projects — especially where cost matters — combine one BME280 (for the weather station outdoor unit) with one AHT20 (for the indoor unit), getting the best of both sensors while keeping costs sensible.
Add comment