← All projects in the gallery
Air Quality
by jonathan harrocks
What the air in the room is actually doing.
An SCD40 measures CO2, temperature and humidity, and a BH1750 measures illuminance. Both sit on the CYD's CN1 connector - one I2C bus, two addresses, four wires.
Two automations watch the CO2 reading: past 1000 ppm the verdict turns red and asks you to open a window, and back under 800 it goes green again. The gap between the two thresholds is deliberate, so a reading hovering on the line does not flicker.
The SCD40 only produces a new sample every five seconds or so, which is why it is polled at that rate rather than faster.
It is drawn as an instrument: a seven-segment reading over its own unlit segments, which is a second label behind the first saying 8888. The marker on the colour scale is a slider with nothing drawn but its knob, riding a scale that is in the backdrop.
About this design
Air Quality is an LVGL interface for the ESP32-2432S028R "Cheap Yellow Display" (ILI9341 320 x 240, XPT2046 touch), with 1 screen and 24 widgets, made for Arduino (C++) on LVGL 9.
Screens
- Screen1
Hardware and build
- Board
- ESP32-2432S028R "Cheap Yellow Display"
- MCU
- ESP32 (WROOM / WROVER)
- Display
- ILI9341
- Resolution
- 320 x 240
- Touch
- XPT2046
- Graphics library
- TFT_eSPI
- LVGL
- v9
- Exports to
- Arduino (C++)
- Peripherals
- SCD40 / SCD41 (CO2), BH1750 (light)
- Libraries
- lvgl, TFT_eSPI, SparkFun SCD4x Arduino Library, BH1750
Notes from the author
SCD40 CO2 plus a BH1750 light sensor, with a verdict that changes colour.
Using it
Open a copy in the designer and it is yours to edit: restyle the screens, move it to another board, and export the Arduino (C++) project. Designing is free, and a copy needs no account. Open the designer.