Building a DIY Home Air Quality Monitor With Raspberry Pi
Build your own IoT air quality monitor using a Raspberry Pi and affordable sensors. Track PM2.5, CO2, and VOCs with a custom dashboard.
Commercial air quality monitors range from $100 to $300, and most lock your data behind proprietary apps. For around $60 in parts and a few hours of setup, you can build a superior monitor that tracks PM2.5, CO2, temperature, humidity, and volatile organic compounds — with full control over your data.
Parts List
- Raspberry Pi Zero 2 W — ~$15. Small, power-efficient, and has built-in Wi-Fi
- SCD-41 CO2 sensor — ~$25. Measures true CO2 (not estimated), plus temperature and humidity
- PMS5003 particulate sensor — ~$15. Laser-based PM1.0, PM2.5, and PM10 readings
- SGP30 VOC sensor — ~$8. Detects volatile organic compounds and equivalent CO2
- Breadboard, jumper wires, micro-USB power supply
Why These Sensors?
The SCD-41 uses photoacoustic NDIR sensing for accurate CO2 measurement. Cheaper sensors like the MQ-135 estimate CO2 from general gas resistance, producing unreliable readings. The PMS5003 is the same sensor used in PurpleAir monitors, proven accurate in EPA field evaluations. The SGP30 adds VOC detection for paint fumes, cleaning chemicals, and off-gassing from new furniture.
Basic Wiring
All three sensors connect via I2C or UART to the Pi's GPIO pins. The SCD-41 and SGP30 share the I2C bus (GPIO 2 for SDA, GPIO 3 for SCL). The PMS5003 uses UART (GPIO 14 TX, GPIO 15 RX). Power all sensors from the Pi's 3.3V or 5V pins depending on their requirements.
Software Setup
Install Raspberry Pi OS Lite (no desktop needed), enable I2C and UART in raspi-config, then install the sensor libraries via pip. Adafruit provides excellent CircuitPython libraries for the SCD-41 and SGP30. The PMS5003 has a well-maintained Python library called pms5003-python.
A simple Python script reads all sensors every 30 seconds and logs data to a local InfluxDB instance. Grafana, running on the same Pi, provides a browser-accessible dashboard showing real-time readings and historical trends.
What You'll Learn From Your Data
Most people are surprised by their first week of readings. CO2 levels in bedrooms routinely exceed 1,500 ppm overnight with the door closed — well above the 1,000 ppm threshold where cognitive function begins to decline. Cooking without a range hood can spike PM2.5 to levels rivaling a polluted city. Even something as simple as running a laser printer can trigger noticeable VOC elevations.
With continuous monitoring, you can correlate air quality events with activities and make targeted improvements: cracking a window at night, upgrading your HVAC filter to MERV 13, or running an air purifier only when PM2.5 exceeds a threshold — saving filter life and energy.