Skip to content

imoralesgt/METEO

Repository files navigation

METEO

TFM MSEEI Universidad de Malaga

Iván René Morales Argueta - 2018

===========================================================

ToDo List

Meteo

  • Connect to MQTT Broker in object constructor
  • Sample each sensor using separate threads
    • Create a generic sampling method (one-shot), which receives the sensor name as parameter
      • sampleSensor (sensorName)
      • Front-end interface variables (i.e. Air Quality, instead of Humidity+Gas_Resistance)
    • Create a thread/method to periodically launch the one-shot sampling method
    • Generate as many threads running this method as required
    • Kill sampling threads during object destruction Destructor not compatible with threaded implementation
    • Implement a mutual-exclusion mechanism to avoid access violations
  • Send sensors' data via MQTT using topics to distribute data into different channels
  • Each "METEO" station MUST have a vaild (integer type) identifier, starting from 0
  • Topics should accomplish with the following template:
    • METEO/<stationNumber>/Data/<sensor>
    • Valid <stationNumber> (identifiers) are integers from 0 to N-1
    • Valid <sensor> values are:
      • Temperature (Environmental temperature) [temp]
      • Humidity (Relative humidity) [hum]
      • Pressure (Local atmospheric pressure) [pres]
      • Light (Incident light measurement) [light]
      • AirQuality (Air quality as pollution measurement) [airQ]
      • PPM (Raw particle count) [ppm] PPM is irrelevant. Instead, PPM field used to transmit raw gas resistance value
  • A special topic may be used to set/get the sampling period dymanically
    • METEO/<stationNumber>/Settings/SamplingRate/<sensor>
    • <sensor> field (sub-topic) is the same as described before
    • Sampling rate value must be validated to remain between a valid range
      • Min sampling rate 1 minute
      • Max sampling rate 120 minutes
      • If a sampling rate (SR) out of these limits is set, a default value will be chosen if a prior valid SR wasn't set yet; otherwise, the last valid SR will remain active
  • (Optional) A special topic may be used to remotely reboot the device if no Alive beacons have been received
    • METEO/<stationNumber>/Setiings/Reboot
    • A unique key must be sent as password (through Reboot topic) to force a reboot
    • Key will be stationNumber-dependent and time-dependent (unix format) hash
    • Hash must be computed by UI
  • A special topic may be used to announce "I'm Alive" messages from stations to broker
    • Invoke it via a separate thread as it may behave as a locking method
    • METEO/Alive
    • Each station should publish a message containing only its <stationNumber> periodically (ie. every 1 minute)

Printed circuit board

  • Design a PCB to place the sensor boards and the User-Interaction hardware (push-button + LED)
    • Design must be compatible with Raspberry PI 3 header footprint
    • Power must be supplied from Raspberry PI's 3v3/GND breakout pins
    • Manufacture PCB and test functionality

BME680_METEO

  • Compute Air Quality (%) using Humidity and Gas measurements
  • Compute PPM using Gas Baseline and Gas measurements Not a requirement. Discarded from further releases.

User Interaction

  • Add an LED status indicator to show whether the server is running or not (using RPI-GPIO)
  • Add a push-button input to hard-reset the server via a separate thread if anything fails (using RPI-GPIO)

Data management

  • Grab sensors' data from MQTT broker and process it to deliver filtered information
  • Store the processed data into a SQLite database
  • Retreive data from Broker and append it to a table within in the DB (running in parallel thread?)
  • Export table's content to a CSV when required
  • If several measurements from different sensors retreived within the same MINUTE, store them in the same register row.
  • If several measurements form the same sensor retreived within the same MINUTE, average grabbed values and then store the last average computation.

Reliability

  • Run meteo.py as a standalone application
    • Set flag to meteo.py
      • chmod +x meteo.py
  • Autorun on boot
    • sudo crontab -e
    • @reboot /home/pi/METEO/meteo.py &
  • Software Watchdog Timer
    • Run a parallel process (subscribed to ALIVE topic) to check whether METEO is running or not
    • Restart METEO process after 3 consecutive ALIVE periods with no answer
    • Start WDT timer after the first ALIVE message arrives

User interface

  • Node-RED User Interface

About

TFM MSEEI Universidad de Malaga - METEO

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors