Azure Sphere Plant Monitor (Sprout)
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:
- Temperature data compared with humidity data over one day:
- Soil moisture data over one day from both sensors:
- Soil moisture data reacting to the plant being watered:
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).