meta data for this page
  •  

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
sensor:ens160 [2026/03/21 20:45] – created vamsansensor:ens160 [2026/03/22 02:14] (current) – [lamaPLC: ENS160 + AHT21 Air Quality Sensor - CO, ECO, TVOC, Temp & Humidity Module] vamsan
Line 1: Line 1:
 ====== lamaPLC: ENS160 + AHT21 Air Quality Sensor - CO, ECO, TVOC, Temp & Humidity Module ====== ====== lamaPLC: ENS160 + AHT21 Air Quality Sensor - CO, ECO, TVOC, Temp & Humidity Module ======
-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 NO<sup>2</sup>)+{{ :sensor:ens160_1.png?150|ENS160 + AHT21 Air Quality Sensor}} 
 +The ENS160 + AHT21 Air Quality Module is a combined environmental sensor board that measures indoor air pollutants (VOCs, eCO<sub>2</sub>, 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 NO<sub>2</sub>)
   * MOX supports up to 4 gas sensors   * MOX supports up to 4 gas sensors
   * Integrated sensor measurement and heater drive control   * Integrated sensor measurement and heater drive control
   * Integrated pre-calibrated sensor fusion and automatic correction algorithm   * Integrated pre-calibrated sensor fusion and automatic correction algorithm
  
-Key Capabilities +**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) +  * **ENS160 (Air Quality):** Uses Metal-Oxide (MOX) technology to detect reducing and oxidizing gases. 
-), and Air Quality Index (AQI). +    * **Outputs:** Total Volatile Organic Compounds (TVOC), equivalent CO<sub>2</sub> (eCO<sub>2</sub>) ), and Air Quality Index (AQI). 
-Target Gases: Ethanol, toluene, hydrogen,  +    * **Target Gases:** Ethanol, toluene, hydrogen, NO<sub>2</sub>, and ozone. 
-, and ozone. +  * **AHT21 (Climate):** A high-precision digital temperature and humidity sensor. 
-AHT21 (Climate): A high-precision digital temperature and humidity sensor. +    * **Temperature:** ±0.3 °C accuracy; range of -40 °C to +120 °C. 
-Temperature:  +    * **Humidity:** ±2 % RH accuracy; range of 0 to 100 % RH.  
- accuracy; range of  + 
- to  +**Technical Specifications** 
-+|< 100%>| 
-Humidity: +^Feature^Specification| 
 +^Supply Voltage (VIN)|2.0V to 5.5V DC (Breakout boards often regulate to 3.3V)| 
 +^Interface|[[com:basic_i2c|I²C]] (Standard) or [[com:basic_spi|SPI]] (ENS160 only)| 
 +^I2C Addresses|ENS160: **0x53** (default) or **0x52**; AHT21: **0x38**| 
 +^Warm-up Time| < 1 minute for immediate use; up to 1 An hour for full accuracy| 
 +^Power Use|1.2 to 46 mW depending on operating mode| 
 + 
 +==== Pinout ==== 
 +^Pin Name^Type^Description| 
 +^VIN / VCC|Power|Power supply input. Usually supports 3.3V to 5V due to onboard regulators.| 
 +^GND|Power|Ground connection.| 
 +^SCL|I²C|Serial Clock line for both ENS160 and AHT21.| 
 +^SDA|I²C|Serial Data line for both ENS160 and AHT21.| 
 +^ADDR / ADO|Control|(Optional) I²C address selection for ENS160. Connect to GND for 0x52 or VCC for 0x53.| 
 +^INT|Output|(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. 
 + 
 +<code c> 
 +#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); 
 +
 +</code> 
 + 
 +**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 ===== 
 +{{topic>i2c}}
  
- RH accuracy; range of  +{{tag>arduino ENS160 AHT21 Air_Quality sensor CO ECO TVOC module AQI}}
- to +
  
- RH. +This page has been accessed for: Today: {{counter|today}}, Until now: {{counter|total}}