Skip to the content
2 layers100 × 80 mmRealTimeWaterLeak, the printed circuit board in 3D

This is a Arduino UNO+ESP8266 based project which detects water flow inside the pipe and tells if there is leakage inside the pipe .All the info is send to a website

Size
100 × 80 mm
Copper layers
2
Thickness
1.6 mm
Parts
14
Nets
51
Pads
68
Tracks, vias
24, 0
Pours
1
Routed
Yes
KiCad
KiCad 10.0 (file 20260206)
Created
9 Apr 2026
Updated
13 Jul 2026

Overview

RealTimeWaterLeak is an open-source printed circuit board by rudrasaini47-code, from the rudrasaini47-code/Real-Time-Water-leak-detector repository on GitHub. It is a 2-layer board of 100 × 80 mm with 14 parts on 51 nets, routed with 24 tracks and 0 vias.

It is built around the ESP-12E and ARDUINO UNO R3. Its parts include 2 resistors and 1 IC. It belongs with the ESP8266 and AVR (ATmega, ATtiny) boards of this library.

Main components

2

README

README.md

Real Time Water Leak Detector

Smart water pipeline leak detection system with automatic valve shutoff, real-time web dashboard, and WiFi monitoring — built with Arduino Uno, NodeMCU ESP8266, and YF-S201 flow sensors.


Demo

text
Flow IN: 14.20 L/min  |  Flow OUT: 11.60 L/min  |  Diff: 2.60 L/min  →   LEAK DETECTED → True

Live dashboard updates every 2 seconds. Leak triggers browser notification + sound alert + automatic valve shutoff within 3 seconds of detection.


Features

  • Real-time flow monitoring — measures Flow IN and Flow OUT simultaneously using YF-S201 Hall-effect sensors
  • Intelligent leak detection — compares flow difference mathematically (no moisture sensor needed)
  • False alarm prevention — requires 3 consecutive seconds of sustained difference before triggering
  • Automatic valve shutoff — 12V solenoid valve closes instantly when leak is confirmed
  • WiFi dashboard — live web UI accessible from any browser on the same network
  • Multi-alert system — in-app toast, browser push notification, and sound alert on leak
  • No cloud needed — ESP8266 hosts its own API endpoint on local WiFi
  • Works with hotspot — connect ESP8266 to mobile hotspot for portable use

Hardware Required

ComponentQuantityNotes
Arduino Uno (R3)1Any revision
NodeMCU v3.0 (ESP8266)1Has onboard USB — easiest to flash
YF-S201 Flow Sensor2One inlet, one outlet
1kΩ Resistor1Voltage divider
2kΩ Resistor1Voltage divider (or 2× 1kΩ in series)
Breadboard + Jumper Wires—Male-to-male and male-to-female

Wiring

Arduino Uno Pin Connections

Arduino PinConnected To
2 (Digital)YF-S201 Flow IN signal (yellow wire)
3 (Digital)YF-S201 Flow OUT signal (yellow wire)
TX (pin 1)NodeMCU RX via voltage divider
RX (pin 0)NodeMCU TX (direct)
5VBoth YF-S201 VCC (red wires) + Relay VCC
3.3VNodeMCU 3V3 pin
GNDAll component GNDs (shared)

NodeMCU v3.0 Pin Connections

NodeMCU PinConnected To
3V3Arduino 3.3V
GNDArduino GND (shared)
D9 / RXArduino TX (pin 1) via voltage divider
D10 / TXArduino RX (pin 0) direct

All other NodeMCU pins are left unconnected.

Voltage Divider (mandatory — protects NodeMCU RX from 5V)

text
Arduino TX (pin 1) ──[1kΩ]──┬──── NodeMCU RX (D9)
                             │
                           [2kΩ]
                             │
                            GND
 
Output voltage: 5V × (2kΩ / 3kΩ) = 3.33V ✓

File Structure

text
FlowWatch
│
├── arduino_flowwatch.ino     ← Upload to Arduino Uno
├── esp8266_flowwatch.ino     ← Upload to NodeMCU ESP8266
├── flow-monitor.html         ← Open in browser for dashboard
└── README.md

PCB Specifications

  • Layers: 2 (F.Cu / B.Cu)
  • Thickness: 1.6 mm
  • Mounting: 4x 2.5mm mounting holes
  • Connectors: 6x 3.5mm screw terminals (Degson DG250 series)
  • Design tool: KiCad

Files

  • RealTimeWaterLeak.kicad_sch — Schematic
  • RealTimeWaterLeak.kicad_pcb — PCB layout

Setup

Step 1 — Configure WiFi credentials

Open esp8266_flowwatch.ino and set your WiFi name and password:

cpp
const char* WIFI_SSID     = "Your_WiFi_Or_Hotspot_Name";
const char* WIFI_PASSWORD = "yourpassword";

Note: ESP8266 only supports 2.4GHz WiFi. If using Android hotspot, force it to 2.4GHz in hotspot settings.

Step 2 — Upload Arduino code

  1. Disconnect NodeMCU TX/RX wires from Arduino pins 0 and 1
  2. Connect Arduino to laptop via USB
  3. Arduino IDE → Tools → Board → Arduino Uno
  4. Upload arduino_flowwatch.ino
  5. Open Serial Monitor at 9600 baud — verify output looks like:
text
   IN:0.00,OUT:0.00,LEAK:0,VALVE:1,DIFF:0.00
  1. Close Serial Monitor → reconnect NodeMCU TX/RX wires

Step 3 — Upload ESP8266 code

  1. Connect NodeMCU to laptop via USB (Arduino disconnected)
  2. Arduino IDE → Tools → Board → NodeMCU 1.0 (ESP-12E Module)
  3. Tools → Upload Speed → 115200
  4. Upload esp8266_flowwatch.ino
  5. LED blinks while connecting to WiFi, goes solid when connected

Step 4 — Find NodeMCU IP address

  • Mobile hotspot: Check connected devices list in your hotspot settings — look for "espressif"
  • Home router: Open router admin page → connected devices → find "ESP8266"
  • Verify: Open http://<ESP_IP>/ in browser — status page should load with live readings

Step 5 — Open dashboard

  1. Open flow-monitor.html in Chrome or Edge
  2. Enter API URL: http://<ESP_IP>/api/flow-data
  3. Click ▶ Start Polling
  4. Allow browser notification permission
  5. All 5 cards update in real time

How Leak Detection Works

text
Every 1 second:
  flowDiff = flowIn − flowOut
 
  if flowDiff < 2.0  →  Normal, reset counter
  if flowDiff ≥ 2.0  →  Increment confirmation counter
  if counter ≥ 3     →  LEAK CONFIRMED
                           → dashboard alerts fire
                           → browser notification sent
                           → sound alert plays
 
Press reset button (D6) after fixing leak → valve reopens

The 3-second confirmation window prevents false alarms from sensor jitter when taps open/close suddenly.


API Reference

The NodeMCU hosts a JSON REST API on port 80.

GET /api/flow-data

json
{
  "flow_in": 14.20,
  "flow_out": 11.60,
  "flow_diff": 2.60,
  "leak": 1,
  "valve_open": 0,
  "uptime_s": 3420,
  "has_data": true,
  "stale": false
}
FieldTypeDescription
flow_infloatInlet flow rate in L/min
flow_outfloatOutlet flow rate in L/min
flow_difffloatDifference (flow_in − flow_out)
leakint0 = normal, 1 = leak detected
uptime_sintESP8266 uptime in seconds
has_databoolFalse until first Arduino reading received
staleboolTrue if no update received in 10+ seconds

GET /

Human-readable status page. Auto-refreshes every 2 seconds.


Configuration

Adjustable constants in arduino_flowwatch.ino:

cpp
const float LEAK_THRESHOLD    = 2.0;   // L/min difference to trigger alert
const int   CONFIRM_COUNT     = 3;     // Consecutive detections before confirming
const float CALIBRATION_FACTOR = 7.5;  // YF-S201: pulses/sec per L/min
const unsigned long SEND_INTERVAL = 2000;  // How often to send data to ESP (ms)

Tuning tips:

  • Too many false alarms → increase LEAK_THRESHOLD to 3.0 or CONFIRM_COUNT to 5
  • Missing real leaks → decrease LEAK_THRESHOLD to 1.0 or 1.5
  • Readings seem off → adjust CALIBRATION_FACTOR (valid range: 4.5 – 8.5 for YF-S201)

Important Notes

Upload rule

Always disconnect NodeMCU TX/RX wires before uploading to Arduino. Arduino Uno shares its only serial port (pins 0/1) with USB. Reconnect after upload.

Power

  • Arduino powered by USB (any 5V phone charger or laptop)
  • NodeMCU powered from Arduino 3.3V pin — do not connect NodeMCU USB and Arduino 3.3V simultaneously

Network

The device running the dashboard must be on the same WiFi/hotspot as the NodeMCU. The NodeMCU IP may change after power cycles — set a static DHCP lease in your router to fix it permanently.


Troubleshooting

ProblemCauseFix
Dashboard shows all zerosSerial Monitor openClose Serial Monitor — it conflicts with ESP communication
Dashboard shows all zerosTwo power sources on NodeMCURemove USB from NodeMCU — power only from Arduino 3.3V
Flow always reads 0.00Wrong interrupt pinsYF-S201 signal must go to pin 2 and pin 3 on Uno
ESP not connecting to WiFiWrong credentials or 5GHzDouble-check SSID/password. Force Android hotspot to 2.4GHz
ESP broadcasting own WiFiFailed to join networkSame as above — ESP falls back to AP mode on failure
Upload failsNodeMCU TX/RX still connectedDisconnect pins 0 and 1 from NodeMCU before uploading
False leak alertsSensor jitterIncrease LEAK_THRESHOLD to 3.0 or CONFIRM_COUNT to 5
Random ESP resetsPower instabilityAdd 100µF capacitor between NodeMCU 3V3 and GND

Built With

  • Arduino Uno — sensor reading, flow calculation, valve control
  • NodeMCU ESP8266 — WiFi connectivity, JSON API server
  • YF-S201 — Hall-effect pulse flow sensors
  • Arduino IDE — firmware development
  • Chart.js — real-time flow history chart in dashboard
  • Vanilla HTML/CSS/JS — zero-dependency web dashboard

Parts

14
QtyValueFootprintReferences
6Screw_Terminal_01x01TerminalBlock_Degson:TerminalBlock_Degson_DG250-3.5-01P_1x01_P3.50mm_45DegreeFlow_IN(5V), Flow_IN(GND), Flow_IN(Signal), Flow_OUT(5V), Flow_OUT(GND), Flow_OUT(Signal)
11 kohmResistor_THT:R_Axial_DIN0309_L9.0mm_D3.2mm_P12.70mm_HorizontalR1
12 kohmResistor_THT:R_Axial_DIN0309_L9.0mm_D3.2mm_P12.70mm_HorizontalR2
1Arduino_UNO_R3Module:Arduino_UNO_R3A1
1ESP-12ERF_Module:ESP-12EU1

The 10 most common of 14 parts.

Similar boards

  • 2 layers68.8 × 53.6 mmRelatively Universal ROM Programmer, the printed circuit board in 3D

    Relatively Universal ROM Programmer

    AndersBNielsen/Relatively-Universal-ROM-Programmer

    Hardware to program W27C512 EEPROM or any 24/28/32 pin ROM requiring from 5V to 27V programming voltage.

    149 parts257GPL-3.0
  • 2 layers69.1 × 53.8 mmMotor controller, the printed circuit board in 3D

    Motor controller

    AlanFord/self-balancing-stick

    Dual Axis Reaction Wheel Inverted Pendulum

    25 parts79MIT
  • 2 layers68.6 × 53.3 mmProtogasm Board V2, the printed circuit board in 3D

    Protogasm Board V2

    Edging-Machines/Edging-Machines

    This repository is intended to contain as much information as possible about building, designing, prototyping, and using automated edging machines.

    14 parts67MIT
  • 2 layers53.8 × 69.6 mmEVSE V2 2, the printed circuit board in 3D

    EVSE V2 2

    PedroCNeves/AC_ChargingStation

    A learning project to create an EV AC Charging station based on an Arduino Uno

    32 parts50
  • 2 layers113.7 × 61 mmArduTester SMD, the printed circuit board in 3D

    ArduTester SMD

    jonsag/arduTester

    An arduino component tester based on https://create.arduino.cc/projecthub/plouc68000/ardutester-v1-13-the-arduino-uno-transistor-tester-dbafb4

    17 parts14
  • 4 layers65.9 × 52.9 mmMotor shield, the printed circuit board in 3D

    Motor shield

    DCC-EX/EX-MotorShield8874

    Design files for the open source 5A Motor Shield

    114 parts12
  • 4 layers68.6 × 53.3 mm101 PCB, the printed circuit board in 3D

    101 PCB

    ICRS/101

    The all-new open source Robotics 101 course from ICRS. It's specifically designed to be run in hackspaces, after school clubs and university societies.

    89 parts10CC-BY-4.0
  • 2 layers53.3 × 68.3 mmAnac 2040, the printed circuit board in 3D

    Anac 2040

    rallekralle11/Anna2040

    RP2040-based board in the shape of the Arduino uno

    63 parts9

Questions

How big is the RealTimeWaterLeak PCB?

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

What parts does the RealTimeWaterLeak use?

14 parts, built around the ESP-12E and ARDUINO UNO R3. 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 RealTimeWaterLeak KiCad files?

From the rudrasaini47-code/Real-Time-Water-leak-detector repository on GitHub, at the commit this page was made from: the board is PCB_Design/RealTimeWaterLeak.kicad_pcb and its schematic PCB_Design/RealTimeWaterLeak.kicad_sch. PCBKit opens the board in the browser, with nothing to install.

Can I use the RealTimeWaterLeak design in my own project?

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