SkillAgentSearch skills...

MySense

Python based framework for collecting data from sensors and brokers to forward the json values to database, brokers, display

Install / Use

/learn @teusH/MySense
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

<img src="https://github.com/user-attachments/assets/d440ab8b-911f-4806-b53e-cd0cef94175b" align=right width=100>

MySense

Last update of the README on 2nd of Februar 2020

Description

Software Infrastructure or framework for managing environmental sensors and data aquisition.

This is WORK IN PROGRESS! All available Python3 scripts/modules are tested standalone as alpha tests and with some real life examples. In this alpha phase one is recommanded to test and improve the modules before it is taken fully operational. One is invited to comment on functionality, improvements, and higher level modules to use this library module set.

Be aware that there are discussions going on to change the IoT website query interface and website query implementation of the Samen Meten API.

Outline

A description of the MySense PyCom based measurement kit, data collection and data visualisation is provided in a presentation at Meetkoppelting20 conference in Amersfoort, Jan 2020. The PDF slides can be found at <a href=""http://behouddeparel.nl/sites/behouddeparel.nl/files/20200125-Koppelting-WAR-Amersfoort.pdf" alt="an How To build a kit and show the results">"Measuring Air Quality in an Agri Region: an How To"</a> (PDF 3 MB).

Licensing

Open Source Initiative https://opensource.org/licenses/RPL-1.5 Unless explicitly acquired and licensed from Licensor under another license, the contents of this file are subject to the Reciprocal Public License ("RPL") Version 1.5, or subsequent versions as allowed by the RPL, and You may not copy or use this file in either source code or executable form, except in compliance with the terms and conditions of the RPL.

All software distributed under the RPL is provided strictly on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, AND LICENSOR HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT, OR NON-INFRINGEMENT. See the RPL for specific language governing rights and limitations under the RPL.

MySense datacollector (Linux systems)

The first station we build with RPi, gas, temperature, RHG and dust sensors looked like this: <img src="https://github.com/user-attachments/assets/6c587997-d47b-46ee-9d5a-ac65be9790d2" align=right height=100>

MySense is able to act as air quality measurement kit or node broker (Pi based). As measurement kit MySense will collect measurements from dust, gas and/or gas sensors and location sensor, and forward the data to an external data concentrator(s) (database(s), as well as data broker as eg mosquitto and influx), files eg spreadsheets, and display (Adafruit tiny display or console).

As dataconcentrator MySense will connect to other data concentrator instead of collecting the data from sensors.

Two different controllers for the kits are supported:

  1. Raspberry Pi for a high degree of functionality and easy block building reasons, while using lan/wifi/G4 as communication channel and
  2. ESP32 LoPy controller (micro python) from PyCom when only a very few sensors can be hooked up. This kit uses LoRaWan as communication infrastructure via a public TTN server. This measurement kit is in beta test since June 2019. The PyCom folder will show latest firmware snapshot.

The bus used for sensors are: USB (Pi: serial), TTL, GPIO (SPI) and I2C. The scripts are all written in Python 2/3.

Visual feedback is provided with led/button (power On/Off) and optional an Oled display (64X128).

MySense LoPy-4 PyCom controller

<img src="https://github.com/user-attachments/assets/26fb876f-dd83-490d-804c-52ccdb3062fc" align=right height=100> <img src="https://github.com/user-attachments/assets/0220ea75-3fba-4850-9bc1-7325a25000a1" align=right height=100>

MySense sensor kits can also be applied as air quality satellite sensorkits. E.g. using LoPy or WiPy PyCom controllers with GPS, dust and meteo sensors. In this case the data will be forwarded to <a href="https://www.thethingsnetwork.org/docs/lorawan/">LoRaWan</a> dataconcentrators as eg The Things Network or Mosquitto server. The LopY has support for SiGFox (due to proprietary chracter of this method it has been deprecated). The upload of uptaes to the firmware via PyCom OTA is planned. Currently OTA (Over the Air update) is supported via a new firmware load via wifi.

MySense (Pi based) in data concentrator mode has the possiblity to collect these measurements data from e.g. the TTN MQTT dataconcentrator.

The bus used for sensors are: UART (serial), I2C and GPIO.

The scripts are written in (embedded) micro Python. Micro python has more functionality as the language C e.g. used with Arduino boards.

The Marvin ESP controller has been deprecated due to a problem with on board LoRa antenna in outdoor conditions.

Visual feedback is provided with RGB led and optional an 128X64 oled display.

The LoPy based measurement kit supports to run with a solarcel and accu. For enabling this the architecture has had a major redesign. The softwqare manages accu load as well tries to minimilize energy as much as possible.

The LoRa directory will give information to build a DIY TTN LoRa gateway.

The INSTALL.sh RPi configuration script will support to install GPS, oled display, RGB led, WiFi remote access, G4 access and other standard functionality to a Raspberry Pi based gateway e.g. RAK831, RAK833 or IC880a-PSI and Pi based gateway for a small budget TTN gateway. Have a look at the RAK7258 LoRa gateway. A complete (indoor and outdoor) gateway for about €140 (AliExpress). As such providing you with more functionality as commercial offered gateways without a subscription fee. If needed use a (€ 40) SIM router to connect the gateway to mobile data access.

At this moment we have 20 measurements MySense LoRa kits in the region running. Seven kits run with solar cells around a cattle enterprise. The entrepeneur uses the outcome of data to minimize the emissions.

Goal

Provide a generalised dynamic high quality Open Source based air quality monitoring infrastructure to allow:

  • environmental measurements with high end standard off the shelf sensors
  • data acquisition
  • dynamic transport of data to other data systems: e.g. databases, mosquitto, Influx,...
  • data storage and archiving
  • access for free visualisation of local emissions
  • free availability of the data
  • free availability of all software (under GPLV3 or Open Source reciprocal license, improvements of software remains in the public domain)

The project is run by volunteers on a non-profit basis.

Supported functionalities

Major functionalities will be added on the fly. Much is dependent on the quality of the applied sensors and visualisation possibilities of the data.

  • supported dust sensors: Nova (only PM2.5, PM10), Plantower (PM1, PM2.5, PM10, counters PM0.3 up to PM10, average grain size, advised), Sensirion (PM1, PM2.5,PM10, counters PM0.3 up to PM10, average grain size, advised). PM count data is needed to allow a much improved calibration. PM sensors providing only mass values are discouraged. PM sensors (some Plantowers and Sensirion sensors) for outdoor and non condensing conditions are encouraged.
  • meteo sensors: Adafruit (DHT: temperature and humidity, deprecated due to humidity problems), Bosh (BME: temperature, humidity, air pressure and air quality), Sensirion (SHT: temperature, humidity). Humidity is a must for calibration of dust measurement.
  • TTL or I2C interface to other sensors using standard Grove connectors. Use the standard API to standard product driver via Python. E.g. I2C anemometer, I2C/TTL gas sensors, etc.
  • solarcel and battery management (deepsleep and battery low level warning).
  • calibration on product base as well on measurement base to enable calibration.
  • GPS to support proper localisation. Mobile is supported.
  • communication with LAN, Wifi (discouraged due to high failure rate), G4 mobile data, and (TTN) IoT LoRaWan.
  • visualisation of the measurements and current status via a display.
  • auto detection of connected sensors: plug and play
  • remote control and wakeup
  • remote OTA update
  • dynamic sampling and interval of measurements
  • notices based warning system
  • visualisation of graphs for (Drupal) website with HighCharts garaphics
  • measurement and kist configuration archiving with MySql database.
  • scalability
  • simple adaptation of new sensors
  • modular architecture and high level programming (scripting) to remain state of the art
  • stanbard data interfaces (e.g. json, mosquitto, influx)

Discussion

MySense supports calibration of every single sensor. Sensor values will differ between the sensors within a branche and between branches. Correlation software is included. Advised is to calibrate the sensors regularly for a test period of several days (conditions should vary in the test period).

Dust measurements are done by counting the particles. The most common dust sensor is the Nova SDS011. The Plantower PMSn003 (PMS7003 indoor and PMSx007 outdoor) and Sensirion SPS30 are however 1/3 in size and counts more classes of particles as well provides also the raw (real partical count) values. All have a fan and laser which are powered off in idle state. The SPS30 is small, use less energy but has air inlet and outlet aside of each other. Outdoor PM sensors have a higher cost price (2X or even 4X higher).

Dust measurements are (expnential) influenced by humidity. A correction algorithm to enable to compare the dust measurements with reference sensor equipment (e.g. MetOne BAM-1020) is in beta test (start of 2019). There is a plan for scientific statistical calibration report together with Uni Leiden, RIVM and Scapeler. The plan is to be able to forecast PM levels for a short coming period as well.

<div style='vertical-align: top; clear: both'> <figure> <img src="https://github.com/user-attachments/assets/3080cf7e-e04e-48c2-9ed1-2cd9033791c1" align=left
View on GitHub
GitHub Stars71
CategoryData
Updated14h ago
Forks18

Languages

HTML

Security Score

80/100

Audited on Apr 6, 2026

No findings