Seeing flood last year in my area, there was nothing to inform citizens about detailed flooding, just global informations. We need cheap, autonomous devices that can collect regular mesures and send alert in case of level alert ou quick variations.Hardware
The device should made regular mesures to follow the level variations and send alerts when a maximum level is reach ou when the level grow fast.
The device should consum the minimum power in order to work just with 2 AA batteries for days or months. An option is to switch to accumulators and a solar panel.
So I need to reduce the current consomtion and control it espacialy the 5V@100 mA US telemeter sensor. So I use a transistor to start/stop its activity. Another solution would be a FET/MOSFET to reduce the voltage lost (0.6V) ; the better would be to use a Boost converter (3v -> 5v) with an Enable pin (should exists but I don't have some).
Note the sensor is only 40cm to 4meters ; it's easy to replace with a more "professional" one, mesuring up to 10m.Firmware
Coming from regular Arduino (ATmega) I do not know everything about SAM21 familly, so I do not succed in using internal RTC as far as I would. Especialy, I would like to find a way to get interrupts every n secondes, and run in deep sleep in between.
So for now, the firmware start to setup all parts :
- inputs & outputs ;
- SigFox component ;
The RTC is setup by sending a request using SigFox and waiting to the epoch (seconds since Jan 1st 1970) as a respond (this action is not done in debug mode to spare the 4 responses available by day).
Then the code loop every seconds doing the following :
- get a distance mesure (not null) ;
- compute normal value & gradient for about 11 successives measurements ;
If time is a quater of an hour, using SigFox, the system sends a full set of actual measurements and computed values in a integer format as a binary sequence.SigFox Backend
SigFox backend is setup just for callback. Each callback should send (back) an PUT http request to my own WebAPI which simply collect all requests and parameters (headers, body) to a sqlite db.