Skip to the content
2 layers70 × 70 mmWater Cutoff, the printed circuit board in 3D

Water sensor and cutoff for HomeAssistant using an ESP32 DevKitC board

Size
70 × 70 mm
Copper layers
2
Thickness
1.6 mm
Parts
38
Nets
47
Pads
130
Tracks, vias
178, 21
Pours
2
Routed
Yes
KiCad
KiCad 10.0 (file 20260206)
Created
21 Jul 2026
Updated
21 Jul 2026

Overview

Water Cutoff is an open-source printed circuit board by cyberknet, from the cyberknet/water-sensor-cutoff repository on GitHub. It is a 2-layer board of 70 × 70 mm with 38 parts on 47 nets, routed with 178 tracks and 21 vias.

It is built around the XL1509-5.0E1, AO3400A and DS1023-1X15SF11, with the SS34, 1N4148W and 2541WV-06P among its other parts. Its parts include 13 resistors, 5 diodes, 5 connectors, 4 transistors and 3 capacitors. It belongs with the home automation and IoT and sensors and measurement boards of this library.

Main components

12

README

README.md

water-sensor-cutoff

A DIY leak-detection and shutoff controller. It watches a leak probe near a water source and automatically closes a motorized ball valve on the supply line if a leak is detected, integrates with Home Assistant via ESPHome, and can also be driven manually with a front-panel illuminated button.

How it works

  • A leak probe (simple 2-wire contact/conductivity sensor) sits near the base of a potential water source. If it detects water, the board closes the valve automatically.
  • A motorized ball valve actuator on the supply line does the actual shutoff. The board drives it via a relay and reads its built-in open/closed limit switches to know when travel is complete.
  • A front-panel illuminated pushbutton gives manual control and shows valve state at a glance (green = open, red = closed, blue = moving).
  • The board exposes everything to Home Assistant through ESPHome's native API, so the valve can also be triggered remotely or included in automations (e.g. combine with a separate flow/pressure sensor).

Hardware overview

Built around a socketed ESP32-WROOM-32 DevKitC-32 (30-pin dev board, plugs into female headers on the PCB — nothing is soldered directly to the main board, so the dev board can be swapped if it ever fails).

  • Power: 12V DC input via barrel jack, stepped down on-board to 5V with an XL1509-5.0E1 buck converter (chosen over a linear regulator after thermal analysis showed a linear regulator couldn't be adequately heatsunk on a board this size at realistic current draw).
  • Valve drive: a single SPDT relay (K1) selects motor direction; a low-side N-channel MOSFET (Q4) drives the relay coil from the ESP32. Note: with only one relay, the motor is always being driven in some direction — there's no hardware "off" state. This relies on the valve actuator's own internal limit switches to stop current draw at each end of travel. See the pinout/notes at the top of firmware/water-cutoff.yaml before adapting this for a different actuator.
  • Sensing: 2-wire leak probe input, plus open/closed limit switch inputs from the valve actuator (bundled into the same connector as the motor leads, matching the standard "5-wire" electric ball valve actuator wiring convention).
  • UI: RGB status LED + momentary pushbutton, both routed through low-side MOSFET switches for PWM-capable color mixing.
  • 2-layer, 70×70mm PCB.

Full connector-by-connector pinout (J3/J4/J5/DC1, and every GPIO assignment) is documented at the top of firmware/water-cutoff.yaml.

Required hardware

Everything on the PCB itself is sourced from LCSC/JLCPCB (see production/bom.csv). The following is off-board hardware you'll need to buy separately and wire in:

ItemNotesSource
ESP32-DevKitC-32 ESP-WROOM-3230 pin, 25mm spacingAmazon
12V DC power supplyBarrel plug, 5.5mm OD × 2.1mm IDAmazon
Motorized ball valveInnovative Home Systems
Leak/water sensor probe2-wire contact or conductivity probeN/A, 3D Printed
Illuminated pushbuttonMomentary switch + 5V RGB LEDAmazon

Connector pinouts

Wire colors below reflect this build — if you're sourcing your own actuator/probe/button, verify against whatever ships with your specific part before trusting the color, especially for J4 and J5 where colors vary by manufacturer.

J3 — front-panel button + RGB LED (6-pin)

PinSignalGPIOWire color
1Button switch (to GND when pressed)GPIO22Yellow
2GND—White
3LED red channel (via Q1)GPIO21Red
4LED green channel (via Q2)GPIO19Green
5LED blue channel (via Q3)GPIO18Blue
6+5V (LED supply)—Black

J4 — motorized valve actuator (7-pin)

PinSignalGPIOWire colorNotes
1MOTOR_F—Red
2MOTOR_R—Green
3GND—Black
4Open-limitGPIO26Blueswitch to GND when tripped
5GND—Gray
6Closed-limitGPIO32Yellowswitch (to GND when tripped)
7GND—White

J5 — leak probe (2-pin)

PinSignalGPIOWire colorNotes
1Probe signalGPIO14TBD (per probe)pulled to GND on leak
2GND—TBD (per probe)

DC1 — power input (barrel jack)

Standard center-positive 5.5mm OD × 2.1mm ID barrel plug: center pin is +12V, sleeve is GND.

Repository structure

File/DirectoryDescription
Water Cutoff.kicad_pro/.kicad_sch/.kicad_pcbKiCad project (schematic + PCB)
libs/lcsc/Imported LCSC/EasyEDA symbols, footprints, 3D models
production/JLCPCB-ready fab output
firmware/water-cutoff.yamlESPHome device config
firmware/secrets.yaml.exampleTemplate for WiFi/API credentials
stl/3D Models for the leak sensor

Building the board

  1. Open Water Cutoff.kicad_pro in KiCad 10.
  2. Everything needed to fabricate is already generated in production/ — Water_Cutoff.zip contains gerbers and drill files ready to upload directly to JLCPCB (or any fab that accepts standard RS-274X Gerbers), alongside bom.csv and positions.csv for assembly.
  3. All non-generic parts are sourced from LCSC/JLCPCB; part numbers are in production/bom.csv. Everything is a Basic part except where noted, to keep assembly cost down.
  4. The ESP32-WROOM-32 DevKitC-32 dev board is not part of the PCB assembly — it's a separate, off-the-shelf board that plugs into the female headers (J1/J2) after the main board is assembled.

Flashing the firmware

This project uses ESPHome.

  1. Copy firmware/secrets.yaml.example to firmware/secrets.yaml and fill in your real WiFi credentials, OTA password, and API encryption key. secrets.yaml is gitignored on purpose — never commit your real one.
  2. Flash firmware/water-cutoff.yaml to the ESP32 with esphome run (USB for the first flash; OTA after that).
  3. Add the device in Home Assistant once it shows up on the network (or add it manually via the ESPHome integration).

Before relying on this for anything real, verify on the bench:

  • Valve direction. The firmware assumes a specific relay energize state opens the valve — confirm this matches your actuator's wiring before trusting the leak-triggered auto-close. If it moves the wrong way, either swap the two motor wires at the valve connector or flip the relevant action in the YAML (see the comments at the top of the file).
  • Limit switch identity. If you're using a different valve actuator, double-check which wire is the open-confirm switch and which is the closed-confirm switch before flashing.

Button behavior

Valve stateShort pressLong press (≥3s)
OpenClosesCloses
OpeningCloses (reverses)Closes (reverses)
ClosingOpens (reverses)Opens (reverses)
Closed (at rest)NothingOpens

The long-press requirement only applies to opening from a fully-closed rest state — everywhere else, closing is a single short press, since closing is the safety-first direction.

License

See LICENSE.

Parts

38
QtyValueFootprintReferences
4100Ωlcsc_footprints:C22775_R0603R1, R2, R3, R9
410KΩlcsc_footprints:C25804_R0603R6, R7, R8, R10
4AO3400Alcsc_footprints:C20917_SOT-23-3_L2_9-W1_3-P1_90-LS2_4-BRQ1, Q2, Q3, Q4
4MountingHole_PadMountingHole:MountingHole_3.2mm_M3_PadH1, H2, H3, H4
3220Ωlcsc_footprints:C22962_R0603R11, R12, R13
2100uFlcsc_footprints:C2983553_CAP-SMD_BD6_3-L6_6-W6_6-FDC2, C3
2DS1023-1X15SF11lcsc_footprints:C7509525_HDR-TH_15P-P2_54-V-FJ1, J2
2SS34lcsc_footprints:C8678_SMA_L4_3-W2_6-LS5_2-RDD1, D2
11N4148Wlcsc_footprints:C81598_SOD-123F_L2_7-W1_6-LS3_8-RDD3
11uFlcsc_footprints:C15849_C0603C1
12.2KΩlcsc_footprints:C4190_R0603R4
12541WV-06Plcsc_footprints:C5383115_HDR-TH_6P-P2_54-V-MJ3
168uHlcsc_footprints:C9393_IND-SMD_L5_0-W5_0_SMNR5040L1
1820Ωlcsc_footprints:C23253_R0603R5
1DB142R-5.08-2P-GNlcsc_footprints:C52942255_CONN-TH_4P-P5_08_DB142R-5_08-2P-GNJ5
1DB142R-5.08-7Plcsc_footprints:C2898714_CONN-TH_7P-P5_08_DIBO_DB142R-5_08-7PJ4
1DC-470-2.1GPlcsc_footprints:C194407_DC-IN-TH_DC-470-2_1GPDC1
1KT-0805Glcsc_footprints:C2297_LED0805-R-RDLED2
1NCD0805R1lcsc_footprints:C84256_LED0805-RDLED1
1SRD-05VDC-SL-Clcsc_footprints:C35449_RELAY-TH_SRD-XXVDC-XL-CK1
1XL1509-5.0E1lcsc_footprints:C61063_SOIC-8_L5_0-W4_0-P1_27-LS6_0-BLU1

Similar boards

  • 2 layers88 × 130 mmWindowmaster controller v2, the printed circuit board in 3D

    Windowmaster controller v2

    Simplycissmus/windowmaster-s3-controller

    Open hardware and ESP32-S3 firmware for a local 24 V window actuator controller with MQTT and Home Assistant integration.

    68 parts1
  • 2 layers49 × 50 mmPlant watering system, the printed circuit board in 3D

    Plant watering system

    Excse/plant-watering-system

    A completely selfmade smart watering system for plants of any kind integrated into HomeAssistant

    45 parts1
  • 4 layers190 × 110 mmWith GL3224, the printed circuit board in 3D

    With GL3224

    Benjamin-girard-1/magnetometer-node-old

    282 parts
  • 4 layers100 × 100 mmAmod m, the printed circuit board in 3D

    Amod m

    gallicchio/AMOD-and-RFMOD

    The tutorial's 2x12 adapter (/mudd/133electronics/icepi-zero-dac-adc/adapterboard/) with a 2 x 6 right-angle Pmod socket on a 15 mm extension of its right-hand end, so an Icepi Zero can drive AMOD-A's and RF-MOD's Pmod…

    207 parts
  • 2 layers113.1 × 52.7 mmHomeWork2, the printed circuit board in 3D

    HomeWork2

    PubInv/PMD_-pseudo-medical-device-aka-Homework2-

    In this repo I am practicing KICAD. Created an ESP32 DevKit V1 module and a PCB footprint. I designed a circuit around this ESP32 consisting of six lamps, four switches, and two power jacks and added a voltage…

    60 parts
  • 4 layers54 × 102 mmSWC, the printed circuit board in 3D

    SWC

    OETSolutions/swc-module

    Steering-wheel-controls adapter module — ESP32-S3, KiCad schematic/PCB, JLCPCB assembly

    110 parts
  • 2 layers100 × 100 mmUlva controller, the printed circuit board in 3D

    Ulva controller

    ivere27/ulva

    controller board for robotics and agriculture

    106 partsMIT
  • 4 layers222 × 100 mmHydroScan V1, the printed circuit board in 3D

    HydroScan V1

    paulmartinezcuenta/Proyecto_finales_mecatronica_ITLA

    Monorepo for two mechatronics projects sharing a panelized PCB: HydroScan (autonomous IoT maritime buoy with LTE, GPS, and solar power) and AUTOAMBU (automated medical respirator prototype with DC control and USB fast…

    156 parts1

Questions

How big is the Water Cutoff PCB?

It measures 70 × 70 mm and has 2 copper layers, 1.6 mm thick.

What parts does the Water Cutoff use?

38 parts, built around the XL1509-5.0E1, AO3400A, DS1023-1X15SF11 and SS34. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.

Where can I download the Water Cutoff KiCad files?

From the cyberknet/water-sensor-cutoff repository on GitHub, at the commit this page was made from: the board is Water Cutoff.kicad_pcb and its schematic Water Cutoff.kicad_sch. PCBKit opens the board in the browser, with nothing to install.

Can I use the Water Cutoff design in my own project?

Its repository states no licence, so its author keeps all rights: ask cyberknet before reusing the design.