Skip to content

rbocchinfuso/aqi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Air Quality Index (AQI) Monitor

Open Source Love png2 made-with-python MIT license Maintenance

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

Requirements

Hardware

Raspberry Pi 3 Model B+ WINGONEER PM Sensor SDS011

Prototype build

Prototype AQI Monitor

Software

Python3

My preferred Python3 distribution is miniconda)_

Python libraries

All python requirements are defined in the requirements.txt file.
Instructions on how to install dependencies in the installation section.

Streaming

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.

Alerting

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.

Installation

Get the code from GitHub

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

Install the Python requirements

pip3 install -r requirements.txt

Configuration

Copy the config.ini.example file to config.ini

Modify the config.ini file

[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

Notes

  • 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

Usage example

python3 aqi.py

AQI in action

AQI Running

Live feeds

Initial State Air Quality Index (AQI) Streaming Dashboard

Click her to go to LIVE Initial State Air Quality Index (AQI) Streaming Dashboard Initial State Air Quality Index (AQI) Streaming Dashboard

adafruit.io Air Quality Index (AQI) Streaming Dashboard

Click her to go to LIVE adafruit.io Air Quality Index (AQI) Streaming Dashboard adafruit.io Air Quality Index (AQI) Streaming Dashboard

TODO

  • 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.

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request ツ

History

  • version 0.1 (initial release) - 2020/03/28

Credits

License

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.

About

Raspberry Pi Air Quality Index (AQI) Monitor

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages