Friday, July 30, 2021

Air Quality Charts First Take

After some finagling with Google Drive/Sheets API, I managed to update the python script to insert values directly into a Google Sheet. Following the official docs including setting up OAuth was a breeze, and my worst tripup was carelessly naming the .json file containing the secret key "token.json" (which is actually the refresh token to be generated upon initial authentication, and constantly updated to avoid expiry) instead of "credentials.json". Also had to add the user name to the test list in the API console. Once these rookie mistakes were fixed, the API worked pretty flawlessly. The next thing I'd like to do is maybe sandbox the access to a single file through the SCOPE parameter, instead of all the spreadsheets (or entire drive for that matter). Double checks to make sure I didn't publicly check in the private keys...


I placed one sensor inside, while another is sitting on the balcony, like so:


Here's the raw data plots after a few hours, with 20 minute polling intervals:





Nothing exciting to show yet, other than pretty close readings from both sensors both inside and outside. Some things to consider doing in the future include converting the values into Air Quality Index (AQI). The gist of the conversion is that for a given particle/pollutant, there are piecewise linear ranges (or "breakpoints") as the amount of pollutant goes up. For example, for PM2.5:


At "Good" concentrations of between 0 and 12 ug/m^3, it maps to 0-50 on the index. However, at the next "moderate" level (12.1-35.4 ug/m^3), we have a range of 23 ug/m^3 for the 50-100 on the index values. Interestingly enough for the 3rd range (35.5-55.4 ug/m^3), the range goes down to 20 ug/m^3 but then the forth range is 55.5-150.4 which is 100. I guess this must be based on some kind of prior knowledge on the potential health effects at different concentrations... We see a similar pattern for the PM10 values in that the ranges are increasing up to a certain level but then goes down at the "Very Unhealthy" level:




Monday, July 26, 2021

SDS011 Sensor Initial Comparisons

As a followup to the previous post, here is the basic python test code to poll the two sensors at 1 minute intervals, with a 15 second bootup time to stabilize the readings after each sleep period.

Following are two ~1 hour logging sessions, with the two sensors plugged into either side of my laptop, and _R and _L denotes the placement of each sensor. I swapped the two sensors between the two sessions in case there was any variance in the air quality across the surface of the desk itself ;)

Overall, it's difficult to say how well they work but it doesn't look too bad. I think a better test would be to compare across a longer period when more variance in the air quality is observed. One other thing I noticed even from these two rough and dirty tests is that the sensor seems to be sensitive to humidity, as the increase around 18:45 corresponded to when I took a shower... And it also looks like averaging a few consecutive readings for a single sample might make more sense given the amount of noise there is.