ESPHome Air Quality Sensor System (SEN6x)

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.

ESP32-C3 SEN66 Sensor #1

ESP32-C3 SEN66 Sensor #1

ESP32-C3 SEN66 Sensor #2

ESP32-C3 SEN66 Sensor #2

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:

ESP32-C3 SEN66 Sensor #11

ESP32-C3 SEN66 Sensor #11

AGML battery charger

ESP32-C3 SEN66 Sensor #4

ESP32-C3 SEN66 Sensor #4

ESP32-C3 SEN66 Sensor #5

ESP32-C3 SEN66 Sensor #5

ESP32-C3 SEN66 Sensor #6

ESP32-C3 SEN66 Sensor #6

ESP32-C3 SEN66 Sensor #7

ESP32-C3 SEN66 Sensor #7

ESP32-C3 SEN66 Sensor #10

ESP32-C3 SEN66 Sensor #10

You may so like...

9 Responses

  1. Dre says:

    Hi, in picture #3 there is what looks like a gray foam insert where the sensor is placed in the housing. Does that come with the sensor? Looks like it was cut with a machine. If not, where did you get that?

    • 360customs says:

      Hi, this is correct it is cut from EVA foam with a laser. The sensor does not come with it. I uploaded the shape on thingiverse.com (hopefully). These came from sensirion from the sensors fact page.

      Best regards

      • Dre says:

        You got an awesome project here and I’m trying to do it myself. I found your thingiverse page (the link in the article points to github instead), but cannot find the cutout for the foam. It’s the missing piece for me, if you could upload that,I’d really appreciate it. How thick was the foam you used to fit it well to the case? I assume you’re located in Germany. I’m in Switzerland. Any recommendations on EVA cutting? I’ve never done that before.

        Modifications I’m planning to do to your design: I’ll upgrade to ESP32-C6 (about 3mm longer) and will try to add an ambient light sensor to control the screen. I understand you have hard-coded that (or are controlling it through HA)?

        Also happy if you send me the details via email.

        • 360customs says:

          Display brightness and Day/Night mode are available in HA for manipulation. Nothing is hardcoded. I use the sun modifier for decision to alter brightness. It’s all in the ESPHome code.

          EVA is 2 or 3 mm from a multiple color sheet pack, nothing special. I cut this on a cheap 5W UV-laser at “medium” power/speed.

      • Dre says:

        I found the foam STEP file on the sensiron page, see link below.

  2. I tried to manhandle it but got bun all over it.

  3. stratos says:

    Hello iam interested in building the same project can you please ask for more details?
    Cause i dont know how to program arduino.
    Thx

  4. Before that says:

    Can you send me the diagram of the cables? how to connect?

Leave a reply

Your email address will not be published. Required fields are marked *

* Checkbox GDPR is required,,en,This form collects your name, email and content so that we can keep track of the comments placed on the website. For more info check our privacy policy where you'll get more info on where, how and why we store your data.,,en,I agree,,en

*

I agree