A simple and cheap PM2.5 Air Quality Meter

The air quality where I live has suddenly thrust itself into our consciousness. I regularly visit the Bay Area Air Quality Management District site and PurpleAir to find out what is happening in my neighborhood.

However, I wanted to know what the air quality was inside my house. Of course, I could just buy a PurpleAir sensor for nearly $200, but it turns out that the technology inside those sensors is something called the Plantower PMS5003. My friend Jeremy pointed me towards these ingenious little sensors draw in air and blow it in front of a laser, where dust particles scatter some of the light, which is detected by photodiodes. (Datasheet here) For various reasons you’ve read online, this is not the same as the “gold-standard” technology that EPA PM sensors use, but studies by some scientists suggest it’s not bad. And it’s cheap. You can get this module from Adafruit for $40 or on eBay for even less. I bought mine from an eBay seller for $20, but it came without a break-out board, making wiring a bit more difficult, but not too hard. It’s only three wires after all!

Thing is, the module is doing the heavy lifting, doing all the signal processing, but it’s not a complete system by itself. You need a computer to do something with the data.

I found that the Raspberry Pi Zero W makes a nice little companion for the PMS5003. The Pi is powered by a USB adapter, and has a 5V pin from which you can steal the necessary power for the sensor. You can send the transmitted serial data from the sensor right into the UART0 receive pin of the Raspberry Pi. That plus a little bit of software, et voila, a simple sensor platform.

At first, I coded mine just to write the results, every second to a .csv file that I could load into a spreadsheet. But the copying and pasting quickly got old, so I decided to make a little webserver instead. Mine is set up on my home wifi and I can access it from my computer or phone just by going to its web address. It presents the data in various levels of time averaging: the first graph is second by second, then minute by minute, hour by hour, and day by day.

It’s a simple enough project that I think just about anybody could do.

Here’s the code on GitHub.

Here’s a picture of the simple UI I made:

Here’s what it looks like:

One thought on “A simple and cheap PM2.5 Air Quality Meter”

  1. This seems like something that could actually be sold to consumers–the question is, how? It would have to stay cheaper than Purple Air and not have real set up (including writing code for the Raspberry Pi). Could it be incorporated into something that people already buy? Air filter? Air conditioner? Make it like thermostat to turn on the filter when it detects a certain level of PM2.5 in the air? It seems like just the thing for the ongoing apocalypse.

Leave a Reply

Your email address will not be published. Required fields are marked *