Water Sensor not stable

I am trying to get a simple water sensor to work. I am using a wt32-eth01 along with a FS-IR02 water sensor.

This is the sensor: Water Sensor

I have it wired like this, along with a simple voltage divider to drop the 5v output to 3v.

image

and here is the YAML:


sensor:
  - platform: adc
    pin: GPIO2
    name: "Water Level Sensor"
    update_interval: 30s

It all seems to work okay and responds quickly when measuring the output on a meter. However, in HA it triggers okay, but takes a while to settle (the voltage bounces around). That would be okay, but it also randomly triggers as well. Again, it all seems fine when measuring the output directly.

You might want to include a filter

EDIT: fixed link to go to sensor instead of binary sensor

Your meter is likely not fast enough to capture the rapid changes.

The total value for this resistive divider should be at least 10x R2 (preferably more like 100x). Or your divider in parallel with R2 will affect the value of R2.

I doubt that is the cause of your issue though.

Interesting, I did not think of that. So maybe an average filter might tame it a bit? Any other ideas?

You can confirm it by looking at your ESP serial logs. Are the ADC readings varying?

Dave’s suggestion of a filter is the easiest.

How much is the output varying by in HA?

Could this just be due to ripples/waves on the surface of the liquid?

I just realised I linked the wrong section of ESPhome docs, fixed now.

The ADC readings vary more than I expected. I assumed they would remain stable when the probe is dry and out of water. What type of filter do you suggest?

How much?

Could this be due to interference from external light sources?

There is a warning about that in the datasheet.

Complete noob error. I was powering the water sensor from a separate power supply for testing. As soon as I powered everything from the same source, it behaved as I thought it would.

1 Like

You can use seperate power supplies as long as the grounds are connected.