Using ESPhome to build a water flow rate meter -J-Pipe github version

Hey there,

There is another interesting thread on the subject, but I did not want for all this new info to get lost in there considering it is another approach. You can find the thread here: https://community.home-assistant.io/t/using-esphome-to-build-a-water-flow-rate-meter/

A HA member created a project that he thankfully shared on github here: Whole House Water Monitoring

I am using an YF-S Water Flow Sensor. And personally I am stuck because of 2 facts:

1. I am interested in the amount of water (in Liters) that must flow for the water sensor to send one pulse.

It has a flow pulse of 2L/MIN=16HZ or 4L/MIN=32.5HZ or 6L/MIN=49.3HZ. It says it has the following pulse characteristic F = 7Q (l/min) +/- 5%. Info from here: https://www.hobbytronics.co.uk/datash.../sensors/YF-S201.pdf

Also considering my quest, is it right to take this formula 2L/MIN=16HZ and based on this to consider the following? We have 16 Hz which means 16 pulses/min and we multiply that to 60 secs => 960 pulses in 1 minute. Considering that in 1 minute we get 2 liters and we have 960 pulses in 1 minute then we divide 2 liters into 960 pulses to get 0.00208 liters per pulse.
Does this make sense to you? Do you think it is right?

Also I am still trying to understand how water flow works, but it seems that USAGE_PER_PULSE should be a variable and not a constant. I base my deduction on the fact that for example the sensor I use, YF-S201, has a different frequency based on the flow of water.

Here is a table:

Flow Range: 100L/H-/1800H-L/H
Flow (L/H) - Frezq.(Hz) 
120               16
240               32.5
360              49.3
480              65.5
600              82
720              90.2

I calculated for example that from the flow rate of 120 L/M to 720 L/M there is an 6 fold increase. While from 16Hz to 90.2Hz there is a 5.6375 fold increase.

If you understand these things better, would you be so kind to comment on this?

2. I am using the flow sensors in my house in the kitchen. And I have 2 water flow sensors for a single ESP for a cold water pipe and a hot water one. So I would need to integrate both on the same ESP. This is why I was asking for suggestions on how to integrate 2 water flow sensors onto 1 ESP as the code on github is only for one water flow sensor.

Let me know what you think.
Thank you so much for any advice.
ygreq

Not sure about the two flow sensors problem (feature request would be my recommendation) you can deal with the non-linearity in your sensor output using this very easily as you already have the lookup table: https://esphome.io/components/sensor/index.html#calibrate-linear

Uuu! Nice!

But do you think my observation makes sense? :slight_smile:

This might help:

https://www.electroschematics.com/working-with-water-flow-sensors-arduino/

That specs sheet is terrible…

I would start with just the formula they give, so…
Take the Frequency you read and divide it by 7 to get an initial flow rate (L/min).
This will give you your RAW uncompensated flow rate or usage.

Get a stop watch and a bucket (preferably in liter increments).
Secure all water usage in your household.
Turn on a faucet and let the flow stabilize.
Start stopwatch the instant you put the bucket (or mark a line in your bathtub) under the water source; stop stopwatch when bucket is at some whole increment of liters. Record your actual flow rate and the measured flow rate. It is extremely important that you don’t adjust the flow at all during any test run.
Repeat at various rates of flow to create yourself a compensation table.
Plot frequency vs flow rate to see if you can actually use a linear equation without compensation, if you can…great, if not pick the ‘bands’ you need to compensate for using if … else if … and else statements.