lamaPLC: ENS160 + AHT21 Air Quality Sensor - CO, ECO, TVOC, Temp & Humidity Module

ENS160 + AHT21 Air Quality Sensor The ENS160 + AHT21 Air Quality Module is a combined environmental sensor board that measures indoor air pollutants (VOCs, eCO2, AQI) and climate conditions (Temperature, Humidity). It is a popular upgrade for older sensors like the CCS811 due to its integrated sensor fusion and automatic calibration.

  • Detection of reducing (VOC) and oxidizing gases (such as NO2)
  • MOX supports up to 4 gas sensors
  • Integrated sensor measurement and heater drive control
  • Integrated pre-calibrated sensor fusion and automatic correction algorithm

Key Capabilities

  • ENS160 (Air Quality): Uses Metal-Oxide (MOX) technology to detect reducing and oxidizing gases.
    • Outputs: Total Volatile Organic Compounds (TVOC), equivalent CO2 (eCO2) ), and Air Quality Index (AQI).
    • Target Gases: Ethanol, toluene, hydrogen, NO2, and ozone.
  • AHT21 (Climate): A high-precision digital temperature and humidity sensor.
    • Temperature: ±0.3 °C accuracy; range of -40 °C to +120 °C.
    • Humidity: ±2 % RH accuracy; range of 0 to 100 % RH.

Technical Specifications

FeatureSpecification
Supply Voltage (VIN)2.0V to 5.5V DC (Breakout boards often regulate to 3.3V)
InterfaceI²C (Standard) or SPI (ENS160 only)
I2C AddressesENS160: 0x53 (default) or 0x52; AHT21: 0x38
Warm-up Time < 1 minute for immediate use; up to 1 An hour for full accuracy
Power Use1.2 to 46 mW depending on operating mode

Pinout

Pin NameTypeDescription
VIN / VCCPowerPower supply input. Usually supports 3.3V to 5V due to onboard regulators.
GNDPowerGround connection.
SCLI²CSerial Clock line for both ENS160 and AHT21.
SDAI²CSerial Data line for both ENS160 and AHT21.
ADDR / ADOControl(Optional) I²C address selection for ENS160. Connect to GND for 0x52 or VCC for 0x53.
INTOutput(Optional) Interrupt pin; can signal when new data is ready.

Example Arduino code

To use the ENS160 + AHT21 module with Arduino, you'll typically need two libraries from the Arduino Library Manager: Adafruit ENS160 and Adafruit AHTX0.

Install Required Libraries

Open the Arduino IDE and install the following:

  • Adafruit ENS160 Library
  • Adafruit AHTX0 Library (works for both AHT20 and AHT21)
  • Adafruit Unified Sensor (dependency for many Adafruit libraries)

This code initializes both sensors via I²C and prints climate and air quality data to the Serial Monitor every two seconds.

#include <Wire.h>
#include <Adafruit_ENS160.h>
#include <Adafruit_AHTX0.h>
 
Adafruit_ENS160 ens160;
Adafruit_AHTX0 aht;
 
void setup() {
  Serial.begin(115200);
  while (!Serial) delay(10); // Wait for Serial Monitor
 
  Serial.println("ENS160 + AHT21 Test");
 
  // Initialize AHT21 (Address 0x38)
  if (!aht.begin()) {
    Serial.println("Could not find AHT21 sensor!");
    while (1) delay(10);
  }
  Serial.println("AHT21 initialized.");
 
  // Initialize ENS160 (Address 0x53 or 0x52)
  // Most combo boards default to 0x53
  if (!ens160.begin(0x53)) {
    Serial.println("Could not find ENS160 sensor!");
    while (1) delay(10);
  }
 
  // Set operating mode: Standard (detecting)
  ens160.setMode(ENS160_OPMODE_STD);
  Serial.println("ENS160 initialized.");
}
 
void loop() {
  // 1. Read Climate Data from AHT21
  sensors_event_t humidity, temp;
  aht.getEvent(&humidity, &temp);
 
  // 2. Feed Temperature/Humidity to ENS160 for better accuracy
  ens160.setTempRH(temp.temperature, humidity.relative_humidity);
 
  // 3. Read Air Quality Data from ENS160
  if (ens160.available()) {
    Serial.print("Temp: "); Serial.print(temp.temperature); Serial.println(" C");
    Serial.print("Humidity: "); Serial.print(humidity.relative_humidity); Serial.println(" %");
 
    Serial.print("AQI: "); Serial.println(ens160.getAQI());
    Serial.print("TVOC: "); Serial.print(ens160.getTVOC()); Serial.println(" ppb");
    Serial.print("eCO2: "); Serial.print(ens160.getECO2()); Serial.println(" ppm");
    Serial.println("-----------------------");
  }
 
  delay(2000);
}

Usage Tips

  • Baud Rate: Set your Serial Monitor to 115200 to match the code above.
  • Warm-up: The ENS160 requires about 1 hour to achieve full accuracy, though it will start providing initial readings within 1 minute.
  • Address Conflict: If the ENS160 is not found, try changing ens160.begin(0x53) to ens160.begin(0x52).
  • Library Alternatives: If the Adafruit library doesn't work for your specific breakout, the DFRobot_ENS160 library is a highly compatible alternative.

I2C topics on lamaPLC

PageDateTags
2025/05/31 21:56, , , , , , ,
2025/09/23 19:25, , , , , ,
2026/03/21 19:20, , , , , , ,
2026/02/15 20:33, , , , , , , , ,
2026/02/14 22:24, , , , , , , , , , , , ,
2026/02/15 20:40, , , , , , , , , , , , , ,
2026/02/14 23:37, , , , , , , , , , ,
2026/02/14 22:40, , , , , , , , , ,
2026/03/21 22:25, , , , , , , , , , ,
2026/02/14 18:19, , , , , , , , , , ,
2026/02/14 18:11, , , , , , , ,
2025/05/31 21:32, , , , , , , ,
2026/02/14 19:29, , , , , , , , , , , , , ,
2025/11/21 23:07, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
2023/07/01 15:29, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
2026/03/22 00:26, , , , , , , , ,
2026/02/14 22:45, , , , , , , , ,
2026/02/14 22:09, , , , , , , , , , , , , , , ,
2026/02/14 17:26, , , ,
2026/02/14 21:54, , , , , , , , , , , , , , , , , , , , , , , , ,
2026/02/14 23:58, , , , , , , , , , ,
2026/02/14 17:27, , , , , , , , , ,
2026/02/14 23:38, , , , , , ,
2026/02/14 22:52, , , , , , , ,
2026/02/14 22:23, , , , , , , ,
2026/02/14 22:53, , , , , , , , , , , , ,
2026/02/15 20:27, , , , , , , , , , , , , , , ,
2026/02/15 20:29, , , , , , , , , , , , , ,
2026/02/14 22:47, , , ,
2026/02/14 22:51, , , , , ,
2026/02/14 17:26, , , ,
2026/02/14 22:22, , , , , , , , , , , , ,
2026/02/14 22:21, , , , , , , , , , ,
2026/02/14 22:22, , , , , , , ,
2026/03/05 20:19, , , , , , , , , , , , , , , , ,
2026/02/14 17:27, , , , , , ,

This page has been accessed for: Today: 7, Until now: 18