WaterFlow Help

Hello All -

I tried this question/topic on the MySensors forum but I think my lack of ability to clearly explain my issue is falling short so I’ll try here.

While I am fairly confident in my electronics background (a bit rusty but this is simple stuff), my C++ skills are a decade++ :slight_smile: old. I have zero Arduino experience.

What I’d Like to Do

[ol][li]Monitor water flow on my home’s “main” water supply[/li]
[li]Using Vera/PLEG, alert when water is running but shouldn’t be. (sprinklers off, etc) I will be sure to account for icemakers, humidifiers, etc[/li]
[li]Send an email and perhaps shut off an inline valve[/li]
[li] Use the following sensor: [url=http://www.seeedstudio.com/wiki/G1%22_Water_Flow_Sensor]http://www.seeedstudio.com/wiki/G1"_Water_Flow_Sensor[/url] in place of the light counter suggested by MySensor’s page at [url=http://www.mysensors.org/build/pulse_water]http://www.mysensors.org/build/pulse_water[/url] but hopefully use the same sketch due to my lack of Arduino coding knowledge.[/li]
[li]Use Hek’s wonderful work and Arduino to accomplish the above[/li][/ol]

Where I’m Currently At

[ol][li]Arduino IDE up and running[/li]
[li]Gateway/Radio Comms established using temp sensors as a test (among other radio tools along the way to troubleshoot)[/li]
[li]Now running the WaterMeterPluseSensor.ino and sucessfully added this to Vera[/li]
[li]Above sensor and ball valve are already plumbed (no leaks!) and working fine[/li]
[li]To bench test, I’m using a function generator on PIN 3 running at 10Hz (measured by a scope to be sure). According to the above link, this should give me around 48 L/min[/li]
[li]However, my current volumes reported via the sketch (and displayed in Vera) are around 21 L/min[/li][/ol]

I modified the WaterMeterPulseSensor.ino (found at the above link) to use a pulse factor of 4800. According to the spec sheet (link above) each liter should be 4.8Hz so when I look at the sketch, I see the following line:

double ppl = ((double)PULSE_FACTOR)/1000; // Pulses per liter

So that means, 4800/1000=4.8 Good, right?

I also modified the sketch to have a max flow of 400 because my count rate will be much higher than a meter’s wheel spinning.

Obviously, this sketch was never intended to read an interrupt this quick and I’m wondering if that’s where my problem is.

Can someone check my math/assumptions to see where I may be going wrong?

Hi tbully - so compared to your post here:Water Flow Sensor | MySensors Forum
it looks like you are now seeing both values? but your not sure if the values are correct??

If so…perhaps ask your question here which is topic on this sensor.

  • But do please report back here and MySensors your findings :wink:

Hi GregL. Yes, it was a simple problem. There is a MAX FLOW parameter that I was going past (by a long shot). I think that is used that to make sure there was no “extra” pulses figured in. I can probably remove this logic as I assume the pulse-train coming from the sensor is probably more reliable than the light sensor.

This sketch is designed to look at a spinning wheel with each revolution being a pulse. I’m sending 10 pulses per second! haha

I thought about hitting that thread up. Their example basically enables the interrupt, waits a determinant amount of time (1 second), and then disables the interrupt. They then calculate how many pulses occurred during that second and then they derive flow from that.

I may end up using that logic but I was really hoping to reuse what we already had to keep things simple for future users.

I will followup on the MySensors thread with my latest status as to not leave it hanging. Assuming nobody else jumps in to help (and I figure this out on my own - unlikely! haha), I will make sure to document what I’ve done for future people.

I so wish I could be more helpful :frowning: This is pretty cool and may convince me to go Arduino.

Thanks @Agile. You’ve been more than enough help for me in other threads along the way.

I have a feeling I’m going to have to buck-up and really learn the language. (and/or hit the Arduino forums) The good news is the hard work has already been done by Hex & Co. (radio comms, Vera integration, etc)

I already have a few temp sensors around (even in my freezer in the garage!). Very inexpensive, reliable and generally easy to implement.

Warning! Once you go Arduino there’s not turning back… You will start looking for things to control… Very Addictive! :stuck_out_tongue:

I thought I’d drop a follow-up (and question here)…I also left one at MySensors.

I was FINALLY able to back in to the correct formula and PULSE_FACTOR to get accurate data displayed!

Now I’m trying to combine this Arduino node to do both the pulse counting AND control a relay. What I’m finding is that I’m getting very poor response/performance from controlling the relay. Sometimes I have to click on the ON (or OFF) button successively multiple times to get it to react. I’ve also noticed that while I’m clicking (and the relay is not responding) that the gateway is giving a red error light for each click.

The performance is even worse if I’m running the serial monitor on the sensor side. As you can see from my sketch, I even tried to disable interrupts during the message get thinking that maybe I’m falling in to the onPulse routine too often due to the high frequency on the PIN.

I could always go to another Arduino to run the relay but it seems like a waste. (By the way, I did test with an additional Arduino and it works flawlessly so I doubt it’s the gateway.)

Thoughts?

The issue with the “hang” was improper supply of power, I guess.

Out of frustration, I moved from USB powered (because I was coding / troubleshooting) to an external source. All is better.

I suppose the radio may have been interfered with when switching the relay or something.

I’ll soon be packaging this and hooking it up to my plumbing.

Stay tuned.

[quote=“tbully, post:9, topic:182596”]The issue with the “hang” was improper supply of power, I guess.

Out of frustration, I moved from USB powered (because I was coding / troubleshooting) to an external source. All is better.

I suppose the radio may have been interfered with when switching the relay or something.

I’ll soon be packaging this and hooking it up to my plumbing.

Stay tuned.[/quote]
Thinking of implementing something like you have done. How is your setup functioning after all the months? You mentioned the relay, was that for controlling the valve?
Cheers

[quote=“Zooz, post:10, topic:182596”][quote=“tbully, post:9, topic:182596”]The issue with the “hang” was improper supply of power, I guess.

Out of frustration, I moved from USB powered (because I was coding / troubleshooting) to an external source. All is better.

I suppose the radio may have been interfered with when switching the relay or something.

I’ll soon be packaging this and hooking it up to my plumbing.

Stay tuned.[/quote]
Thinking of implementing something like you have done. How is your setup functioning after all the months? You mentioned the relay, was that for controlling the valve?
Cheers[/quote]

Hey Zooz!

Happy to help you. Everything runs great. In fact, it saved me from a nasty flood when my washer freaked out when on vacation. (long story short - a water solenoid decided to open, filling the bin, and overflowing) I was able to detect the unexpected water-flow and close the main valve. I may automate that closure now that I’m more comfortable with the logic.

One thing I wish my system would do better - detect low flow conditions. My meters (one for main and one for a sprinkler line) were purchased to be able to watch flow as high as the city could send it - upwards of 10GPM. Unfortunately, the chosen meters lose resolution and flat out do not send pulses for lower flows. This could be a problem if (say) a humidifier gets stuck on, etc.

Two problems: 1) I haven’t found better meters. 2) I’d have to re-plumb everything. (Not that I’m totally afraid of doing that if I find the right flow sensors. I did use several unions to make the job easier if it comes to that.)

You are correct on the relay question. I have two Arduinos running. Each monitors a meter/sensor and controls a relay which in-turn controls a motorized valve. I’ve learned a bit since then and think I could actually do all four with one Arduino.