Skip to content
AccidentalAntenna
All projects

1 min read

A tiny desk air monitor

An ESP32 and a CO₂ sensor make it easier to tell when my home office needs fresh air.

Close-up of components and traces on a teal circuit board
Circuit board detail, used as an illustration for the desk monitor build. Photo by Harrison Broadbent

Picking a measurement interval

I wanted a quick way to tell when opening the window might help. I put an SCD41 sensor and an ESP32 in a vented enclosure, then logged a sample every 30 seconds. That was enough to follow changes across a morning without filling the log with near-identical readings.

The first enclosure had the sensor sitting directly above the voltage regulator. Moving the sensor closer to the vents and away from the regulator reduced the temperature drift I saw after powering up the board.

Handling interrupted samples

The dashboard reads timestamped measurements from a local log. I kept the parser small enough to check by eye and let it skip an incomplete final line if power is cut while the board is writing.

function parseSample(line: string) {
  const [timestamp, reading] = line.trim().split(",", 2);
  if (!timestamp || !reading?.trim()) return null;

  const recordedAt = Date.parse(timestamp);
  const ppm = Number(reading);
  if (!Number.isFinite(recordedAt) || !Number.isFinite(ppm) || ppm <= 0) {
    return null;
  }

  return { recordedAt, ppm };
}

What I would change

The USB cable made the whole enclosure move whenever I plugged it in. For the next revision I’d add a slot for cable strain relief before printing the lid again.

  • Multicolored jumper wires connected to a microcontroller on a breadboard

    Example of breadboard wiring for testing sensor connections before assembling an enclosure.

    Photo by Moe Salih

  • Electronics workbench with an oscilloscope and a circuit board

    Example of a bench setup for checking a circuit with measurement tools before leaving it to log unattended.

    Photo by Axel Richter

Comments

Share a thought about this project. Comments appear after approval.

    Loading comments…