Get air quality & CO2 data from SM300D2 & Senseair S8 with ESP32, and export as OpenMetrics (Prometheus exporter) via WiFi.

ESP Air Sensor

Get air quality & CO2 data from SM300D2 & Senseair S8 with ESP32, and export as OpenMetrics (Prometheus exporter) via WiFi.

I used to have a Raspberry Pi Zero reading the SM300D2 (other's work) and an Arduino reading the Senseair S8 (my own project). Recently I got a batch of ESP32 chips, and looking for something to do with them. So I decide to combine the two using one ESP32 module, free the Raspberry Pi, and hoping all the bugs in old projects would go away.

Also, I'm migrating from Graphite to Prometheus for metrics collection.

At the time, I'm new to embedded development and C programming in general. This should be treated as a toy side project, not a serious one :)

Top view of assembled caseInside of the semi-assembled case

Sensors

  • SM300D2
    A cheap mulitsensor module, see the good summary at alemela/SM300D2-air-quality.

  • Senseair S8
    CO2 sensor that seems more reliable. Their product page.

  • LYWSD02
    Xiaomi E-Ink Display Clock w/ temperature & humidity sensors.

I use SM300D2 & Senseair S8 because I already have them on hands. But I wouldn't recommand SM300D2 due to its unreliable readings of CO2, CH2O, and TVOC. Even its temperature reading is often higher than it should be, affected by itself heat I guess. In fact, I only take the PM2.5 readings from the module alhought all data are read in this project.

LYWSD02 was added thereafter. Not like the others, it was connected via Bluetooth Low Energy.

Software

PlatformIO (the IDE) and ESP-IDF (the offical framework of ESP32) were used.

I was trying to make it modular and extensible, to facilitate adding/removing particular sensor devices.

Sturcture of source code

Configure

Use pio run -t menuconfig

  • Component config -> OpenMetrics Exporter
    Hostname, Wi-Fi SSID & PSK, HTTP endpoints
  • Component config -> Senseair S8 CO2 Sensor
    UART port number, RX/TX pins
  • Component config -> SM300D2 Air Quality Sensor
    UART port number, RX pin, aggregation period

Build

Install PlatformIO and execute pio run on terminal, or click "Build" on Visual Code with PlatformIO plugin.

Metrics

The exporter is on /metrics by default.

$ curl http://<espair-hostname>/metrics
> # UNIT espair_senseairs8_co2_ppm ppm
> # TYPE espair_senseairs8_co2_ppm gauge
> espair_senseairs8_co2_ppm{host="espair-01",mac="807d3a***"} 551
> (omitted...)
> # UNIT espair_sm300d2_humi_precent precent
> # TYPE espair_sm300d2_humi_precent gauge
> espair_sm300d2_humi_precent{host="espair-01",mac="807d3a***""} 37.00
> # EOF

Case

Rendered case

Files:

Printing:

  • Printer: Ender-3 V2
  • Filament: PLA, 1.75mm
  • Resolution: 0.20mm
  • Supports: yes
  • Infill: no effect

The particulate matter sensor was placed outside the case, fasten along with the case body and ESP32 tray using two M2 screws & nuts.

Similar Resources

This is just another Potato to get SYSTEM via SeImpersonate privileges.

This is just another Potato to get SYSTEM via SeImpersonate privileges.

MultiPotato First of all - credit to @splinter_code & @decoder_it for RoguePotato as this code heavily bases on it. This is just another Potato to get

Dec 29, 2022

Unix pager (with very rich functionality) designed for work with tables. Designed for PostgreSQL, but MySQL is supported too. Works well with pgcli too. Can be used as CSV or TSV viewer too. It supports searching, selecting rows, columns, or block and export selected area to clipboard.

Unix pager (with very rich functionality) designed for work with tables. Designed for PostgreSQL, but MySQL is supported too. Works well with pgcli too. Can be used as CSV or TSV viewer too. It supports searching, selecting rows, columns, or block and export selected area to clipboard.

Unix pager (with very rich functionality) designed for work with tables. Designed for PostgreSQL, but MySQL is supported too. Works well with pgcli too. Can be used as CSV or TSV viewer too. It supports searching, selecting rows, columns, or block and export selected area to clipboard.

Jan 4, 2023

A tool to convert Call of Duty XBIN/EXPORT files to and from each other.

exportxbin exportxbin is an enhanced version of export2bin included in the Call of Duty: Black Ops III Mod Tools. Its main goal is to provide users wi

Jan 22, 2022

A fork of Wraith Cyborg, the Call of Duty: Online Asset Exporter

NOTE: No support is provided for this, it was updated for a friend who works on a CoD OL Mod and it working for him was all that mattered, it is provi

Jan 26, 2022

JJY timecode emitter using ESP32 and WiFi/NTP

ビルドの方法 README.rstをみてください あと、接続先APの設定は src/main.cpp の中を見てください 使い方 デフォルトではGPIO 22番に40kHzのタイムコードが、GPIO 23番に60kHzのタイムコードが出ます。 以下のように抵抗を介して混合し、電線を電波時計のまわりに

Dec 21, 2021

ESP32 and ESP8266 Arduino wifi template

ESP wifi template ESP32 and ESP8266 Arduino wifi template Features Popular WiFI AP mode WiFI STA mode ETH mode DNS server for AP mode Async DDNS clien

Dec 14, 2022

A gdnative plugin for Godot's UWP export to add xbox live integration

GodotXbox Current instructions for setting up DLL, steps to setup project for contributing/modifying are coming soon. It should be noted that Godot's

Oct 31, 2022

📃 Export WeChat chat histories to HTML files.

📃 Export WeChat chat histories to HTML files.

wechat-export Export WeChat chat histories to HTML files. Preview This script generates a HTML file for each contact's chat history. Currently it supp

Dec 15, 2022

A blender import/export system for Defold

defold-blender-export A blender import/export system for Defold Setup Notes There are no exhaustive documents for this tool yet. Its just not complete

Dec 30, 2022
Prometheus exporter for ARM® Hardware components using HWCPipe.

ARM® HWCPipe Exporter ARM® HWCPipe Exporter is a Prometheus exporter written in Java and C++ that retrieves metrics from Android devices running on AR

Oct 5, 2022
AirGradient Prometheus exporter.

AirGradient Prometheus Exporter AirGradient has a DIY air sensor. I built one (actually, more than one). I want to integrate sensor data into my in-ho

Dec 24, 2022
Grafana/Prometheus exporter for EPEVER/EPSOLAR Tracer solar charge controllers

epever_exporter epever_exporter is a standalone program written in C that can query Epever/Epsolar Tracer solar charge controllers and output metrics

Nov 23, 2021
Collection of DLL function export forwards for DLL export function proxying

dll-exports Collection of DLL function export forwards for DLL export function proxying. Typical usecase is for backdooring applications for persisten

Dec 6, 2022
ON AIR or OFF AIR Monitor with WFH

wfh_monitor_m5 M5 Stack ON AIR or OFF AIR Monitor with WFH Dependency Arduino IDE==1.8.13 Blynk==1.0.0 Setup Hardware M5 Stack Smartphone(Android or i

Feb 26, 2022
multispectral monitoring of a sourdough starter; esp32 eink module, scd30 co2 sensor, vl6180 distance sensor

EINK STARTER MONITOR See full blogpost here Tracks height of starter with a VL6180 i2c distance sensor, and CO2/temperature/humidity with an SCD30. A

Feb 16, 2022
Pocket-sized CO2 sensor

CO2 Tin. Measure local CO2 (and temp, humidity) in a device you can easily toss in a pocket. Major components: CO2 Sensor : https://www.adafruit.com/p

Jan 2, 2022
Allows for multiple SwitchBot buttons and curtains to be controlled via MQTT sent to ESP32. ESP32 will send BLE commands to switchbots and return MQTT responses to the broker. Also supports Meter/Temp Sensor

SwitchBot-MQTT-BLE-ESP32 Switchbot local control using ESP32. no switchbot hub used/required. works with any smarthub that supports MQTT https://githu

Dec 27, 2022
Pure Data patch export to lv2 plugin using heavy compiler + dpf example
 Pure Data patch export to lv2 plugin using heavy compiler + dpf example

Pure Data patch export to lv2 plugin using heavy compiler + dpf example Work in progress - Takes an audio input and writes to a 0.5 seconds buffers. 4

Dec 27, 2022
ESP32-Skid-Steer - Bruder Catepillar Skid Steer model converted to RC, controlled by an ESP32 with 2 analog joysticks and a receiver that is an ESP32 on the model.
ESP32-Skid-Steer - Bruder Catepillar Skid Steer model converted to RC, controlled by an ESP32 with 2 analog joysticks and a receiver that is an ESP32 on the model.

ESP32-Skid-Steer Bruder Catepillar Skid Steer model converted to RC, controlled by an ESP32 with 2 analog joysticks and a receiver that is an ESP32 on

Oct 27, 2022