

The ENS160 is a digital metal-oxide (MOX) gas sensor designed for air quality monitoring. It provides accurate measurements of volatile organic compounds (VOCs) and equivalent CO2 (eCO2) levels. The AHT21, on the other hand, is a high-precision temperature and humidity sensor. When combined, the ENS160 and AHT21 form a powerful duo for environmental sensing, enabling applications such as indoor air quality monitoring, HVAC systems, and IoT-based environmental monitoring.








| Parameter | Value |
|---|---|
| Supply Voltage | 1.8V to 3.6V |
| Operating Temperature | -40°C to +85°C |
| Communication Interface | I²C, SPI |
| VOC Measurement Range | 0 to 65,535 (arbitrary units) |
| eCO2 Measurement Range | 400 ppm to 65,535 ppm |
| Power Consumption | < 3 mA (typical) |
| Parameter | Value |
|---|---|
| Supply Voltage | 2.2V to 5.5V |
| Operating Temperature | -40°C to +85°C |
| Humidity Range | 0% to 100% RH |
| Temperature Accuracy | ±0.3°C |
| Humidity Accuracy | ±2% RH |
| Communication Interface | I²C |
| Pin Name | Description |
|---|---|
| VDD | Power supply (1.8V to 3.6V) |
| GND | Ground |
| SDA | I²C data line |
| SCL | I²C clock line |
| INT | Interrupt output |
| RST | Reset input (active low) |
| Pin Name | Description |
|---|---|
| VDD | Power supply (2.2V to 5.5V) |
| GND | Ground |
| SDA | I²C data line |
| SCL | I²C clock line |
Wiring: Connect the ENS160 and AHT21 to the Arduino UNO as follows:
Install Libraries:
Adafruit_Sensor and Adafruit_AHTX0 libraries for the AHT21.ENS160 library (if available) or use a custom I²C communication library.Arduino Code: Below is an example code snippet to read data from both sensors:
#include <Wire.h>
#include <Adafruit_AHTX0.h> // Library for AHT21
#include <ENS160.h> // Library for ENS160 (replace with actual library)
Adafruit_AHTX0 aht; // Create AHT21 object
ENS160 ens160; // Create ENS160 object
void setup() {
Serial.begin(9600);
Wire.begin();
// Initialize AHT21
if (!aht.begin()) {
Serial.println("Failed to initialize AHT21!");
while (1);
}
Serial.println("AHT21 initialized.");
// Initialize ENS160
if (!ens160.begin()) {
Serial.println("Failed to initialize ENS160!");
while (1);
}
Serial.println("ENS160 initialized.");
}
void loop() {
// Read temperature and humidity from AHT21
sensors_event_t humidity, temp;
aht.getEvent(&humidity, &temp);
Serial.print("Temperature: ");
Serial.print(temp.temperature);
Serial.println(" °C");
Serial.print("Humidity: ");
Serial.print(humidity.relative_humidity);
Serial.println(" %");
// Read air quality data from ENS160
uint16_t voc = ens160.getVOC();
uint16_t eco2 = ens160.getECO2();
Serial.print("VOC: ");
Serial.print(voc);
Serial.println(" (arbitrary units)");
Serial.print("eCO2: ");
Serial.print(eco2);
Serial.println(" ppm");
delay(2000); // Wait 2 seconds before next reading
}
Sensors not detected on I²C bus:
Inaccurate readings:
Arduino code not compiling:
Q: Can I use both sensors on the same I²C bus?
A: Yes, the ENS160 and AHT21 have different I²C addresses, so they can share the same bus.
Q: How do I calibrate the ENS160?
A: The ENS160 automatically calibrates itself over time. For best results, expose it to clean air periodically.
Q: What is the typical response time of the sensors?
A: The AHT21 has a response time of approximately 8 seconds for humidity and temperature. The ENS160 typically updates VOC and eCO2 values every second.