Guides › CO₂ traffic light
🚦 CO₂ traffic light for the home office
“How do I build a light that turns red when my room needs fresh air?”
Stale air makes you tired long before you notice it. A real CO₂ sensor and a ring of LEDs show it at a glance: green is fine, yellow means open a window soon, red means now.
What to buy
| Part | Why this one | Rough cost |
|---|---|---|
| ESP32 or ESP32-C3 board | WiFi is optional here, but it lets you log readings or add a phone alert later. | $4–8 |
| Sensirion SCD40 sensor board | Measures CO₂ directly, using light and sound (photoacoustic sensing). Also gives temperature and humidity. | $20–45 |
| WS2812 LED ring, 8–16 LEDs | Each LED can show any colour, all driven from one pin. | $3–8 |
| USB power supply | The sensor measures every few seconds, so this isn't a battery project. | you likely have one |
Prices are rough ranges, not quotes. Check the current price and stock before you order.
What to install
No code needed: ESPHome supports both the SCD40 and LED rings. You write a short settings file: read CO₂ every 30 seconds and set the colour by level. It runs on the board by itself; Home Assistant is optional.
A common rule of thumb: green below 1000 ppm (parts per million), yellow from 1000 to 1400, red above 1400. Outdoor air is about 420 ppm.
Build it in three steps
- Read CO₂. Connect the SCD40 over I²C, a two-wire connection (SDA and SCL, plus 3.3V and ground). Print the readings, then breathe near it: the number should jump.
- Light the ring. Connect the ring's power and ground, and its data input through a small resistor (about 330 Ω). Show a test colour.
- Join them. Map CO₂ to colour, and keep the brightness low: a desk light at full brightness is distracting.
What catches people out
- “eCO2” sensors don't measure CO₂. Cheap boards like the CCS811 or SGP30 estimate an “equivalent CO₂” from other gases (VOCs), and can be far off. The SCD40 measures CO₂ itself.
- Give it fresh air now and then. The SCD40 recalibrates itself by assuming the lowest reading of roughly the past week was fresh outdoor air. In a room that's never aired, it drifts. Air the room fully once in a while, or turn self-calibration off and calibrate it outdoors.
- Keep it away from your face and the board. Right next to your breath it reads high; right next to a warm board, the temperature reads high.
- SCD40 or SCD41? The SCD40 is specified up to 2000 ppm, plenty for a traffic light. The SCD41 reads higher and has a low-power single-shot mode for battery builds.
Your version is different?
Ask IotMentor with your own details: distance, power, budget, experience. It asks a few questions back, then gives you a plan like this one, free.
Ask IotMentorStarts with: “How do I build a light that turns red when my room needs fresh air?” Add your own details before you send it.