Build a DIY Air Quality Sensor With ENS160 & ESP32-C3 Super Mini

by aggourodolmas in Circuits > Microcontrollers

3 Views, 0 Favorites, 0 Comments

Build a DIY Air Quality Sensor With ENS160 & ESP32-C3 Super Mini

PhotoRoom-20250505_123754.jpg

Why Build an Air Quality Sensor?


As a parent, ensuring a healthy environment for my baby is a top priority. Indoor air quality (IAQ) can significantly impact health, especially for infants who are more sensitive to pollutants like volatile organic compounds (VOCs), carbon dioxide (CO₂), and particulate matter. Commercial air quality monitors can be expensive, so I decided to build my own using affordable yet reliable components.

Requirements of this project are a working Home Assistant intance and a temperature/ humidity sensor that publishes records to Home Assistant, ideally in the same room where the air quality sensor is going to be placed.

This DIY air quality sensor monitors:

  1. Total VOCs (TVOC) – Harmful gases emitted from cleaning products, paints, and furniture.
  2. eCO₂ (equivalent CO₂) – Indicates ventilation quality.
  3. Air Quality Index (AQI) – A simplified metric for overall air health.


Since the ENS160 sensor doesn’t measure temperature and humidity—critical factors for comfort—I integrated external sensor data from Home Assistant to enhance accuracy.

Supplies

26892-ESP32-C3-SuperMini-4.jpg
ens160.PNG

Hardware Overview


ENS160 Sensor

ENS160 Digital Metal Oxide Multi-Gas Sensors are based on metal oxide (MOX) technology with four MOX sensor elements, and each sensor element has independent hotplate control to detect a wide range of gases. The ENS160 series features TrueVOC™ air quality detection and supports intelligent algorithms, which calculate CO2 equivalents, TVOC, and air quality indices (AQIs). Those sensors are ideal for home appliances, IoT devices, building automation, and HVAC applications.


ESP32-C3 Super Mini

The ESP32-C3 SuperMini is a tiny yet powerful development board built around the Espressif ESP32-C3 chip. With WiFi 802.11b/g/n and Bluetooth 5 (LE), it’s perfect for IoT projects that need reliable wireless connectivity. Designed with a compact form factor, this board is easy to integrate into space-constrained projects. With its versatile interfaces (UART, I2C, SPI) and plenty of GPIOs, the ESP32-C3 SuperMini is a great choice for this project!

Wiring the Components

PXL_20250502_181652643.jpg
dia4.png

The ENS160 communicates via I²C. Here’s how to connect it to the ESP32-C3 Super Mini:

ENS160 Pin ESP32-C3 Pin
VCC 3.3V
GND GND
SDA GPIO8
SCL GPIO9

Software Setup

Although there are reliable micropython libraries for this type of sensor I prefered the espHome framework solution. Main reasons for this approach were the need to connect the sensor to my Home Asssistant instance without much of a hassle and the ability to obtain temperature and humidity values -critical factors for reliable outputs- from another sensor connected to Home Assistant in the same room.

In the following yaml file replace sensor.your-room-sensor-temperature and sensor.your-room-sensor-humidity with those that match your set up in Home Assistant.

ens160.yaml file

##rest of your yaml file##
[...]
captive_portal:

i2c:
sda: GPIO8
scl: GPIO9
scan: true
id: bus_a

sensor:
- platform: homeassistant
name: "Room Temperature"
entity_id: sensor.your-room-sensor-temperature
id: room_temp
internal: true # hides from HA (optional)
accuracy_decimals: 1
unit_of_measurement: "°C"

- platform: homeassistant
name: "Room Humidity"
entity_id: sensor.your-room-sensor-humidity
id: room_hum
internal: true
accuracy_decimals: 1
unit_of_measurement: "%"

- platform: ens160_i2c
eco2:
id: ens160_eco2
name: "ENS160 eCO2"
tvoc:
id: ens160_tvoc
name: "ENS160 Total Volatile Organic Compounds"
aqi:
id: ens160_aqi
name: "ENS160 Air Quality Index"
update_interval: 180s
address: 0x52
compensation:
temperature: room_temp
humidity: room_hum

Enclosure & Final Assembly

PXL_20250503_195825634.jpg
PXL_20250503_195833556.jpg
PXL_20250503_200030520.jpg
PXL_20250504_070732450.jpg
PXL_20250506_052809254.jpg
lovelace.PNG

To keep the project neat and safe, I designed a 3D-printed case to house the ESP32-C3 and ENS160 sensor.

You can find those files in the following link. Be sure to read print instructions for further details.