Giter Club home page Giter Club logo

pm-monitor's Introduction

Particulate Matter Monitor

Python application Mutation

Open in Gitpod

Overview

An air quality monitoring app.

Reads data from an SDS011 particulate matter sensor via a serial port and uploads it to an Adafruit IO account.

Inspired by an article from HackSpace magazine issue 21 (August 2019).

Disclaimer

There are probably much more comprehensive and robust implementations out there for reading from the SDS011 sensor. Don't rely on this app for accurate and reliable data.

Why

Small particulate matter less than 10 microns in diameter (PM 10) is recognised globally by health and environmental organisations as a common contributor to air pollution.

Health Implications of PM

Exposure to particle matter less than 2.5 microns in diameter (PM 2.5) is known to cause and contribute to respiratory and cardiovascular illness.

There is some evidence which suggests that high levels of PM may contribute to the transmission and lethality of COVID-19.

Recommended hardware

  • Raspberry Pi (for convenience of placing the sensor)
  • SDS011 PM sensor
  • Serial to USB adapter

Install

A python virtual environment is recommended. You can easily create a new virtual environment using venv.

python -m venv PM-App

Launch the virtual environment

E.g on a Unix/Linux OS run the execute the following from the root of the repo source PM-App/bin/activate

Required dependencies are defined in requirements.txt.

You can install these using pip.

Pip install -r requirements.txt

AdaFruit IO

An Adafruit IO account and API key are required in order to upload data.

Setup

Run python main.py setup to launch the setup script.

This script will prompt for input and write the following values to the config.yml file:

  • AIO username
  • AIO API Key
  • PM 2.5 feed name in AIO account
  • PM 10 feed name in AIO account

Your AIO username and API key can be found on the AIO profile page, in the My Key tab. See the AIO API docs for more details on creating and useing API keys

Check that the feeds exist in your AIO account before proceeding to start the app. You may need to manually creat the feeds. Check the contents of the config.yml file before proceeding to start the app.

Usage

Ensure that the PM sensor unit is connected via a USB port to the device which will run the application Check that the device has an active network connection Run python main.py start to launch the app.

Check the temrinal output to confirm that the sensor is active and the application is correctly reading and logging values Check the AIO feeds to confirm that the application is correctly sending data to the feeds

Testing

Automated tests are implemented using the Pytest framework.

From the root directory of the repo run python -m pytest to execute tests.

This project uses cov for reporting test coverage

From the root directory of the repo run python -m pytest --cov to execute tests and generate a coverage report.

Known Issues

pm-monitor's People

Contributors

andrewjanuary avatar dependabot[bot] avatar

Watchers

 avatar

pm-monitor's Issues

Improve logging

Improve logging particularly in the following areas:

  1. Uploader class
  2. Sensor connection
  3. Failure of config file read e.g. on initial setup

Exploratory Testing

Time limited exploratory testing sessions to cover the following areas:

  • Installation
  • Setup and configurations
  • Adafruit IO API connection failures
  • Comparison of sensor data against a trusted air quality data source
  • Polling of sensor, particularly to investigate the risk of the sensor laser being in an 'always on' mode which may reduce the sensors lifespan.

Document your approach and findings in a short document highlighting bugs, key risks and discoveries.

Introduce local persistence of PM records

  • Introduce a simple MongoDB collection to store PM records
  • Writes to DB occur either in offline mode or in both offline and online mode
  • Refactor existing offline script
  • Update setup script to allow for config of local DB
  • Update dependencies to install MongoDB
  • Introduce unit and integration tests for persistence functionality
  • Update existing github actions workflow to install and config MongoDB instance

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.