This is a fork of https://github.com/kmetz/coro2sens to enable usage of the other mentioned
CO₂ sensor: MH-z19b.
I used this board (relevant for the pins, always check your pins!): https://joy-it.net/de/products/SBC-NodeMCU-ESP32
Build a simple device that warns if CO₂ concentration in a room becomes a risk for COVID-19 aerosol infections.
- Measures CO₂ concentration in room air.
- Controls an RGB LED (green, yellow, red, like a traffic light).
- A buzzer can be connected that alarms if levels are critical.
- Also opens a WiFi portal which shows current readings and a graph (not connected to the internet).
- Can be built for ~ $60 / 50€ (parts cost).
This project was heavily inspired by ideas from Umwelt-Campus Birkenfeld.
You can also find a good overview of the topic by Rainer Winkler here: Recommendations for use of CO2 sensors to control room air quality during the COVID-19 pandemic.
- The sensor used here is the Sensirion SCD30 (around $50 / 40€) which is optionally augmented by a BME280 pressure sensor to improve accuracy.
- Look here if you want to use MH-Z19B sensors.
LED color | CO₂ concentration |
---|---|
Green ("all good") | < 800 ppm |
Yellow ("open windows") | 800 – 1000 ppm |
Red ("leave room") | > 1000 ppm |
Based on a Recommendation from the REHVA (Federation of European Heating, Ventilation and Air Conditioning associations, rehva.eu) for preventing COVID-19 aerosol spread, especially in schools.
You can read current levels and a simple graph for the last hour by connecting to the WiFi coro2sens
that is created.
Most devices will open a captive portal, immediately showing the data. You can also open http://10.0.0.1/
in a browser.
- Any ESP32 or ESP8266 board (like a WEMOS D32 (about $18 / 15€) or WEMOS LOLIN D1 Mini (about $7 / 6€)).
ESP32 has bluetooth, for future expansion. - Sensirion SCD30 I2C carbon dioxide sensor module (mouser, digikey) (around $50 / 40€).
- 1 NeoPixel compatible RGB LED (WS2812B, like the V2 Flora RGB Smart NeoPixel LED, you can also remove one from a larger strip which might be cheaper).
- A 3V piezo buzzer or a small speaker.
- Optional (i didn't include one yet): Bosch BME280 I2C sensor module (like the GY-BME280 board), for air pressure compensation, improves accuracy (less than $5 / 4€).
A nice case :) Make sure the sensor has enough air flow.
ESP32 pin | goes to |
---|---|
5V | MH-z19b VIN, LED + |
GND | MH-z19b GND, LED GND, Buzzer (-) |
D26 | MH-z19b Rx |
D32 | MH-z19b Tx |
D23 | LED DIN |
D19 | Buzzer (+, or "H") |
Flashing the ESP using PlatfomIO
- Simply open the project, select your env (
esp12e
for ESP8266 /nodemcu-32s
for ESP32) and run / upload. - Or via command line:
pio run -t -e nodemcu-32s upload
for ESP32.
- Libraries will be installed automatically.
- There is a small test suite to help with the wiring. Run it like this:
pio test
The test contains automated parts that should fail if the dev-board itself or the co2 sensor would be miswired.
For the LEDs and the buzzer, it will sparkle and play a few tones respectively.
I didn't try that myseld, please see the original repo for further information