Water Flow Sensor

  • Hello All -

    One of my first "MySensors" projects will be a water flow sensor to detect water usage when not expected. I will be using Vera for my logic/controller. Example:

    • On vacation
    • Water flowing for more than 5 minutes and sprinklers not on (account for ice maker,etc)
    • Assume broken pipe / stuck toilet - turn off water and send an alert

    Something like that...... you get the picture.

    I have tested the following sensor/sketch on the bench and it works great:

    I would like to incorporate a MySensor in to Vera but I do not see a pre-built MySensor Sketch that does what I want.

    I thought about perhaps using the existing Water Flow sketch (http://www.mysensors.org/build/pulse_water) and putting the logic from seeedstudio but I'm not sure I'm competent enough to do this.

    Does anyone have an ideas for this newb?


  • Hero Member


    From the water pulse, I have the water flow on a secondary counter with a reed diod.

    Here is an example of what I have on one dat:


  • Thanks for the response but I'm not sure I follow. Can you elaborate?

  • Hero Member

    This post is deleted!

  • Hero Member

    @tbully the WaterMeter sketch if you don't activate the sleep method, will report usage and flow. The above graph is in m3; so 0.025 means 25L, you can see how precise it is.

    But if you only use usage, you will get, on a graphing software such as above, the hourly water use. This way you will know your sprinkler is on (here it is raining at the moment, but mine just use 200L when they work... so I can see it, a 6:30 am other watering turn on, I can see it... and since I see it by the liter, I can even know when I take a bath, flush toilets or just put 1L in a bottle.

    Also the sketch has a memory, if radio is perturbated, next time it can transmit, you'll have the exact counter value, maybe not the precise time.

    On your three points, you could do all of them with it.

    Regarding the flow sensor, it is not calibrated, meaning you won't know if this one liter or more, you'll just get a flow. If you inted to modify your water circuit, I recommend you use a counter with or without reed ( the line tracker does it too).

  • I see all of the Serial.print lines commented out in the example sketch. When I uncomment them, the data is not printed to the serial monitor. I'm not working in a Vera Environment at the moment (testing without it) and would like to see this data.

    Thanks again.

  • Hero Member

    @tbully put yourself at 115200 and iy will work

  • I'm happy to report that I have made some headway.

    Even though I set the following in the WaterMeterPulseSensor sketch:
    #define SLEEP_MODE false

    I still cannot see flow values in Vera.




  • As an update, I found my issue with missing flow data. My function generator was running at 10Hz (to simulate 48 L/min).

    I'm struggling to get this sensor (listed above) to work with this sketch. I was blowing by the MAX FLOW check in the sketch.

    If anyone has the time to check out the sensor I'm trying to use, It'd be great.

    Vktech G1 Meter

    I also have a tread going HERE that main contain more helpful data.

  • 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 thinking that maybe I'm falling in to the onPulse routine too often due to the high frequency on the PIN.



  • It may not make a difference but, have you tried moving your gw.messageAvailable() check to the top of the loop? I have a relay installed along with a distance sensor attached to my garage door. I get distance updates every 30 seconds when the door is stationary and when the door is moving, I send an update every half second. Having gw.messageAvailable() at the beginning of my loop() works the best in my environment. This assumes you are not fighting a reception or interference issue though.

  • This did cross my mind. Having it at the top shouldn't matter but - "why not!?".

    My gateway is currently only a few feet from my sensor so I don't think it's a reception issue.

    I will report back, of course. Thanks for the idea.

  • New status: I found that by using an external 5v power source for the sensor (instead of plugging it in to the USB port), yields perfect results. I'm not sure why it'd matter. My guess is it was interfering with the radio's operation when running the relay. I'm going to add a filter tonight to see if it helps - just for education purposes. However, it won't be powered by a PC in production anyway.........

  • Hero Member

    Nice find... Seems like there are more and more power related issues popping up lately..

Log in to reply

Suggested Topics