Reference
ENS160
Air quality: AQI 1-5 (UBA), TVOC (ppb) and equivalent CO2 (ppm), with temperature/humidity compensation.
- Connects over
- I²C
- Address
- 0x53 (or 0x52)
- Made by
- ScioSense
- Datasheet
- sciosense.com
Use it
hardware {
device ens160: ENS160
}
every 1s {
let value: int = ens160.aqi()
log("ens160", "aqi={value}")
}
On its own, the declaration puts the ENS160 on the first I²C bus (SDA 21, SCL 22 on the ESP32) at 0x53. To choose the pins or the address, declare the bus and attach the device: device ens160: ENS160 on i2c0 at 0x52 with i2c i2c0(sda: 21, scl: 22).
Methods
-
ens160.aqi() -> int
Air quality index 1 (excellent) to 5 (unhealthy), UBA scale; 0 if unreadable.
-
ens160.eco2() -> int
Equivalent CO2 in ppm.
-
ens160.ready() -> bool
True when readings are valid (status 0).
-
ens160.set_compensation(temp_c: float, rh: float)
Ambient temperature (°C) and relative humidity (%) used for compensation.
-
ens160.status() -> int
Validity: 0 normal, 1 warm-up, 2 initial start-up (first 24 h), 3 invalid output, -1 no answer.
-
ens160.tvoc() -> int
Total volatile organic compounds in ppb.
Wiring
| Pin | Connect to |
|---|---|
VIN | 3.3V or 5V on breakouts with a regulator |
GND | Ground |
SDA | I2C data, pull-up on most breakouts |
SCL | I2C clock |
ADD | VCC = 0x53 (most breakouts), GND = 0x52 |
CS | Tie high for I2C |
Specifications
- Aqi
- 1 excellent - 5 unhealthy (UBA)
- Current
- ~30 mA in standard mode
- Eco2
- 400 - 65000 ppm
- Sample rate
- 1 Hz
- Tvoc
- 0 - 65000 ppb
- Voltage
- 1.71V - 1.98V die (breakouts regulate 3.3V/5V)
Tips
- status() is 0 when readings are valid, 1 during the ~3 min warm-up after each power-up, 2 during the first 24 h of the sensor's life.
- Feed it the real air temperature and humidity with set_compensation() (e.g. from the AHT21 on combo boards) for better accuracy.
- Common ENS160+AHT21 boards put both chips on the same I2C bus: declare an AHT20 next to it.
Alternatives worth knowing:
- SGP30: Similar TVOC/eCO2, no AQI index.
- SCD4x: True NDIR CO2 in ppm.