OpenSprinkler Forums OpenSprinkler Unified Firmware Flow Sensor Working Reply To: Flow Sensor Working



I have implemented flow rate sensing and logging.  The basic algorithm is the following:

ISR to run on rising edge of flow sensor (ran it into the rain sensor input).

Right when the valve is turned on, the time is captured.  After 90 seconds, the first rising edge time is captured in msec.  once the valve turns off, the last rising edge time is subtracted from the first rising edge (after the 90 seconds) and this is divided by the # of pulses between the two edges (minus 1) for the # of gallons (mine is 1 pulse = 1 gallon).  Averaging across the time works best and gives extremely accurate flow rates, and removing the first 90 seconds or so is very beneficial due to the large flow rate right as the valve is turned on (if the pipes are empty).

The latest code modifications are storing the information to the SDHC card in a new directory and file, and I’ve modified the server.cpp to handle sending out the global variables as well as sending out the log data from the SDHC card (SDHC card logfile output still debugging).

The logfile I plan on storing the following:

valve #, start time, total flow time,  total # gallons this valve, flow rate (gpm)

I have researched how to send email and so far haven’t found an example that I could dive right into yet for the OS, but ideally, if a leak is detected or too low of flow rate is detected, an alert would be sent out.  If that isn’t too easy I’ll write a script on my droid phone to check it daily and alert me that way by pulling the logs.  Detecting flow rates when the valves are off is also beneficial for detecting if a leak or other item is running.

If this information would be added to the existing logfiles that would be ideal, I’d rather not implement something that will remain custom and not be part of the standard.  Ray any suggestions on how you would like to implement it in the future, and how can I help?

The meter you suggest Munnecke looks neat, similar to my netafim one but lower in cost.  Looks like the sensor for the GPM pulse is very similar too , just a magnet/reed switch.