Wifi Water Leak Detector

Sure I did, not that kind of noob :grin:
I’ve tried to replace the capacitor for a new one - same issue.
Tried a smaller one - same issue.
So I think we are on to the issue but I have 0 clue how to resolve it :worried:

Take a close up photo of your breadboard.

tried to get as close as i can, its the same as the sketch you’ve fixed…


BTW, I’ve tried to short the two wires that connects to the probe to see what happens - it behaves exactly the same so I guess it’s not the probe.
Sometimes touching it again will detect low, but randomly, sometimes even touching one of the wires (which is really weird).

Your circuit looks ok. Though for a high impedance circuit like this you really should keep the wires as short as possible to prevent picking up noise. Anyway, assuming you don’t live next door to an AM broadcast station…

I only tested this on an ESP32, you are using an ESP8266. So we may have to adjust the resistor value to one that works.

The good news is that it is detecting water. We just need it to reset. To do that we need to incrementally reduce the resistor value from 3.9M Ohms down to some other value.

If you go too low the probe will stop detecting water.

If you are too high it won’t reset.

We have a starting point of 3.9M, reduce that in half to 2M. Does it still detect water? If so reduce the resistor by half again to 1M. Does it still detect water…? Keep doing this halving of the previous resistance until it does not detect water. Do not go to 0 Ohms. Then step up by a 1/4 of the previous value. So if it worked at 1M but did not detect water at 500K Go to 750K. Find the point where it just detects water. Does it reset when you remove water from the probe tips? Try increasing the resistance a bit more, does it still reset?

Find a point where it reliably detects water and resets. That is how I did it originally and found 3.9M worked well for my ESP32 boards.

1 Like

Well… stepped it down one at a time, way down to 100K Ohms resistor…

OH BOY!

So anyone that want to do it with a D1 mini or I guess any other esp8266 based board that isn’t very fancy, as far as I can tell, should use a ~100K resistor

Thank you so much for your dedication to help others and give so much of your time, it’s very much appreciated!

** I will solder the components onto a demo pcb and will print a 3d case for it, I will post here the results :wink:

1 Like

I’m really surprised there is such a difference between the ESP32 and ESP8266 I/O. Great that you got it working though :+1:

tom_I, thank you for sharing this project and being so responsive with help. I’m entirely new to stuff like this, so forgive me if this post isn’t helpful, but is there any reason not to just stick two bare wires into a sponge for the sensor? I have two like that right now on my ESP32 that seem to be working fine. I was unable to detect water using stainless steel probes (maybe my config is wrong) so that’s why I’m using this method instead.

Here is my config:

esp32_touch:
  iir_filter: 10ms

binary_sensor:
  - platform: status
    name: "Kitchen Sink Sensor Status"
  - platform: gpio
    pin:
      number: GPIO27
      mode: INPUT_PULLUP
      inverted: True
    name: "Water Bowl"
    id: water_bowl
  - platform: gpio
    pin:
      number: GPIO32
      mode: INPUT_PULLUP
      inverted: True
    name: "Kitchen Sink Leak"
    id: kitchen_sink_leak
  - platform: gpio
    pin:
      number: GPIO33
      mode: INPUT_PULLUP
      inverted: True
    name: "Dishwasher Leak"
    id: dishwasher_leak

I originally wanted to detect when the dog’s water bowl got below a certain level using the stainless steel probes. Since that didn’t work I was able to instead use a reed float switch I’ll include the link for if anyone else is interested. The kitchen sink and dishwasher leak sensors were just a bonus since I already had an ESP32 in the same area.
https://www.amazon.com/gp/product/B07PZBK5T9/ref=ppx_yo_dt_b_asin_title_o08_s01?ie=UTF8&psc=1

Minus the sponge that’s exactly what I am doing. Using the touch sensor instead of just relying on water to short the probes should be a bit more sensitive for pure water. Using dosed town water or well water with dissolved solids should work either way.

Did you watch the values reported in the logger and set an appropriate threshold for the touch sensors?

Also for more than one touch sensor you need to remove this:

  iir_filter: 10ms

Sorry, I’m not exactly sure what you mean by setting the threshold for the touch sensors or the values reported in the logger. The ESPHome logs only show whether the sensor state was ON or OFF.

Maybe I’m not configuring them properly as touch sensors? Because I have three of them on the same ESP32 board that are working without removing the iir_filter: 10ms line.

And thanks for the incredibly quick reply!

1 Like

I’ve played around a little and found out that the analog pin can be used too :slight_smile:
So here is what I’ve ended up doing:

Thank’s for all the help @tom_l!

Nice write up, thank’s a lot for this!

Just build a leak detector based on a d1 mini and I’m having trouble to detect water. Using a 100k resistor like mentioned let’s the probes react on metal but no luck for me with tap water :potable_water:.

Guess I now need to increase the resistor value again till I can detect water - is that right @tom_l?

Thanks so much for this. I built one and installed it in the basement, by the bulkhead door, where we have had leaks in the past. It works great!

1 Like

I had this same question about logging the threshold and found this info on ESPHome.

Did any of you guys tried to do this with a leakage sensor rope like this one?
https://a.aliexpress.com/_mPIozBi

a good idea, but the picture showsthey have used insulated wire for the sence pair? how would water conduct ?
looking at other sellers it might be the yellow absorbs water and shorts the internal coductors.

To be honest I have no idea, it is used with other products like this https://a.aliexpress.com/_mq1bPwo

I have a big area to cover and using just one cable like in the initial post doest really help that much

ive just gone and ordered a meter to see what its like.

Cool! Let us know if it works please!

the tracking is saying its in my country so should be with me soon