Introduction: PurpleAir Air Quality Status LED Display

With the recent wildfires in California the air quality in San Francisco has been greatly impacted. We found ourselves checking the PurpleAir map over and over again on our phones or laptops trying to see when the air was safe enough to open the windows or get a chance to go outside.

I’ve always been a fan of Informational Furniture, things designed to provide information but not requiring explicit actions and I thought this would be a perfect thing for this time.

The goal of this project was to provide a quiet, non-distracting status display that updates itself in the background while allowing us to notice when the air outside has gotten better enough to get outside or open the windows.

Supplies

Adafruit Feather M0 WiFi with header pins https://www.adafruit.com/product/3010

Adafruit stacking headers https://www.adafruit.com/product/2830

Adafruit Jewel 7 https://www.adafruit.com/product/2226

3.3V rechargeable battery or USB cable https://www.adafruit.com/product/2226

Connection wire or Jumper wires

Piece of thin plastic (I’ve used recycled food containers)

Plastic lid l(ike from an oatmeal or raisin container)

Parchment paper

Plastic top Soldering iron

Solder

Computer with Arduino IDE and USB cable for programming

Step 1: Step 1: Gather Your Parts and Tools

Adafruit Feather M0 WiFi

You may need to solder the header pins and stackable headers to your Feather. I like header pins and/or the stackable headers to make it easier to quickly connect components together using jumper wires

Adafruit Jewel 7

You will likely need to solder connection wires to the pads on the Jewel board. This project needs three connections from the Jewel to the Feather. Power, Ground and Data Input. I use colored wired to keep things clear. Red for Power, Black for Ground and Green for Data Input.


Connection wire

If you have it, Red, Black and Green wires are helpful to wire up the Jewel to the Feather.

3.3V rechargeable battery or USB cable (optional)

The Feather can directly charge a small battery which can make this status display portable. I find that the battery can power the Feather and the LEDS for about 6 hours

Large tin can or Oatmeal Box

I like the look of round output, but you could use any project box or container you have.

Parchment paper

I use the parchment paper to diffuse (soften) the light from the LEDS, you can try various things though try not to use something that changes the color of the light

Plastic top

I found cutting the inside of a plastic lid allowed me to glue the parchment paper to the lid. This allows me to take the lid off to recharge the battery and remove the hardware as needed. You could just tape the paper to the can if you are using USB power and don’t plan to reuse the electronics for a while. (I used a single piece of tape like a trap door while testing things out)

Soldering iron / Solder

You will likely need to solder wires to the Jewel, I used headers and jumper wires to connect everything together.

Step 2: Step 2: Connect Everything Together

I soldered the colored wires to the Jewel

I then plugged in the wires in the following order

  • Red wire / Power to pin 2 (3.3V) on the Feather
  • Black wire / Ground to pin 4 (GND) on the Feather
  • Green wire / Data In to pin 9 on the Feather (optional)

I attached the battery to my Feather at this point as well

I put a piece of masking tape on the bottom of my Feather to protect the pins

I attached my Jewel to a piece of round plastic to protect its exposed pins and also provide a way to point the LEDS straight

Step 3: Step 3: Use the Purple Air Website to Find a Local Sensor to Read Air Quality Data From

[Instructions updated in June 2023 to reflect changes in how the Purple Air API and Key work]


Navigate to the Purple Air website at https://www.purpleair.com

Zoom in to your neighborhood and find the closest outside sensor

You will want to turn OFF “Inside Sensors” to find sensors reporting the outside air quality

Click on the local sensor and a small dialog box will appear which shows the sensor name and recent air quality data.

You will notice a link at the bottom of this box labeled “Get this widget” Click on “Get this widget”, you will notice a new box appears with HTML/text inside of it.

We will use the sensor number from the first bit of this text in our code to get current sensor reading It will look something like 'PurpleAirWidget_12345', the 12345 will be the sensor number we want to use in the source code.


Get the source code

You can download the source code to this project from the repository on Github.

Edit the Arduino sketch to update the following information:


Edit the file arduino_secret.h

Put in your SSID and SSID password

Save the file


Edit the file PurpleTheopolis.ino

Replace the Sensor ID number fragment for the Sensor you wish to monitor in variable PURPLE_AIR_SENSOR

Get a new Purple Air API Rest Read Key from https://develop.purpleair.com/keys and put that value in raw variable PURPLE_AIR_API_KEY

Note: The update frequency used by default is 10 minutes, but you may wish to take samples over a longer period like 30 or 60 minutes Caution: Reading too quickly isn’t required and may get your requests limited

Upload the sketch and confirm that the LEDs’ color corresponds to the current air quality reading.

This sketch uses the current PM 2.5 reading and does not attempt to compute any long term trends or AQI.

You can edit the color routine to change the color mappings as desired!

What you will see is the value of the current reading (seen in the left hand lower box of the current station’s popup window)

Step 4: Step 4: Put Everything Together and Enjoy!

Cut a hole large enough to snake your USB power cable through the back of the can (aka the bottom of the can)

Cut a small circle of non-conductive material like plastic to line the bottom of the tin can.

Connect the Feather to the USB cable and place the Feather in the can.

I have cut a small riser out of a toilet paper tub to hold the Jewel LED board above the Feather and the bottom of the can.

A small piece of masking tape can hold them all together.

Put the lid on the can and you should be done!

I hope you found this project helpful and clear. Please let me know any feedback or pictures of your builds!

You can follow me and my projects on Twitter and my blog ZebraCatZebra