Operation - SteveCossy/IOT GitHub Wiki

This page sets out the process used to gather, store and visualize sensor data. The most visual elements of the project are generated by scripts from the LoRaReAd folder. Currently this is running in my back yard in Newtown, Wellington. Kihi-01 sensor. Kihi-02 sensor. Of particular interest is the wifi connection between the gateway and my home wifi. (The Cayenne server supporting these links seems to have a fault as at Thursday 2 April.)

Most information about development of this project will be found in the the Issues discussions.

Steps to make everything work are:

  • Run an updated old bash script, Run-If-Needed-ZIP.sh, that starts the Python code. No need to have a cron job to start the script on reboot, because this script will catch a restart anyway.
  • That script starts the main Python code, LoRa_to_MQTT.py, which reads a LoRa module over serial, and sends output to an MQTT broker (currently Cayenne).
  • LoRa_to_MQTT chugs away (that's a technical term) reading data and sending it to the cloud, as well as keeping a local copy in a local CSV file. Location of the local files, and cloud being used is specified in variables near the start of LoRa_to_MQTT.py.
  • If there is an error in LoRa_to_MQTT.py, three things happen:
    • Outputs the traceback into a file 'LOG_'
    • Writes an entry into a error CSV, containing the timestamp, device id, and script name
    • Sends a status flag to Cayenne, with a number less than 0 (currently -1)
    • Cayenne has a trigger set to email me if this happens. As well as that, the Cayenne Status channel can give a useful reference showing when crashes have happened. Example of data report from Cayenne Status channel