Skip to content
MCU Atlas
ESP32ESP32-C3

CO2 Monitor That Fails Visibly: SCD30 ESPHome node with real fault handling

An ESPHome/Home Assistant CO2 node engineered so a dead sensor reads unknown and raises a fault, never a frozen last-good number. SCD30 + XIAO ESP32-C3.

Difficulty:BeginnerSource available

What it is

An open CO2 monitor node (Adafruit SCD30 + Seeed XIAO ESP32C3, ESPHome/Home Assistant) engineered so a dead sensor reads "unknown" and raises a fault — never a frozen last-good number.

What you need

  • Adafruit SCD30 breakout (PID 4867) Sensirion NDIR CO2/temp/humidity, I2C 0x61 — unlinked: we catalog the SCD40/41, not the SCD30
  • Seeed Studio XIAO ESP32C3 the YAML's board target
  • A carrier or breadboard of your own the maker's carrier is not a purchasable part — fit-check model only
  • Hammond 1551V4 vented case 80 × 80 × 20.3 mm ABS; the vents are the LED window — unlinked, no catalog match

How hard

Beginner: all behavior lives in one shared ESPHome YAML — no custom firmware, no soldering on the supported path. One wrinkle: the maker's carrier board isn't purchasable, so you wire your own SCD30 + ESP32-C3.

Photos

Assembled and closed: the Hammond 1551V4's vent slots double as the window for the green fault LED — the strobe is visible from outside the case.
The build: the SCD30 breakout (I²C address 0x61, the only device on the bus) wired to the XIAO ESP32-C3 on its small carrier, resting in the case base.
The carrier from the XIAO side, powered over USB; the green board LED is the one repurposed as the 5 Hz fault strobe.
The maker's published field run: bedroom CO₂, one-minute means, five nights (n = 6,695), with the 1,000 ppm UBA and 1,150 ppm DTU reference lines.
As-built: closed case with its USB cable exit.

Photos: Bill Collis (CERN-OHL-S v2)

Key Facts

  • Open-source CO2 node engineered to fail visibly: dead sensor → fault entity + values to unknown + 5 Hz LED strobe, never a frozen last-good reading
  • Hardware per node: Adafruit SCD30 (Sensirion NDIR, I2C 0x61) + Seeed Studio XIAO ESP32C3 on the maker's 23.0 × 38.0 mm carrier, in a Hammond 1551V4 vented ABS case
  • All behavior in one shared ESPHome YAML (Rev 1.4-draft) — no custom firmware; per-node files are substitutions + API key + packages include
  • Fault handling: 240 s stale → fault + unknown; 900 s → recovery reboot capped at 3 (counter survives reboots); good reading clears fault and counter
  • Fault LED: GPIO20 green carrier LED, 100 ms on/off strobe (5 Hz), plus a 15 s LED Test button
  • Boot guards: self-calibration off, 0 ppm first-reading filter, no reboot when Home Assistant is down
  • Maker-reported: bedroom node ran 111.65 h over five nights, 0 resets, means 874.9–1,313.5 ppm (n = 6,695); host harness 224/224 checks and 11/11 injected faults caught (firmware 1.4)
  • On-device test (firmware 1.1): SCD30 unplugged → fault at 259 s, LED strobed; recovery-reboot path unobserved on hardware
  • Family-room node: not built yet; config compiles
  • Licenses verified from the files: CERN-OHL-S v2 hardware, MIT code, CC BY 4.0 docs (third-party files excluded)
Diagram of the CO2 monitor's fault path: an SCD30 sensor wired over I2C to a XIAO ESP32-C3 carrier board inside a vented Hammond case, with a green fault LED glowing through a vent slot, and a timeline of the stale-reading watchdog: fault at 240 seconds, capped recovery reboots at 900 seconds.
How the node fails visibly: the fault path from the project's shared ESPHome YAML — stale readings trigger the fault, unknowns and the LED strobe; the vent slots are the LED window. (Diagram: MCU Atlas (behavior sourced from the repo's MIT-licensed esphome/co2-node-common.yaml, Rev 1.4-draft).)

About This Project

A bedroom CO2 sensor whose readings look perfectly healthy right up until the moment you notice they haven't changed in three days — because the sensor died and nobody told you.

Most DIY sensor nodes fail silently: the sensor stops responding, and Home Assistant keeps displaying the last number it ever received — a flat, plausible-looking line, forever. If you've been watching CO2 to decide when to open a window or whether a bedroom is stuffy at night, a frozen reading isn't a small bug. It's the one failure mode that looks like success.

Bill Collis's CO2 Monitor That Fails Visibly takes the opposite stance: a node has no right to look healthy when it isn't. When the SCD30 sensor stops sending fresh readings, within minutes the node publishes an explicit fault, blanks every CO2, temperature and humidity value to "unknown" in Home Assistant, and strobes an LED on the case — three separate signals, so a single missed channel can't hide the failure. The name of the project is the spec.

Honesty split (MCU Atlas): we verified this project's documentation, shared YAML, license files, hackaday.io project page and the Hackaday feature against each other — sources fetched 2026-11-18, re-verified 2026-11-27, and every claim below traces to them. The harness runs and field data are the maker's own reported results; MCU Atlas has not built or run this node. The one on-device fault test is separately attributed below.

Why this page exists when we already have CO2 pages: our ESPHome indoor air-quality monitor page shows you what to sense and with what hardware; the Apollo MSR-2 page shows you a polished multisensor. Neither answers the question this project lives on: how do you make a sensor node honest about its own death? That's a lesson every ESPHome build can steal, and it's all done in configuration — no custom firmware.

The fail-safe design

Everything below is the repo's shared YAML (firmware 1.4) as documented — MCU Atlas has not run it on hardware.

Stale-reading watchdog. Every 30 seconds the node checks how long ago the last good CO2 reading arrived, using unsigned millisecond arithmetic that survives the ESP32's 49-day millis wraparound. At 240 seconds with no reading, it publishes a CO2 Sensor Fault entity (a binary sensor with the problem device class) and replaces the live CO2, temperature and humidity values with NaN — which Home Assistant renders as "unknown", not zero, not the last value. The 1-minute-average sensors follow at the end of their minute, so by 330 seconds no derived number is still showing stale data either.

Recovery reboot, capped. At 900 seconds (15 minutes) of silence, the node assumes the sensor is wedged and reboots itself to re-run the SCD30 setup — but only up to 3 times. The counter survives the reboot (it's stored with restore_value), so a truly dead sensor can't trap the node in a hidden reboot loop; after the third attempt the node stays up and keeps reporting the fault.

No fake recovery. A fresh good reading resets the clocks and clears the fault — and the good-reading handler is guarded so the watchdog's own NaN values can't accidentally reset it. On boot, the node re-publishes the fault state if any stale reboot was ever needed, so Home Assistant never sees a "healthy" gap across a restart.

The fault LED. A green LED on the carrier board (GPIO20) strobes at 5 Hz — 100 ms on, 100 ms off — for as long as the fault is active, and stays dark otherwise, including at boot. The enclosure's vent slots are positioned so you can see it from outside the case. A software LED Test button strobes the same LED for 15 seconds on demand, so you can prove the pin, the LED and the light path through the case without waiting for a real fault.

Quiet boot-time guards. The config disables the SCD30's automatic self-calibration (whose ESPHome default would silently rewrite the calibration at every boot), filters the sensor's spurious first power-up reading of 0 ppm, sets a 2-second update interval, and adds 157 m altitude compensation. One more deliberate choice: if Home Assistant goes down, the node must not reboot itself to chase the API connection — reboot_timeout is set to 0 so an HA outage can't masquerade as a sensor fault.

Read the parts list with one caveat: this is a maker's own assembled node, not a kit. You can buy the sensor, the XIAO and the case exactly; the carrier is the maker's existing board, published only as a fit-check model. The realistic reader path is your own SCD30-plus-ESP32-C3 wiring with the project's shared YAML — which is the entire point of the project.

Assembly and wiring notes

The as-built photos live in hardware/as-built/ in the repo: closed-top, open-scd30-side, open-both-boards, open-xiao-side, closed-cable-exit and closed-vent-side, EXIF-dated 2026-10-27 and 2026-11-01. What they document, in the maker's build: the SCD30 is the only device on the I2C bus; the XIAO ESP32-C3 rides the small carrier board; the case's vent slots double as the window for the fault LED; and logging goes out over the ESP32-C3's USB Serial/JTAG interface — which is what frees pin GPIO20 (D7, the carrier's green LED) to be the fault strobe instead of a debug blink.

The KiCad OPEN and EXPLODED renders in the repo are explicitly not photographs — they're fit-check visualizations of the board and enclosure, useful for understanding the layout, not evidence of a buildable new PCB.

All the intelligence is one shared YAML

There is no custom firmware here. One shared file, esphome/co2-node-common.yaml (Rev 1.4-draft, 2026-10-27), holds every behavior described above, and each node's own file (bedroom-co2-node.yaml, family-room-co2-node.yaml) contains only a few substitutions, its own API key, and a packages include of the shared file. The Hackaday feature on the project put it exactly right: "There was no need to rewrite the ESPHome firmware; all his modifications fit within the context of a configuration file".

For a newcomer, that architecture is the teachable part. The fault handling lives in three pieces of the shared file, and each is short enough to read in one sitting: the stale watchdog — an interval: 30s lambda computing the age of the last good reading, publishing the fault and NaNs at 240,000 ms and doing the capped safe reboot at 900,000 ms (with the g_stale_reboots counter), while a good reading refreshes the timestamp and zeroes the counter; the fault strobe — an interval: 100ms lambda toggling the GPIO20 output while the fault is active, 5 Hz by construction; and the boot guard — an on_boot lambda that re-publishes the fault state, plus the config-level guards (automatic_self_calibration: false, filter_out: 0.0, api reboot_timeout: 0s, min_version: 2026.10.0).

These are abridged descriptions, not the verbatim file — the complete YAML is linked in the Learn section below, and the repo reports it compiling clean: firmware 1.4 on ESPHome 2026.10.0 with 0 warnings and 0 errors, and both per-node configs compiling clean on 2026.9.1 back at firmware 1.0.

Field results — and exactly how much to trust each number

The bedroom node (maker-reported field run). Firmware 1.4 ran 2026-10-27 18:14 EDT to 2026-11-01 08:52 EST — 111.65 hours across five nights — with zero resets, the fault never on, and zero stale reboots (uptime 401,944 s; in Home Assistant since 2026-10-27). The published one-minute means (n = 6,695) span 874.9–1,313.5 ppm with mean 1,074.2 and median 1,075.4; 68.7% of minutes exceeded 1,000 ppm, 30.5% exceeded 1,150 ppm, none exceeded 1,500 ppm. Nightly (23:00–06:00) means ran 1,042–1,206 ppm. For context the repo cites the SCD30's ±(30 ppm + 3%) accuracy (±60 ppm at 1,000) and two reference points: the German UBA guidance of 1,000/2,000 ppm and DTU's 1,150 ppm sleep-quality line. (The chart of this run is in the photo gallery below.)

The fault-injection harness (maker-reported, host-simulated). The repo's harness/faults.py (2026-10-27, against firmware 1.4) extracts the actual boot/value/interval lambdas verbatim from the YAML and runs them on a PC against simulated time — 8 scenarios including the millis wraparound — across which 224 of 224 checks pass ("RESULT: PASS (224 checks)"). It then deliberately breaks the config 11 ways — removing the NaN guard, raising the reboot cap, shifting the staleness threshold, using wrap-unsafe arithmetic, letting the recovery boot clear the fault, leaving stale temperature/humidity or CO2 showing, blanking readings "healthy", feeding NaN into the minute-mean — and every one of the 11 must fail the harness; all do ("FAULTS: PASS (0 of 12 directions wrong)"). Be precise about what this is: the checks are simulated on a host against the real YAML text, not executed on the bedroom node.

The one on-device fault test. On 2026-10-27, running firmware 1.1, the maker unplugged the SCD30: the fault logged at 259 seconds, Home Assistant showed CO2 unknown with the fault on, and the LED strobed. The 900-second recovery reboot, and the strobe stopping at the next good reading, have not been observed on the device — those two behaviors rest on the host harness and the YAML, and the on-device test was not repeated on firmware 1.4. The project says so plainly, and so do we.

Status of the second node. The family-room node is not built ("Family-room node not built yet" — hackaday.io project description, November 2026); its config compiles and is waiting in the repo.

Licensing

A genuinely tidy three-way split, and MCU Atlas verified each from the license file itself, not the README's summary: hardware (the hardware/ tree) is CERN-OHL-S v2 — the full Strongly Reciprocal text; code (esphome/ and harness/) is MIT, copyright 2026 William K. Collis; and the README is CC BY 4.0. Exceptions worth knowing before you reuse: the docs PDFs, the hardware/3d/ models, the vendored Adafruit SCD30 EAGLE files (those are Adafruit's, CC BY-SA 3.0) and the CO2_Monitor.3dshapes/ files are third-party material outside those licenses — one 3D model's "author and licence not recovered" per the repo's own license breakdown.

Not affiliated: this is an independent community project. Adafruit, Seeed Studio, Sensirion, Hammond, ESPHome and Home Assistant are third-party trademarks of their respective owners; MCU Atlas is not affiliated with the maker or any of them.

Source & Attribution

CO2 Monitor That Fails Visibly: SCD30 ESPHome node with real fault handling

How to Build It

Wire an SCD30 to a XIAO ESP32-C3, build your node from the project's shared ESPHome YAML, flash it into Home Assistant, then prove the failure path yourself: LED Test button first, unplug the sensor second — and watch the readings go unknown instead of frozen.

Parts Needed

  • An Adafruit SCD30 breakout (PID 4867) — today's notes are on the page's Parts list (unlinked: we catalog the SCD40/41)
  • A Seeed Studio XIAO ESP32C3 (the YAML's board target)
  • A carrier or breadboard of your own — the maker's carrier is not a purchasable part
  • A Hammond 1551V4 vented case (or any vented case with a sightline to your fault LED)

Steps

  1. 1

    Get the parts

    An Adafruit SCD30 breakout, a Seeed Studio XIAO ESP32C3, and a carrier or breadboard arrangement of your own (the maker's carrier is not a purchasable part; keep the SCD30 the only device on the I2C bus).

  2. 2

    Wire the sensor

    Wire the SCD30 to the XIAO over I2C (address 0x61) and pick your case — vented, with a sightline to your fault LED.

  3. 3

    Install ESPHome and create your node

    Install ESPHome (2026.10.0 or newer; the YAML enforces min_version) and create a node from the shared file: your own YAML holds only substitutions, your API key, and the packages include of co2-node-common.yaml.

  4. 4

    Flash and add to Home Assistant

    Flash the node and add it to Home Assistant; confirm the CO2, temperature and humidity entities appear.

  5. 5

    Run the LED Test button

    The fault LED must strobe for 15 seconds — that proves the whole visual fault path (pin, LED, light through the case) before you trust it.

  6. 6

    Prove the failure mode yourself

    The project's own test: unplug the SCD30. Within about 4 minutes the fault entity turns on and the readings go unknown; the LED strobes the whole time. (The maker's on-device test logged the fault at 259 seconds on firmware 1.1.)

  7. 7

    Read the fault handling top to bottom

    Read co2-node-common.yaml from top to bottom — it's short, and it's the part worth stealing for every sensor node you'll ever build. The complete file is linked in the Learn section of the page.

Bill of Materials

Parts list

4 parts · 2 linked

Heads up: some Buy links are affiliate links. If you buy through one, MCU Atlas may earn a small commission at no extra cost to you. It never changes which parts we list. How this works

1× Adafruit SCD30 breakout (PID 4867)

UNLINKED — we catalog the SCD40/SCD41, not the SCD30. Sensirion NDIR CO2/temp/humidity sensor, I2C address 0x61; keep it the only device on the bus.

No verified link — check the original project

1× Seeed Studio XIAO ESP32C3

Thumb-size ESP32-C3 host; the YAML's board target is seeed_xiao_esp32c3.

1× 23.0 × 38.0 mm 2-layer carrier board

UNLINKED — not a purchasable part. The maker's own existing ESP32-C3 sensor-node board; the KiCad file in hardware/ is "a fit-check model, not a board to fabricate". Use your own carrier or breadboard.

1× Hammond 1551V4 case

UNLINKED — no catalog match. 80 × 80 × 20.3 mm vented ABS; the vent slots double as the fault-LED window.

No verified link — check the original project
Download CSV

Related Projects

ESPHome indoor air-quality monitor (CO2, PM2.5)
Illustration
ESP32
An ESPHome config for a DIY air-quality monitor measuring CO2, particulates, temperature, humidity and pressure.
Beginner·Code
5 parts listed
Apollo MSR-2: mmWave and CO2 multisensor for Home Assistant
Illustration
ESP32ESP32-C3
A tiny ESP32-C3 sensor with LD2410 mmWave presence, SCD4x CO2, pressure, light and UV, running open ESPHome firmware.
Beginner·Code
1 part listed
airRohr: citizen-science particulate matter air sensor
Illustration
ESP32ESP8266
A DIY outdoor air-quality station for Sensor.Community: an ESP8266, SDS011 fine-dust sensor and BME280 in a weatherproof pipe.
Beginner·Code
5 parts listed