/AzureSpherePlantMonitor

🌱Azure Sphere app to monitor and publish sensor data about plants

Primary LanguageCMIT LicenseMIT

Azure Sphere Plant Monitor (Sprout)

An AVNET MT3620 starter kit magnetically attached to a shelf Sprout dashboard showing soil moisture data

An Azure Sphere app to periodically monitor and publish sensor data about some houseplants to a public dashboard. Automatically polls data from two chirp! soil moisture sensors, a SHT31D tempurature/humidity sensor, a ALS-PT19 lux sensor, and a LPS22H pressure sensor through a LSM5DSO Gyro. Data is then translated into a JSON package and uploaded through Azure IoT to an Azure Function, which loads this data into a MongoDB hosted on Atlas. After this data is loaded, it can queried by the SproutServerless Lambda and served to the Sprout Dashboard.

This program was built for the AVNET Azure Sphere MT3620 Starter Kit V1, but should still operate on other hardware given correct configurations.

Examples of the data collected is shown below. Current readings of all of these sensors can also be viewed on the Sprout dashboard.

  • Temperature data over one day: Graph of tempurature data logged using this project over a two week period
  • Temperature data compared with humidity data over one day: Graph of temperature and humidity data logged using this project over a two week period
  • Soil moisture data over one day from both sensors: Graph of soil moisture data logged using this project over a two week period
  • Soil moisture data reacting to the plant being watered: Graph of soil moisture data logged using this project over a short period, showing a large spike in one of the sensors readings

Internally, this program uses the EventLoop API for thread-safe event loop management and C-Macro-Collections for message queues. Sensors are polled every minute, and the resulting messages are uploaded ever 10 minutes. In the event of a network disconnection, messages are queued until the network is reconnected or the queue becomes full. A global state machine keeps track of the current network state, triggering reconnection attempts with exponential backoff on disconnection. Messages that fail to send due to the network disconnecting are re-queued in no particular order, and as a result the ordering of messages is not guarenteed (but can be reassembled using the message timestamp).

This project is a collaboration between Melanie Gutzmann (dashboard + api) and Noah Koontz (api + IoT data collection).

Pixel Tracker