Add an interface for a flow meter - Printable Version +- SIP (https://nosack.com/sipforum) +-- Forum: SIP (Sustainable Irrigation Platform) (https://nosack.com/sipforum/forumdisplay.php?fid=1) +--- Forum: Feature requests (https://nosack.com/sipforum/forumdisplay.php?fid=4) +--- Thread: Add an interface for a flow meter (/showthread.php?tid=23) |
Add an interface for a flow meter - mattip - 2016 Jan 23 Not really sure if this is a feature request or a plugin suggestion, sorry if I mispost. I created a github issue https://github.com/Dan-in-CA/SIP/issues/143 to add flow metering into SIP: "Thanks for this wonderful application. I have a Seed Studio flow meter http://www.seeedstudio.com/depot/G12-Water-Flow-Sensor-p-635.html hooked into my raspberry pi. I am using wiringpi like the code posted here https://www.raspberrypi.org/forums/viewtopic.php?f=37&t=94656 to set up an interrupt handler and increment a counter. I see how I can write this as a so and read the counter from Python. I would like to get feedback in SIP about overall flow rate and expected vs actual flow rate (to detect leaks). What would be a strategy to get this into SIP? I see the way the clock time is updated, should I hook into that and update another div under it? Note that I have not calibrated the flow meter, from some preliminary tests it seems the meter peaks out at about 100 pulses per second, so this might not be an accurate way to measure water quantity rather a qualitative go-no go check of the system, an arduino and maybe a better meter may be needed to get accurate measurements, but that is a different issue." In response, someone suggested using the functions 'callback' and 'tally' from the pigpio interface library instead of a c-function Any other thoughts? Matti RE: Add an interface for a flow meter - dan - 2016 Jan 24 Looking at the data sheet for the flow sensor you mentioned in your GitHub post, It looks like the maximum flow rate for the sensors is 30L/min and the pulse output of the sensor is about 8.2 Hz/L/min. This would indicate a maximum pulse rate of 246 Hz. Data sheet: http://www.seeedstudio.com/wiki/images/b/b7/Water_flow_sensor_datasheet.pdf You could use the standard RPi.GPIO library that now comes pre-installed with the Raspbian OS for the Pi. Here is a project on GitHub that implements a Python pulse counter: https://github.com/sanderjo/GPIO-counter/blob/master/gpio-counter.py Actually the only thing you need to do is count the rising edge of the pulses like so: Code: # wait for pin going up It should be easy to put this into a plugin for SIP. Dan RE: Add an interface for a flow meter - mattip - 2016 Jan 24 (2016 Jan 24, 07:18 PM)dan Wrote: It should be easy to put this into a plugin for SIP. Thanks for the info about the flow meter. I looked at the other plugins, but I am looking for a way to add a "current flow" field under the "status" div on the panel, and I do not see how the plugin architecture would allow me to modify the existing do that. It seems I would need to modify templates/home.html directly. Any suggestions? Matti RE: Add an interface for a flow meter - dan - 2016 Jan 25 There is quite a bit of space for adding a display field. Give it a try. Let us know what you come up with or if you have more questions. Dan RE: Add an interface for a flow meter - kozoroh - 2018 Jul 03 (2016 Jan 25, 12:58 AM)dan Wrote: There is quite a bit of space for adding a display field. Give it a try. I'm thinking about implementing flow plugin. Sometimes it is better to control irrigation by amount of water than time to open valves. Just to start, I would like to simple show current flow on the homepage like user Mattip suggested in the previous message. I think, you didn't answer his question, Dan. Of course, there is some space for adding a display field. The question is: is it possible to add this field directly from plugin? Or shoud we firstly edit home.html or base.html files in the templates. RE: Add an interface for a flow meter - dan - 2018 Jul 03 Some time ago I thought of a way to add elements to the home page from a plugin. Unfortunately I didn't make any notes and I will need to try and figure it out again. Modifying the existing SIP display is an option but I would prefer to have plugins be able to make changes to it. A flow plugin has been on the to-do list for quite a while. There has been some discussion about it on the SIP GitHub repo. You might find this helpful: https://github.com/Dan-in-CA/SIP/issues/143 I have more recently made some Arduino code to read a flow meter. It uses the Arduino frequency library: https://www.pjrc.com/teensy/td_libs_FreqMeasure.html This does not use interrupts to count pulses but measures the frequency of the pulses directly. The idea is that the flow meter is connected to an arduino and the arduino sends the flow data to the Raspi and SIP. I have been thinking of using a 24V AC to 12V DC power converter to run the arduino which would be near the valve(s) and could use the same power source that runs the valves. The Arduino could be connected to the Raspi via serial cable or wifi. Dan |