I’ve been more concerned about the quality of air in my house recently. I’ll soon be paying for a service to clean the furnace and duct work, and I wanted a way to determine if there’s been any measurable impact or change. Fortunately, using a SDS011 sensor, a Raspberry Pi and a bit of software, I can create a simple home air quality monitor. Here’s how to do it.
What You’ll Need For This Project
- Raspberry Pi 4 or Raspberry Pi 3 with power adapter
- 8 GB (or larger) microSD card with Raspberry Pi OS. See our list of best microSD cards for Raspberry Pi.
- SDS011 sensor
- A small block of wood for mounting the pi and sensor (optional)
- Hot glue for mounting the pi and sensor (optional)
How to Make a Raspberry Pi Home Air Quality Monitor
Before you get started, make sure that you have your Raspberry Pi OS set up. If you haven’t done this before, see our article on how to set up a Raspberry Pi for the first time or how to do a headless Raspberry Pi install (without the keyboard and screen).
1. Install git, which will allow us to clone the code from github.com
sudo apt-get update && sudo apt-get install -y git
2. Clone the repository with example code. This code takes care of communication with the sensor, and sets up a simple server for monitoring on your home network.
cd ~/ git clone https://github.com/rydercalmdown/pi_air_quality_monitor.git
3. Run the installation command after descending into the repository. This will take care of installing all base dependencies, like Docker and Docker Compose to make this project run.
cd pi_air_quality_monitor make install
4. Run the build command to build the docker images. This may take a bit of time depending on your Raspberry Pi.
5. Connect the SDS011 sensor to the USB adapter it comes with using the provided jumper cable.
6. Connect the SDS011 USB adapter to your Raspberry Pi. You may see a flashing red light, but if not, don’t worry.
7. Mount the SDS011 sensor and your Raspberry Pi to a small block of wood. This step is optional, you can also use a case, but I like the open air look of the system. If mounting the sensor inside a component, make sure the air inlet port is connected to the outside of the case.
8. Run the server to start taking measurements.
9. Navigate to your Pi’s IP address on port 8000 to view the web server, and a small graph of recent measurements of air quality. You’ll see a graph.
The sensor in this Raspberry Pi Project measures two metrics: PM2.5 and PM10. PM stands for particulate matter and the number after is the amount of micrometers, 2.5 or 10. Particles of PM2.5 are particularly bad for your health if they contain toxic substances.
This server shows running measurements for the last 30 minutes, but could be easily adapted to do more. I’ll be comparing my values from now until after my HVAC system is cleaned, and hopefully I’ll see a measurable difference. After that, I’ll be putting this in a water proof box to measure air quality outside, to give me an idea of how it varies over time.