Part

Air quality, ENS160

Air quality index 1 to 5, TVOC and eCO2 over I2C at 0x53, a sample a second, for ScioSense_ENS160.h.

See every part
  • 6 pins
  • 3 settings
  • In 1 project
Drawn live by the editor's own code, at the size you see it.
Air quality, ENS160 as drawn in the Mokxi simulator
At a glance

The Air quality, ENS160 in brief

What it is, and every setting the properties panel gives it.

The ScioSense ENS160 is a metal-oxide gas sensor with four tiny heated plates and its own processor. It gives an air quality index from 1 to 5, based on the guideline of Germany's environment agency (UBA), plus TVOC in parts per billion and eCO2 in parts per million. It talks over I2C at 0x53, or 0x52 with ADDR to GND. It does not measure CO2 itself; for that you need an NDIR sensor such as the SCD40. In standard mode it heats its plates and produces three readings every second. In Mokxi, three sliders set aqi (starting at 1), tvoc (starting at 0) and eco2 (starting at 400), and the simulator reports equivalent CO2 in ppm as the next sample will report it. The chip warms up for three minutes after power on, shown by validity bits in the status register. The board carries its own regulator and pull-ups, so 5 V on VIN is fine.

Family
Sensors
Pins
6
aqi
1
tvoc
0
eco2
400

A circuit built around it, running and explained: the Air quality sensor simulator.

Pins

6 pins

Named as the editor names them, so a wire lands where you expect it.

Pin
What it does
VIN
Supply, 3.3 or 5 V on the board (the chip's core runs from 1.8 V; the board's regulator and level shifters feed it).
GND
Ground.
SCL
I2C. The board carries the pull-ups.
SDA
I2C. The board carries the pull-ups.
ADDR
The address bit, read at power-up. The board pulls it up: 0x53. To GND it is 0x52.
INT
INTn, which the sketch can set to go active when new data is ready.
How to use it

How to use the ENS160 air quality sensor with an Arduino

The ENS160 air quality example is a built-in Mokxi project. An ENS160 board sits on an Arduino Uno's I2C pins and the sketch reads it with the ScioSense_ENS160.h library. It opens in the editor wired up and ready to run.

Wiring is simple. VIN goes to the Uno's 5V pin, GND to GND, SDA to A4 and SCL to A5. The board has its own regulator and pull-ups, so 5 V on VIN is fine. The sketch prints the air quality index, TVOC and eCO2 every second.

With the default settings, the serial monitor shows "ENS160 found at 0x53" then "AQI 1, TVOC 0 ppb, eCO2 400 ppm". That matches the starting values of the three sliders: aqi at 1, tvoc at 0 and eco2 at 400.

Move the sliders while it runs. Setting aqi to 3, tvoc to 300 and eco2 to 1200 changes the output to "AQI 3, TVOC 300 ppb, eCO2 1200 ppm". The next sample reports the new values. Try printing the warm-up flag, or turn on an LED when the AQI reaches 4.

Part pin
Goes to
VIN
Arduino Uno R3 pin 5V
GND
Arduino Uno R3 pin GND
SDA
Arduino Uno R3 pin A4
SCL
Arduino Uno R3 pin A5
ENS160 air qualitylive0.000 s 0.00x
Click to open it in the editor
This is the simulator itself, running here. Click anything to open it in the editor.
sketch.ino · Arduino Uno R3
// An ENS160 air quality sensor.
//
// The ENS160 answers at 0x53 (0x52 with ADDR to GND). begin() resets it and
// checks its part number; standard mode then heats its four tiny hot plates
// and gives three readings every second: the air quality index (1 excellent
// to 5 unhealthy, from Germany's UBA guideline), TVOC in ppb and eCO2 in
// ppm.
//
//   ENS160  VIN -> 5V, GND -> GND, SCL -> A5, SDA -> A4
//
// The board has its own regulator and pull-ups, so 5 V on VIN is fine.
// Move the three sliders while it runs.
//
// THINGS TO TRY. Print the warm-up flag: bits 2 and 3 of the status
// register (0x20) read 1 for the first three minutes. Then turn on an LED
// when the AQI reaches 4.

#include <Wire.h>
#include "ScioSense_ENS160.h"

ScioSense_ENS160 ens160(ENS160_I2CADDR_1);

void setup() {
  Serial.begin(9600);
  if (!ens160.begin()) {
    Serial.println("No ENS160 at 0x53: check SDA, SCL and power.");
    while (1) {}
  }
  Serial.println("ENS160 found at 0x53");
  ens160.setMode(ENS160_OPMODE_STD);
}

void loop() {
  if (ens160.measure(true)) {
    Serial.print("AQI ");
    Serial.print(ens160.getAQI());
    Serial.print(", TVOC ");
    Serial.print(ens160.getTVOC());
    Serial.print(" ppb, eCO2 ");
    Serial.print(ens160.geteCO2());
    Serial.println(" ppm");
  }
  delay(1000);
}
Common errors

Common Air quality, ENS160 errors and fixes

What goes wrong
The fix
The sketch prints "No ENS160 at 0x53" and stops.
Check SDA, SCL and power. SDA goes to A4 and SCL to A5 on the Uno, with VIN on 5V and GND on GND.
The sensor is not found because the sketch uses the wrong I2C address.
Most boards answer at 0x53, so use ENS160_I2CADDR_1. The library's default constructor is 0x52. With ADDR tied to GND the chip answers at 0x52.
Readings look odd right after power-up.
The chip warms up for the first three minutes. Bits 2 and 3 of the status register (0x20) read 1 during warm-up, then go to 0.
Sketch fails to compile because the wrong library is included.
Use ScioSense_ENS160.h. Mokxi ships the "ENS160 - Adafruit Fork". SparkFun's and DFRobot's libraries are not shipped.
Questions

Questions and answers

What does the ENS160 measure?

It gives an air quality index from 1 to 5, TVOC in parts per billion and eCO2 in parts per million. It makes three readings every second in standard mode.

Can the ENS160 measure carbon dioxide?

No. It reports eCO2, the CO2 level that would come with the measured compounds. For real CO2 you need an NDIR sensor such as the SCD40.

What voltage should I give the ENS160 board?

The board takes 3.3 or 5 V on VIN. It has its own regulator and level shifters, so 5 V works fine on an Arduino Uno.

What are the ENS160 settings in Mokxi?

There are three sliders: aqi starts at 1, tvoc starts at 0 and eco2 starts at 400. You can move them while the circuit runs, and the next sample reports the new values.

How it is modeled

What is true about the Air quality, ENS160, here

In its help article’s own words: what the simulation gets right, and where it stops.

Not modeled

The gas chemistry: the three readings are the three sliders, set apart from each other, so the UBA table that ties the index to TVOC is not applied. The one hour initial start-up of a brand new sensor (the part is taken as run in), the temperature and humidity compensation, the raw hot plate resistances (GPR_READ in standard mode reads zero, so the library's measureRaw() finds no new data), DATA_MISR, the custom heater sequences, SPI and the ENS161's low power mode are not simulated. The datasheet gives no start-up time, so the chip answers at once.

From ENS160 air quality sensor, in full.

Projects

See the Air quality, ENS160 in a project

One built-in project uses it. It opens in the editor, already wired.

Boards

The boards it is shown on

This board has a built-in project with the Air quality, ENS160 in it.

Wire up the Air quality, ENS160

Open the editor and push it into the breadboard. It is free, and it runs on your own machine.