Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Add an interface for a flow meter
#1
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-Wat...p-635.html hooked into my raspberry pi.

I am using wiringpi like the code posted here https://www.raspberrypi.org/forums/viewt...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
Reply
#2
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...asheet.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...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
    GPIO.wait_for_edge(mygpiopin, GPIO.RISING)
You could increment a counter variable, then if you check the value of the counter once a sec. you would have the Hz. Be sure to clear the counter after checking. Divide the Hz by 8.2 to get the L/min

It should be easy to put this into a plugin for SIP.

Dan
Reply
#3
(2016 Jan 24, 07:18 PM)dan Wrote: It should be easy to put this into a plugin for SIP.

Dan

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
Reply
#4
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
Reply
#5
(2016 Jan 25, 12:58 AM)dan Wrote: 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

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.
Reply
#6
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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)