Water flow meter on ESP32 stuck. Reports constant flow. Help troubleshooting

Hey everyone,

I have this OEM water flow sensor hooked up on an ESP32 chip flashed with ESPhome.

Since yesterday, after my morning irrigation routine, it started constantly reporting pulses.

I checked if the flow was true by turning off the main vane, and the reading didn’t change, so we’re safe on that matter.

I visited the sensor and gave it a few taps, hoping it would come back to normal with no luck.

Rebooted the ESP chip a dozen times (both SW reboot and disconnected power), no luck, goes back to 3k pulses / minute.

Disconnected the sensor from the chip and the reading goes to zero, reconnected and goes back to 3000 pulses / minute.

Is there anything else I could try? Or is the sensor fried and we definitely need a new one?

Please let me know if I can provide any additional information.

Kind regards,

K.

Here’s a picture of my ESPhome web ui, constantly reporting 3k pulses/m:

I see that it requires at least 5V, and outputs 4.7V minimum pulses. Are you using a voltage divider so that you are not putting more than 3.3V into the GPIO?

If not, you may have damaged the Input.

1 Like

Hmm… No, I’m not using any voltage divider.
I’ll plug it in another pin and reflash the esp.

If that’s the case, could you point me to some guide to figure out how to build the divider?

Alternatively I can use one of these right?

Also if that’s the case, would the pin be damaged instantly or over a period of time? Because I ve been using it around 6 months now.

Go to this page:https://ohmslawcalculator.com/voltage-divider-calculator

Enter the following:

Voltage Source (VS): 5 V
Resistance 1 (R1): 1 kohms (use the drop down list)
Resistance 2 (R2) 1.8 kohms

Press the calculate button to calculate the output voltage. (3.2V) This is your worst case high logic 1

Now drop the voltage source to 4.7V and calculate again. (3.0V) This is your worst case low logic 1 output

We’ll assume that the logic 0 is going to be so close to 0 that there is no need to check that (it will be lower that what was already working with no divider).

Thus with the resistors connected as shown in the accompanying picture, where the source voltage is your sensor and the output voltage is connected to your GPIO, you have converted a 5V signal to one that is compatible with 3.3V logic.

There’s a bit of finesse to it.

  1. You have to look up the actual values of resistors that exist (search for an E24 series table) . If you ever need an odd non-existent value you can use series / parallel combinations (look for another calculator) but in this case we are ok with commonly available values.

  2. We must size the series resistance of the two resistors (R1+R2, 1+1.8 = 2.8KOhm) so that they don’t draw too much current from your sensor. I think I saw it could supply 10mA.

5V / 2.8K = 1.7mA (assuming that the GPIO contributes very little load, which it does). So all ok there.

We also have to check that 1.7mA is enough to supply the GPIO (it is). Making both resistors 10x larger would still work but would be more susceptible to induced noise as you would only have a 170uA signal.

1 Like

Wow thanks for this precise information. I’m always a little confused with voltage dividers but I think you cleared stuff out just fine.

Will check it out and let you know :slight_smile:

Thanks again

I went and checked my connections.
Turns out I was operating the pulse sensor with the 3.3v pin as power.

So I guess frying the input pin is not a possibility, could it be that I damaged the flow sensor by operating it on 3.3v instead of 5?

I also changed the GPIO from 23 to 22. Still getting constant readings.
Ill order new flow sensors :smiley:

Unlikely, but it is not guaranteed to work correctly on less than 5V.