ESPHome Air Quality Sensor System (SEN6x)
Table of Contents
A simple CO2 sensor is often not enough for precise monitoring of indoor air quality. In this project I show the construction of a fully dynamic air quality monitor based on ESPHome. The special feature: The system can be completely configured at runtime via a web interface without re-flashing and solves the specific hardware challenges of professional sensors.
Die Hardware-Basis
The system relies on high-quality and compact components:
-
Microcontroller: An ESP32-C3-DevKitM-1 provides sufficient power for the display and ensures a stable WLAN connection.
-
Sensory: The Sensirion SEN66 (compatible with SEN6x/SEN5x) is an all-in-one sensor for measuring CO2, particulate matter (PM1.0, PM2.5, PM4.0, PM10), volatile organic compounds (VOC), nitrogen oxides (NOx), as well as temperature and humidity.
-
Display: A round 1.28 inch LCD with GC9A01 Controller, controlled via SPI.
I also designed a suitable housing for the project that ensures optimal airflow for the sensor and accommodates all components compactly.
Software features and technical highlights
The firmware is based on ESPHome and uses the LVGL library for the graphical interface. The focus during development was on maximum flexibility and physical accuracy.
1. Fully dynamic UI & headless operation
The device is designed as a true standalone system. It doesn't necessarily require a cloud or even an active Home Assistant instance. Thanks to the integrated ESPHome web server, the device can be operated headless via any browser in the local network. All assignments (which measured value is displayed on which display slot), colors, theme settings (dark/light mode) and refresh rates can be changed live in the web UI. The display adjusts in real time.
2. Specific Sensirion gas engine logic
Gas sensors for CO2, VOC and NOx require a continuous warm-up period to calculate correct baselines. Simply restarting the query timer would hard reset the sensor and distort the measured values. The firmware therefore uses decoupled query logic: The sensor runs internally in continuous operation at a 24-hour interval, while a separate, customizable script retrieves the data gently and asynchronously at the desired interval (e.g. every 30 seconds) via the I2C bus.
3. Dynamic moisture compensation (Magnus formula)
Compact housings generate waste heat, which requires a temperature offset in the software. However, the relative humidity is physically directly dependent on the temperature. If only the temperature is calibrated, the accuracy of the displayed humidity decreases. The firmware therefore calculates via the Magnus-Tetens-Formula the current saturation vapor pressure and corrects the relative humidity to match the set temperature offset. This means that the displayed measured values remain physically consistent.
4. Individual alarm limits
In order to be able to assess the air quality at a glance, 21 individual limit values (three levels each for seven sensors) were implemented. If a value exceeds the defined limit, the corresponding sheet or text on the display automatically turns into the desired warning color (e.g. yellow, orange or red). These threshold values and colors can also be easily set via the user interface.
Resources & Download
The project is completely open source. I make the complete ESPHome code (YAML) and the 3D model for the housing available on GitHub and Thingiverse:
-
Firmware / source code: Click here for the GitHub repository
-
3D printing housing (STL/STEP): Click here for the Thingiverse project
-
Driver: The excellent SEN6x driver from the repository is used as a custom component tuct/esphome-projects used.
AGML battery charger








