DIY PurpleAir Sensor

9/13/2020 UPDATE: I have a followup on MERV filter test results here.

With all the recent fires in California, air quality is top of mind for many people. Everyone probably is thinking things like: What level of AQI (Air Quality Index) is unhealthy? How can I improve the air quality in my home? Does closing the windows help? Where can I get accurate air quality data? How can I get more data?

I hope to answer many of those questions. There is a lot to discuss, but let's start with the basics. AQI.

Air Quality Index (AQI)

AQI is determined differently depending on the country, but this is going to try and cover United States AQI information as much as possible. AQI is based on five "criteria" pollutants regulated under the Clean Air Act: ground-level ozone, particulate matter, carbon monoxide, sulfur dioxide, and nitrogen dioxide. Wikipedia here.

To see Air Quality Index scores in your area you can find them:

If you research sensors for those five pollutants, you will discover it's not easy for someone off the street to collect all of the data. Some of the problems are cost, equipment and training. The Environmental Protection Agency (EPA) has equipment for example to weigh swabs that collect particles to accurately measure the particulate matter in the air. There is no way it's possible for a non-funded person to do this. The training and equipment are tens of thousands of dollars.

So, the point is, the EPA's AQI is very accurate but because of the technical details and methods to get the data, it is also slow and non-specific to your location. There may be zero to a few EPA sensors within 50 miles of you. So, this means the data on airnow.gov is usually behind and doesn't measure air quality in your micro climate. Usually this doesn't matter for normal weather patterns but when fires and wind come into the equation there are many microclimates created within a city.

Particle Matter 2.5 µg/m³

Before talking about PurpleAir this needs to be understood. PM 2.5 is considered "fine" particles, or particulate matter. It refers to tiny particles or droplets in the air that are two- and one-half microns or less in width. The units µg/m³ mean micrograms per cubic meter.

In most cities this is the primary factor when measuring air pollution so now you can forget about the other four pollutants we mentioned earlier which are: ground-level ozone, carbon monoxide, sulfur dioxide, and nitrogen dioxide.

PurpleAir and Sensors

PurpleAir sells inexpensive AQI sensors and provides data to the general public for free. How is that possible if I just said AQI sensors cost a small fortune? Well, their sensors make smart approximations. And since PM 2.5 is the main pollutant in most cities, collecting only this value basically gets you the AQI.

Sensors

To be specific, PurpleAir outdoor sensors have two Plantower PMS5003 sensors (for redundancy) for particulate matter and a Bosch BME280 for pressure, temperature, and humidity. The Plantower PMS5003 isn't nearly as accurate as the EPA's sensors but it is very cheap and, in most cases, accurate enough. Inside it has a laser that shines over a flow of air and measures scattering light to determine the particulate matter. The PMS5003 sensors do not measure all air particles properly but for typical pollution, it works well enough.

A spec sheet for the Plantower sensor here.

The Bosch BME280 isn't used to determine AQI, it's just there for additional data and since the PurpleAir product is designed for measuring AQI, the BME280 provides inaccurate readings, so you can basically ignore it.

Formulas and Summary

PurpleAir uses formulas to approximate AQI based only on PM 2.5 data. A link to a Google Doc authored by PurpleAir containing their formulas.

Now hopefully you have an understanding for the differences in data from PurpleAir vs the EPA. Consdering PurpleAir updates are within 10 minutes, vs the EPA updating in a few hours, I just go by PurpleAir at this point. Also their scores aren't exactly the same. PurpleAir scores are usualy a bit higher so being accustomed to one system is easier than trying to switch between the two in my head.

The PurpleAir outdoor product probably costs them about $40 each to make. They sell for about $275.

Building Your Own PurpleAir Sensor

A picture of one I made without the lid. (Sorry, I can't find a picture with the guts outside the box). This is actually the first draft of the box. Later versions look slightly different.

sensor no lid

A picture with everything closed up.

sensor closed

For this part I'm going to assume you have some familaraity with ESP8266 type work. I used a few sensors and an LED to indicate on the unit the status of the air. ESPHome integrates directly into Home Assistant so the data can be taken to other systems.

You'll need:

  • 1x (or 2x) PMS5003
  • ESP8266 (or similar)
  • BME280 (optional)
  • RGB LED (optional)
  • Arduino Programming Software

What I used:

  • 1x PMS5003
  • 1x BME280
  • 1x ESP8266
  • 1x RGB LED
  • ESPHome (for Arduino firmware)

Connect the wires and program your ESP8266 with the yaml code here. Sorry I don't have an exact wiring diagram but matching up the wires documented in the yaml configuration and the NodeMCU v2 should basically get you there.

To finish up the sensor you'll need a box for it. I 3D printed one and have links to the files here.

Converting PM 2.5 µg/m³ to AQI

I took the formulas from PurpleAir and converted them from javascript to Python and used AppDaemon for the integration. Code is here.

I also found someone who did it natively in Home Assistant without AppDaemon. Their solution is here.

Using the Sensor and Improving the Air in Your House

After I had the sensor working, the AQI was ~150 and I set the furnace to recirculate. The AQI went up! I was in dismay. All this work and now I have no way to improve air quality?

The next thing I did was take the filter out of the furnance and discovered it was rated FPR 7 (predicted to be equivalent to a MERV 11?). For a quick discussion of MERV ratings see here and here. FPR rating are apparetly designed to confuse the consumer.

FPR 7 is clearly not going to do anything for me. So I set out to get a MERV 14 filter installed ASAP. I didn't bother going to the Hardware Store because last time fires broke out, their shelves were cleared out. I went online and found a Commercial, 3M, MERV 14 filter on clearance online that was thicker (but my system takes any thickness) so I bought it. Unfortunately I didn't find it on Amazon so I had to wait a week for delivery.

Once the filter arrived I waited for some bad air. I then set the furance to recirculate and shazam! The air quality improved noticably! I finally had a measureable way to improve the air quality in my house.

Final Thoughts

After all this work, I still have a few remaining questions...

  1. Why does the PM 2.5 reading in my house increase when cooking? Is this unhealthy or is this a side effect of the low-cost sensor?
  2. What's the LRAPA-like conversion factor for my area?

Number 2 brings up one last thing you can look into which is basically research that has been done with PurpleAir and how it relates to EPA AQI scores. There are actually quite a few papers on this with a substantial amount of research done so far. Google is your friend here.

By the way, I made judgments and opinions in this post that did not include sources so I encourage you to do some additional research on your own. Hopefully the links included here provide a good start.

Enjoy!

Comments !