Measure air quality by measuring PM2.5 and PM10.
PM2.5 refers to atmospheric particulate matter (PM) that have a diameter of less than 2.5 micrometers, which is about 3% the diameter of a human hair. PM10 is particulate matter 10 micrometers or less in diameter.
Air Quality Index (AQI) | PM : Human Hair Comparison |
---|---|
Raspberry Pi 3 Model B+ | WINGONEER PM Sensor SDS011 |
---|---|
My preferred Python3 distribution is miniconda)_
All python requirements are defined in the requirements.txt file.
Instructions on how to install dependencies in the installation section.
The two streaming services that I have configured are Initial State and adafruit.io. There are many other options available, you will just need to make the necessary code modifications.
I like Pushover and this is the service I have configured in the code. Again there are many other options available, you will just need to make the necessary code modifications.
git clone https://github.com/rbocchinfuso/aqi.git
Note: If you don't have Git installed you can also just grab the zip:
https://github.com/rbocchinfuso/aqi/archive/master.zip
pip3 install -r requirements.txt
[local]
# serial device interface
device = /dev/ttyUSB0
# cycle time in seconds
cycle_time = 10
# service options = initialstate | adafruitio | both
services = initialstate
# mode options = dev | prod
mode = dev
[initialstate]
is_bucket_name = xxxxxxxxxxxxxxxxxxxxxxx
is_bucket_key = xxxxxxxxxxxxxxxxxxxxxxx
is_access_key = xxxxxxxxxxxxxxxxxxxxxxx
[adafruit_io]
adafruitio_username = xxxxxxxxxxxxxxxxxxxxxxx
adafruitio_key = xxxxxxxxxxxxxxxxxxxxxxx
pmtwofive_feed = group.feed
pmten_feed = group.feed
[pushover]
api_token = xxxxxxxxxxxxxxxxxxxxxxx
user_key = xxxxxxxxxxxxxxxxxxxxxxx
- Assumed that the air sensor is addressable using the /dev/ttyUSB0 device file. Adjust accordingly if it is at a addressable on a different device file.
- If you want to run aqi.py as a non-root user you will need to give the user access to the device file by executing:
sudo usermod -a -G dialout user
python3 aqi.py
Click her to go to LIVE Initial State Air Quality Index (AQI) Streaming Dashboard
Click her to go to LIVE adafruit.io Air Quality Index (AQI) Streaming Dashboard
- Daemonize the app or call from cron? (TBD)
- Migrate build from my prototype Raspberry Pi configuration to an older spare Raspberry Pi B+ board for permanent deployment.
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request ツ
- version 0.1 (initial release) - 2020/03/28
- Rich Bocchinfuso – @rbocchinfuso – <[email protected]>
- Eden Bochinfuso - <[email protected]>
MIT License
Copyright (c) [2020] [Richard J. Bocchinfuso]
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.