Walter Leak Detector

A couple years ago, water leaked through my hot water tank in the basement. Fortunately I discovered it early thereby avoided some costly water damages. Since that incident, I have been considering investing in a water leak detector. Rather than purchasing one, I hacked together a water detector with a Node-MCU board and some old parts.

This project builds upon my post “Integrating ESP8266/ESP32 Micro-controller“. The Node-MCU’s wireless capability is ideal for this task since I do not have a wired Ethernet connection near my hot water tank. It allows me to place the unit close to the water tank and transmits its reading to my Home Assistant hub wirelessly.

Hardware Design

The hardware design of the water detector uses two Node-MCU digital pins. One pin is configured as a binary sensor, and the other as a switch driving a 3V active buzzer. In the picture below, the buzzer is connected to pin D1. Pin D2 is connected to the water sensor board via a 3.5mm jack.

The Node-MCU board is housed inside a small project box so that it could glued to a USB power supply as a single unit

The water sensor is made up of a small piece of strip PCB board. Pair of alternate traces are wired in parallel. The sensor board is then connected to a length of wire to the 3.5mm jack.

Finished product

ESPHome Configuration

In the Home Assistant ESPHome Dashboard, create a Node-MCU device as described in “Integrating ESP8266/ESP32 Micro-controller” and flash the device with the following yaml configuration (replace “wifi-ssid”, “wifi-passord” and “manual_ip” addresses accordingly):

esphome:
  name: water_detector
  platform: ESP8266
  board: nodemcuv2

wifi:
  ssid: "wifi-ssid"
  password: "wifi-password"
  manual_ip:
    static_ip: 192.168.1.26
    gateway: 192.168.1.1
    subnet: 255.255.255.0
    dns1: 192.168.1.1

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:
   
switch:
  - platform: gpio
    pin: D1
    id: 'water_leak_alarm'
    name: 'Water Leak Alarm'

binary_sensor:
  - platform: gpio
    pin:
      number: D2
      mode: INPUT_PULLUP
      inverted: True
    name: 'Water Leak Sensor'
    on_press:
      then:
        - switch.turn_on: water_leak_alarm
    on_release:
      then:
        - switch.turn_off: water_leak_alarm

After flashing, add the device to Home Assistant from “Configuration” -> “Integration”. The binary sensor “Water Leak Sensor” and switch “Water Leak Alarm” should show up as new entities. This device will now sound the buzzer when water are detected across traces of the PCB sensor board.

2 thoughts on “Walter Leak Detector

  1. Have you tested this with water? I’m curious because I had a similar idea, but I wanted an alert when the dog water bowl is empty. I tried with two wires. My thinking was the water would make a connection like a switch. Unfortunately that didn’t work out.

    Would you share a close up of the modified part of the protoboard? If it works for you I’d like to recreate it.

    Like

    1. Hi Brian, the protoboard worked well for me, I was actually surprised by how sensitive it is in detecting water.
      Make sure you use silver plated type. Cooper plated board and wires do not work well and they suffer from oxidation.
      I did not do anything special to the protoboard except to wire adjacent traces in parallel to increase the water detection area.

      Like

Leave a comment