Is my study environment toxic?
Building a Custom CO2 Monitor for my Home Lab
My study is more than just a place where I take work calls; it’s a high-density engineering hub. Between the 3D printer humming in the corner, the frequent scent of solder smoke, and a 10U rack housing my full homelab, the air quality started to become a real concern. While I was already tracking temperature, humidity, and even radiation, there was one invisible metric missing: Carbon Dioxide (CO^2).
In a small WFH office filled with heat-generating gear, CO2 levels can spike faster than you’d think, leading to that "heavy-headed" feeling and reduced focus. I decided it was time to add a dedicated, networked CO2 monitor to my setup.
The Build: Hardware & "The Brains"
I wanted this to be more than just a sensor on a breadboard. It needed to be a permanent fixture—mounted to my cabinet with a clear, live visual display.
- The Sensor: I chose the Sensirion SCD4x. Unlike cheaper VOC-based sensors that "estimate" CO2, the SCD4x uses photoacoustic sensing for true CO2 ppm (parts per million) readings.
- The Brain: An ESP32 DOIT DevKit V1. It has the Wi-Fi muscle to handle a web server and MQTT simultaneously.
- The Display: A bright 3.2" 256x64 White OLED (SSD1322). It’s large enough to show a history chart, allowing me to see trends over time rather than just a single number.

Features & Integration
Building this within my existing ecosystem was a priority. Using PlatformIO, I integrated several custom features:
- MQTT Telemetry: Every 5 minutes (configurable), the device pushes data to my home automation broker. This allows me to trigger my lab's extraction fans if CO2 levels cross a certain threshold.
- Web Interface: The device hosts its own web server at
espCO2Sensor.local. I can check raw JSON data, trigger a manual refresh, or even perform OTA (Over-The-Air) firmware updates without unplugging it from the cabinet. - Dynamic Brightness: Since this is mounted in my workspace, I don't want it blinding me at night. I configured it to listen to MQTT commands that adjust the OLED brightness (0–100%) based on the time of day.
Why It Matters in the Lab
If you spend all day in a room with a 3D printer and a rack of servers, you're dealing with more than just heat. Proper ventilation is a safety requirement.
Monitoring CO2is a fantastic proxy for overall air freshness. If myCO2 levels climb above 1,000 ppm, I know it’s time to crack a window or ramp up the HVAC, regardless of what the temperature sensor says. I have a nodered notification that pushes a message every 10 minutes to Discord if this is the case.
Technical Snapshot
| Signal | Connection |
| Communication | I2C (Sensor) & SPI (Display) |
| Protocol | MQTT for data, HTTP for management |
| Libraries | u8g2 (Graphics), Sensirion I2C, PubSubClient |
Final Thoughts
There is a certain peace of mind that comes with seeing your air quality rendered in a clean sparkline on a high-res OLED. Whether I'm deep into a soldering project or just grinding through a workday, I now have a "Mission Control" view of the very air I'm breathing.
Next up on the "Lab Safety" roadmap? Integrating the extraction fan to trigger automatically via Node-RED whenever CO2 level hits the "yellow zone."