Tuesday, August 31, 2021

blargh.

The wildfire smoke finally turned around and hit us for a few days. I bought a couple PurpleAir sensors, which was useful, but awkward: they have built-in webservers, but the outdoor sensor actually has two sensors for some reason. And it was a pain to look at the two side-by-side, when that's actually an important comparison.



One of the many nice things about being a computer programmer is that I know how to find the data made available for computer programs to read and process. And one thing that makes me an expert is knowing that while I could go through the work of creating an authorization key to fetch the data from PurpleAir's service, that's silly, because the sensors are right here on the house network.

   "Adc" : 0,

   "DateTime" : "2021/09/01T06:26:33z",

   "Geo" : "PurpleAir-c882",

   "Mem" : 14200,

   "SensorId" : "10:52:1c:44:c0:87",

   "current_dewpoint_f" : 53,

   "current_humidity" : 35,

   "current_temp_f" : 84,

This is quite civilized: the sensor provides this in plain text, and the fields aren't rocket science to figure out. I don't know what Adc is, but I also don't care, because I want temperature, humidity, and the Air Quality Index, which the sensors label pm2.5_aqi. (PM 2.5 overwhelmingly dominates the AQI calculation for our purposes.)

We have data! But data is not information; information comes when you take your data and apply your questions. You can see that just in the screenshots up there: because I'm not an expert, 759 particles/deciliter is not a number that tells me if I should go outside or turn on another air filter. I need the user-friendly AQI for that. Next technical challenge, is that I would like to know...

  • when the AQI goes above one or more threshold values,
  • when it goes back down,
  • the relationship between inside and outside AQI,
  • and temperature/humidity/atmospheric pressure, just for fun.
If you've ever done any data processing or visualization—for which you probably used Excel and/or Google Sheets—you have a hint of the challenges, if you want to collect 10 data points, every 2 minutes, store them somewhere, do calculations on them, make them available via a web server, graph them, show the graphs next to each other...it's a pain in the ass. For businesses, it can be thousands or millions of data points, every few seconds. It's so hard that there are many companies you can pay to do it for you. DataDog is one of those. I wrote a 37-line script to send the sensor data out to DataDog, which also lets me set up alerts on it.


If you look at the live version of the charts, you can change the time window, and moving the mouse pointer along any of the charts shows a cursor at the same moment on each other chart, so you can correlate events.

So that's been useful. The wind has turned back for the moment, sending the smoke back to the rest of North America. But it will be back.

No comments:

Post a Comment