Device Firmware

Power Optimization

Much like the sensor’s electronics, the main goal is to limit on-time and power consumption to extend the battery’s lifetime. The Particle Electron was chosen, in part, for its on-board RTC that stays powered during the device deep sleep. The device stays in this sleep state for the time between measurements (usually 1 hour). The device turns on for as short a time as possible when it does turn on (usually 15 sec).

A single event in which the device does not sleep properly or wakes repeatedly could completely destroy the battery life. The firmware uses a software timer to make sure that the device turns off regardless of a measurement if 3 minutes have expired.

To reduce on-time, the device uses the multi-threading capability of the Electron to establish a cloud connection while taking sensor readings.

Live Configuration and OTA Updates

As weather situations develop, measurements from the sensor may become more important. The device supports variable measurement rates meaning that, for example, in the event of a flash flood, the sensor could take measurements every 20 minutes rather than the typical 1 hour.

Additionally, the ability to update the device firmware without having to visit the sensor is very useful, especially in development.

Each time Aquametric wakes from its sleep, it connects to our server and checks the measurement frequency and the presence of an OTA update from our live config page. If there is an update for it, it lets our server know that it is ready to accept, and the server automatically flashes the device with the new code.


Adding additional sensor readings to the data output of the device is relatively easy. Create a method that returns the sensor you are interested in measuring. Add this method to the JSON string that the device assembles.


Currently Aquametric relies on the Particle Cloud to handle direct communication to the Electron. While it is possible to communicate directly to the server via HTTP requests, we have found using the Particle Cloud to be more reliable for the time being.