A group of friends started a non-profit website called www.myriver.co.za, which gives turn-by-turn instructions to kayakers on how to navigate our local rivers.
Increasingly we have been inundated with requests to know river levels so that the kayakers can go out and train at the correct river level.
We decided to build our own river level monitoring system that measures the height of the water in the river by pinging a laser beam off its surface.
We set out to build something that could accurately, regularly, and reliably report the water level in the rivers at remote locations. Because some of the rivers are 3 hours drive away, it needs to work unattended, on its own, for months at a time, waking up to take readings, send them to the cloud, going back to sleep and charging its batteries with available sunlight.
The system logs to the cloud and plots the river level with cm accuracy.
There is no power or wifi in the areas we are visiting so we need to rely on solar power and (poor) cellular connectivity.
We would also need to remotely monitor the device to see what it was "thinking" and how much battery power was left.
We tested 5 laser range finders and settled on the Lidar-Lite as a good compromise between reliability and price.
We purchased a few Particle Electrons and were impressed by their ease of use, affordability, and reliability.
We purchased a few solar panels and settled on a 3W 6V panel.
We started developing code in Particle Build:
And we tested and tested and tested and changed things and re-worked the code and started again and tested again and again.
Because we only need to take readings a few times per day, we put everything to sleep until its time to take a reading. Fortunately Particle lets you do this with one line of code. We decided to sleep longer when the battery is depleted (night, cloudy days) and sleep shorter when more power is available, so we put in a voltage divider circuit and measured analog-in on the Electron to convert it to a supply battery reading. (we tried an i2c power meter but it was unreliable).
We soon realised that we would need a way to keep the Electron awake in case we wanted to send new firmware or take a bunch of readings in succession. The problem with the Particle cloud is that you can only send a message to an Electron that is currently awake, since we didn't know how when the Electron would wake up, we couldnt hang aroung for that so we use Ubidots which allows us to flick a switch on the website, when the device next wakes up, it checks the website to see if we want it to stay awake and then waits for our command, or new firmware.
While we were at it we decided to also put in an option where we can control the length of time it sleeps, over-riding its autonomous decision based on "power supply" level:
So we added the control in Ubidots and read it in our "fn_getCloudvalue" Particle.
We included an OLED display to show us the readings we are getting and the supply and battery voltage. this is useful for testing and setup. It doesnt draw much current so we will probably leave it in when installing.
When the Electron wakes up, it starts taking readings from the lidar. we take 100 readings at 20 readings per second and send the average of the last 25 to the cloud. the dsplay shows the average in large font (221cm) and the number of readings taken so far ("53").
We monitor the input voltage, and if its not within range of what the Lidar needs, then we dont turn on the mosfet, dont power up the lidar and dont bother taking readings., we keep trying for 20 seconds and then give up and go to sleep until the sun comes up and charges the battery.
The Electron hadles a wide voltage range of inputs and effortlessly charges its own lipo battery used for its cellular comms. The Electron happily provides 3.3v.
A challenge was getting a stable 5V supply to the lidar which is a bit sensitive to its voltage input range. We tried many options and eventually settled on a separate LiPo battery with a solar charger circuit which also has a boost regulator to supply 5V from the 3.7V lipo.
Ubidots is our commercial platform for logging the data and we hope to sell this to subscribers in the kayak community, but we also used Particle variables and Web Hooks to log the data to thingspeak. The plan is to provide the data for free to emergency responders and environmental organisations to be able to respond quickly to flash floods. DUCT is an environmental organisation in our area that can quickly deploy floating booms to collect debris washed down the river from storm water drains which prevents it from going out to sea, the problem is that they don't always know which rivers are in flood.
Comments