Giter Club home page Giter Club logo

airqmonitor's Introduction

Air Quality Monitor

Introduction

Python-based drivers for

Tested on Raspberry Pi Zero/Zero W2.

Wiring

SPS30 Sensor

                                 Pin 1   Pin 5
                                   |       |
                                   V       V
.------------------------------------------------.
|                                .-----------.   |
|                                | x x x x x |   |
|                                '-----------'   |
|     []          []          []          []     |
'------------------------------------------------'
Pin Description UART I2C
1 Supply voltage 5V VDD VDD
2 UART receiving pin/ I2C serial data input/ output RX SDA
3 UART transmitting pin/ I2C serial clock input TX SCL
4 Interface select (UART: floating (NC) /I2C: GND) NC GND
5 Ground GND GND

SEN5x Sensor


.---------\                      Pin 6     Pin 1
|          \                       |         |
|           \                      V         V
|--------------------------------------------------.
|                                .-------------.   |
|                                | x x x x x x |   |
|                                '-------------'   |
|     []          []          []          []       |
'--------------------------------------------------'
Pin Description I2C
1 Supply voltage 5V VDD
2 Ground GND
3 I2C serial data input/ output SDA
4 I2C serial clock input SCL
5 Interface select (/I2C: GND) GND
6 Not connected -

BMP280 Sensor

Pin Description I2C
1 Supply voltage 3.3/5V VDD
2 Ground GND
3 I2C serial clock input SCL
4 I2C serial data input / output SDA
5 Interface select (I2C: VDD/SPI: GND) CSB
6 Sensr Addess (0x76: GND / 0x77: VCC) SDO

I2C Interface

  SPS30 Sensor Pins                           Raspberry Pi Pins 
                                              [default, see below for alternative i2c buses]
.-------.-----.                             .----------.---------.
| Pin 1 | VDD |-----------------------------|    5V    | Pin 2/4 |
| Pin 2 | SDA |-----------------------------| I2C1 SDA |  Pin 3  |
| Pin 3 | SCL |-----------------------------| I2C1 SCL |  Pin 5  |
| Pin 4 | GND |-----.                       |          |         |
| Pin 5 | GND |-----'-----------------------|   GND    | Pin 6/9 |
'-------'-----'                             '----------'---------'
  SEN5x Sensor Pins                           Raspberry Pi Pins
                                              [default, see below for alternative i2c buses]
.-------.-----.                             .----------.---------.
| Pin 1 | VDD |-----------------------------|    5V    | Pin 2/4 |
| Pin 2 | GND |-----------------------------|   GND    | Pin 6/9 |
| Pin 3 | SDA |-----------------------------| I2C1 SDA |  Pin 3  |
| Pin 4 | SCL |-----------------------------| I2C1 SCL |  Pin 5  |
| Pin 5 | SEL |-----------------------------|   GND    | Pin 6/9 |
| Pin 6 | NC  |-------                      |          |         |
'-------'-----'                             '----------'---------'
  BMP280 Sensor Pins                          Raspberry Pi Pins
                                              [default, see below for alternative i2c buses]
.-------.-----.                             .----------.---------.
| Pin 1 | VDD |-----------------------------|    5V    | Pin 2/4 |
| Pin 2 | GND |-----------------------------|   GND    | Pin 6/9 |
| Pin 3 | SCL |-----------------------------| I2C1 SCL |  Pin 5  |
| Pin 4 | SDA |-----------------------------| I2C1 SDA |  Pin 3  |
| Pin 5 | CSB |-----------------------------|   VCC    | Pin 2/4 |
| Pin 6 | SD0 |-----------------------------|   VCC    | Pin 2/4 | 
'-------'-----'                             '----------'---------'

Note: SCL and SDA lines are OPEN DRAIN. They should be connected to external pull-up resistors (E.g. R=10kOhm)

Multiple I2C Interfaces @ RPi


  sudo nano /boot/config.txt
  
  dtoverlay=i2c-gpio,bus=5,i2c_gpio_delay_us=20,i2c_gpio_sda=5,i2c_gpio_scl=6
  dtoverlay=i2c-gpio,bus=4,i2c_gpio_delay_us=20,i2c_gpio_sda=17,i2c_gpio_scl=22
  dtoverlay=i2c-gpio,bus=3,i2c_gpio_delay_us=20,i2c_gpio_sda=27,i2c_gpio_scl=23


Note: On long i2c lines use i2c_gpio_delay_us=100

Small wiring PCB for Raspberry PI

Install

cd AirQmonitor

git clone https://github.com/pklosko/AirQmonitor

Add your sensor.comminuty ID = SC_SENSOR_ID in AirQmonitor.py

Run after boot

sudo vi /etc/rc.local

su - pi -c '/home/pi/AirQmonitor/AirQmonitor.py'

Example usage

See example.py | exampleSEN.py

Default parameters of SPS30 class

Parameter Value Description
bus 1 I2C bus of Raspberry Pi
address 0x69 Default I2C address

Default parameters of SEN5x class

Parameter Value Description
bus 1 I2C bus of Raspberry Pi
address 0x69 Default I2C address

Default parameters of SHT40 class

Parameter Value Description
bus 1 I2C bus of Raspberry Pi
address 0x44 Default I2C address

Default parameters of BMP280 class

Parameter Value Description
bus 1 I2C bus of Raspberry Pi
address 0x77 Default I2C address
oversampling T 1x temperature oversampling
oversampling p 1x pressure oversampling
standby time 1s stand-by time
IIR filter off IIR filter
Mode forced mode

Output data format

RAW Data - JSON - SPS30
{
  "t": 22.02258335240711,
  "t1": 22.546321267577, 
  "h": 41.55664911879148,
  "p": 100142.342398298,
  "pm1": 1.285,
  "pm2": 5.262,
  "pm4": 9.045,
  "pm10": 10.969,
  "nc0": 1.0,
  "nc1": 1.0,
  "nc2": 4.473,
  "nc4": 5.034,
  "nc10": 5.11,
  "tps": 1.63
}
RAW Data - JSON - SEN5x
{
  "pm1": 1.28,
  "pm2": 5.22,
  "pm4": 9.45,
  "pm10": 10.69,
  "h": 51.0,
  "t": 21.0,
  "voc": 101.9,
  "nox": 3276.7 # SEN54 doesn't have NOx sensor
}

See api.sensor.community

See TMEP.cz Wiki

Dependencies

None

To-Do

None

SPS30 code based on Sensirion SPS30 code by @dvsu

airqmonitor's People

Contributors

pklosko avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

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.