JarvisSan22 / OPC-N3_python

Python repository for OPCN3 and OPCN2 on RPI3
GNU General Public License v3.0
12 stars 8 forks source link
airquality-sensor alphasense gps opc opc-n2 opc-n3 opcn2 opcn3 sds011

OPC N3 Python repository

Author: Daniel Jarvis Contacts: JarvisSan21@gmail.com

Python library for the Aplhasense OPC-N3, and OPC-N2, connected through an SPI interface to a raspberry pi.

OPC-N3

Repository details

Basic functions scripts "OPCN3_test.py" for direct control of the OPCN3 functions. Basics log scripts "OPCN3_rec.py" to log the data to a CSV and a more advanced functional library under AQ currently operation at the University of Leed and Summit site in Greenland. The AQ library designed to work for multiple OPC attached to the same RPI3 logging all the data to one CSV file.

Dashbord "AQ/AQplotter" ( see repository for further instructions). Dashboard shows diffrent varaibles, as well as options for GPS maps and static maps, what work for multiple sensors in diffrent location. (More updates coming soon) Dashboard

OPCscripts details:

Bascis Function list:

AQ repositroy structure:

AQ set up

Once RPI3 is set up and connected to wifi
default set up packagesexample GPS Plotter scipts in "AQ/AQplotter"

'sudo apt-get update'

'sudo pip install psutil' used to check wifi in status.py

'sudo pip install ntplib' used to check time RPI3 and update it in status.py

Optional Installs

DHT install 'sudo python3 AQ/OPCscripts/DHT/setup.py install'

GPS install GPS used is G-mouse USB Gps Dongle, GPS set up on RPI3 follows those found on this youtube vid by KM4ACK, setting the GPS up as the RPI3 clock as well.

RPI3 external clock if the GPS is not attached to the Adafruit PiRTC is recommended to be attached to the RPI3 to stop the RPI3 time drifting when the internet is lost. Setup instructions

Getting the kit running

in OPCscripts 'cd/OPCscripts'

update varaibles.py 'nano variables.py'

Update the RPI3 name (RPINAME)

operation location (LOC), desired MODE: "LOG" or "GPS" or "TEST". "LOG" is for static site recording to csv, "GPS" added the lat, lon and altitude to csv allowing for mobile usage. "TEST" will create a new data file ever time "start.py" is run

RUNNING sensors (RUNSEN) (Note: multiple OPC sensors can be added) The connection ports (RUNPORTS), if your not sure what port it is 'cd /dev/' then unplug and replug the OPC cable DHT setting, if DHT is connected set "DHTON" to "ON", and insert the DHT name in (DHTNAMES) and connected RPI pin in (DHTPINS)

variables

With all variables now set up hopefully correctly by just running start.py the attached OPC sensors will start logging

'python3 start.py'

This command can be added to crontab to get the sensors running on startup. 'sudo nano crontab -e'

'@reboot python3 AQ/OPCscripts/start.py'

SDS011 support

With an plugged in SDS011, in 'variables.py' add "/dev/ttyUSB0" as the first variable in RUNPORTS and do the same for the name (i.e DSO11_1) in RUNSEN. run 'python start.py' (for some currently unknown reason python3 does not work with the SDS, will fix soon). This will add a columns for the SDSO11s; sds-pm2.5, sds-pm10 and the other unkownvalue (assumed to be TSP) reading.

SDSsetup

Error log:

To do:

Case