ESP32 Projects
Start a build
Markdown

ESP32 Sen66 Airq for ESP32-C6

An ESP32 networking project for ESP32-C6.

ESP32-C6ESP-IDFUnrated
Parts and source

Before you start

Confirm board compatibility and supported firmware targets in the upstream documentation.

Upstream README

ESP32 SEN66 Air Quality Monitor

ESP-IDF v6.0.1 Target ESP32-C6 Sensor SEN66 License MIT

Native ESP-IDF firmware for an ESP32-C6-DevKitC-1 and Sensirion SEN66 indoor air quality sensor. It provides a lightweight web interface, JSON readings, Prometheus metrics, persistent sensor configuration, and HTTP OTA updates.

Air quality readings web interface

Features

  • PM1.0, PM2.5, PM4.0, PM10, temperature, humidity, VOC, NOx, and CO2 readings
  • Live browser UI, JSON API, and Prometheus metrics
  • SEN66 health flags and ESP32/WiFi diagnostics
  • Persistent altitude, temperature offset, and CO2 ASC configuration
  • Forced CO2 recalibration and SEN66 fan cleaning controls
  • Authenticated configuration and OTA firmware updates
  • SNTP time synchronization and onboard RGB status indication
  • Dual 3 MB OTA application partitions with rollback support

Hardware

Part Reference
Development board ESP32-C6-DevKitC-1, 8 MB flash
Air quality sensor Sensirion SEN66
Connection Data-capable USB-C cable and four sensor wires

Default wiring:

ESP32-C6 SEN66
GND GND
3V3 VCC
GPIO 6 SDA
GPIO 7 SCL

The SEN66 supply range is 3.15-3.6 V. Check the official product documentation before changing the power source or wiring.

Quick Start

The Makefile installs the pinned ESP-IDF checkout and tools under the ignored .esp-idf/ directory. On Linux or macOS, with Git, GNU Make, and the ESP-IDF host prerequisites installed:

git clone --recurse-submodules https://github.com/cdump/esp32-sen66-airq.git
cd esp32-sen66-airq
make setup
make menuconfig
make build
make flash
make monitor

In make menuconfig, open the airq section and configure:

  • WiFi SSID and password
  • HTTP auth username and a non-empty password
  • Optional device name, SNTP server, and sensor defaults

Use an explicit serial port if auto-detection selects the wrong device:

make flash PORT=/dev/ttyACM0
make monitor PORT=/dev/ttyACM0

On macOS the port is usually similar to /dev/cu.usbmodem*.

Web Interface

The HTTP server starts after WiFi connects, even if the router was unavailable at boot. After a disconnect, the firmware keeps reconnecting automatically: the configured number of fast retries are spaced one second apart, followed by one attempt every 30 seconds until WiFi returns.

Path Access Description
/ Public Current readings and device health
/readings.json Public Readings, validity flags, and sensor status as JSON
/metrics Public Prometheus metrics
/config Authenticated Persistent sensor configuration and fan cleaning
/calibrate Authenticated Forced SEN66 CO2 recalibration
/ota Authenticated Firmware upload page

Configuration is stored in ESP32 NVS and reapplied to the SEN66 at boot. Runtime changes restart continuous measurement when required by the sensor command sequence. Fan cleaning pauses measurement for the documented 10-second cleaning cycle.

OTA Updates

Once OTA-capable firmware is running, upload a new build with:

make ota OTA_HOST=192.0.2.10

Set OTA_HOST to the device IP address or a hostname supplied by your network's DNS. The firmware does not currently advertise an mDNS .local hostname.

The target builds build/airq.bin and posts it to http://<OTA_HOST>/ota. Credentials default to CONFIG_AIRQ_AUTH_USERNAME and CONFIG_AIRQ_AUTH_PASSWORD from the local sdkconfig. They can be overridden with OTA_USER and OTA_PASSWORD; the URL and image can be adjusted with OTA_SCHEME and OTA_FIRMWARE.

Security

Read-only endpoints are public. /config, /calibrate, and /ota require HTTP Basic Auth when CONFIG_AIRQ_AUTH_ENABLED is enabled.

Basic Auth does not encrypt traffic. Use these controls only on a trusted local network or behind transport protection.

WiFi and HTTP credentials are stored in the generated local sdkconfig, which is ignored by Git. Do not force-add that file or place credentials in sdkconfig.defaults, source files, or documentation.

Dependencies

The SEN66 driver remains pinned to version 1.2.0. Version 1.3.0 changes the integer measurement command from 0x0300 to 0x0414; the currently deployed SEN66 firmware does not return measurements for that command.

License

This project's original code is licensed under the MIT License. Third-party components remain subject to their respective licenses, including the BSD-3-Clause SEN66 driver and Apache-2.0 ESP-IDF components.