On June 7 2020, I saw a Kickstarter campaign for an environmental sensor called metriful and decided to back it. Thanks to COVID-19, I figured I would be spending much more time at home and it would be nice to have an idea of what that environment is measurably like. I have a two-bedroom apartment, so I backed it with enough to get 3, one for each.

https://www.kickstarter.com/projects/metriful/sense-indoor-environment-monitor

At one point in the campaign, they announced that they would support the multiple particulate sensors. I opted for the SDS011 (https://aqicn.org/sensor/sds011/) because it was still within my budget and it seemed like a more accurate device.

I received the package in the mail on Wednesday 9/16/2020. I didn’t have time to look at it until the next day, at which point I decided to wire one up between afternoon zoom calls.

https://www.metriful.com/

https://github.com/metriful/sensor

The documentation to wire it up with the Raspberry Pi was complete, although I was kind of hoping for pictures as well. Looking up the pins of the Pi always feels a bit awkward for me for some reason.

I used a small breadboard for each. Sometimes, my mind mixes up anything that might be considered as having an opposite, like left/right or North/South. Today it was voltage/ground. When I wired up the second device to test it, the sample script for collecting sound hung. I quickly double checked the wires and they appeared to be correct. I was particularly concerned about mixing up the 3.3V and 5V for the different devices (metriful takes 3.3 and the SDS011 takes 5). I have destroyed some fun electronics in the past with that mistake. It all looked good though. I felt serious heat coming from the chip when I went to turn it off. It was extremely hot to touch. I immediately unplugged it and wondered if I had maybe gotten a bum chip. I quadruple checked my wiring. This time, things snapped into focus, like when a stereoscopic image suddenly becomes visible.

I realized I had reversed 3.3V and Ground. I immediately assumed that I had just completely fried the chip, especially based on the temperature. I let it cool down for a few minutes and then powered it back up again and Woohoo it seemed to work just fine!

I setup the script to run at start time in the simplest possible way. I added the following to /etc/rc.local. There are more robust and standard ways to accomplish this based on your distro, but this should work.

sudo -u pi /usr/bin/python3 /home/pi/sensor/Raspberry_Pi/IoT_cloud_logging.py &

Since I’m using a Raspberry Pi, I realized that it has a fairly bright red LED always on when it is powered up. I found this old post about older Pis. It turns out it works for the 3 and 3b+ as well. So I added this to /etc/rc.local as well:

echo 0 | sudo tee /sys/class/leds/led1/brightness # disable power LED

Finally, I wanted to make some small changes to the script, but I didn’t want to have to continually remove my tago.io token from the script before commits, so I created a configuration file using the configparser library and put it into ~/.metriful.

I learned a few interesting gotchas about configparser. First is that get pulls everything in as a string. I also realized that the script uses globals in conditionals, so I had to evaluate those. Search for the string “globals” in the code for examples on how. I also had to interpolate booleans in the config and there is a method getboolean for that. Finally, I learned that quotes get escaped and passed in as part of the string, so you DO NOT actually want to use quotes in your config file. I created an example config file called metriful.example_config that mirrors the default behavior of the original script.

After making these changes, I submitted a pull request. If you are interested in looking at my changes before they are merged (or if they aren’t merged).

https://github.com/billzajac/sensor

Finally, since it doesn’t feel like a significant privacy issue for me to share these, here are the two dashboards I have setup so far.

To summarize, the air quality in my apartment is often quite poor. Until seeing these numbers, I would drag around a purifier from room to room. Now I’ve decided my lungs will thank me for getting a couple more purifiers.