Zbotic Logo Zbotic Logo
  • Home
  • Shop
  • Sale
  • 3D Print Service
  • PCB Service
  • B2B
  • Blogs
  • Contact Us
0 0

View Wishlist Add all to cart

0 0
0 Shopping Cart
Shopping cart (0)
Subtotal: ₹0.00

View cartCheckout

  • Shop
  • About Us
  • Contact Us
  • Reseller
  • Blogs
020 69134444
1800 209 0998
[email protected]
Help Desk
Facebook Twitter Instagram Linkedin YouTube
Zbotic Logo Zbotic Logo
0 0

View Wishlist Add all to cart

0 0
0 Shopping Cart
Shopping cart (0)
Subtotal: ₹0.00

View cartCheckout

All departments
  • 3D Print Service
  • 3D Printer
  • Batteries & Chargers
  • Development Boards
  • Drone Parts
  • EBike parts
  • Sensor Modules
  • Electronic Components
  • Electronic Modules
  • IoT and Wireless
  • Mechanical Parts and Workbench Tools
  • Motors & Drivers & Pumps & Actuators
  • DIY and Robot Kits
  • Show more
  • Home
  • Shop
  • Sale
  • 3D Print Service
  • PCB Service
  • B2B
  • Blogs
  • Contact Us
Return to previous page
Home Home Automation & Smart Devices

Smart Water Leak Detector: ESP8266 and Notification Setup

Smart Water Leak Detector: ESP8266 and Notification Setup

March 11, 2026 /Posted byJayesh Jain / 0

A smart water leak detector using ESP8266 can save Indian homeowners from costly water damage — especially relevant during monsoon season, with overhead water tanks, or in apartments with shared plumbing. When water is detected, the ESP8266 instantly sends Telegram/WhatsApp alerts and can automatically shut off a valve. This guide covers building a comprehensive water leak detection system for Indian homes using readily available components.

Table of Contents

  • Why Water Leak Detection in India
  • Water Sensor Options in India
  • Circuit Design
  • ESP8266 Code with Notifications
  • Telegram Alert System
  • Automatic Valve Shutoff
  • Sensor Placement in Indian Homes
  • Frequently Asked Questions

Why Water Leak Detection in India

Water leaks are a significant concern in Indian homes and apartments for several reasons:

  • Overhead tanks: Many Indian buildings have rooftop tanks — overflow can cause ceiling damage in flats below
  • Monsoon season: June–September brings heavy rains; roof leaks, window seepage, and basement flooding are common
  • Old plumbing: Much of India’s residential plumbing infrastructure is aging — pipe bursts and joint failures are frequent
  • Water pressure issues: High municipal pressure periods can stress pipes and fittings
  • Kitchen and bathroom leaks: Under-sink pipe connections, washing machine hoses
  • AC condensate: Air conditioner drip trays overflowing in summer

Water Sensor Options in India

Several water detection sensor options are available in India:

  • Water/rain sensor module: ₹30–₆0. Simple resistive sensor — trace PCB with copper tracks. Detects presence of water by reduced resistance. Available everywhere in India.
  • Capacitive water level sensor: ₹80–₁50. More reliable for continuous submersion. Won’t corrode like resistive sensors.
  • eTape/water level sensor: ₹200–₄00. Continuous level measurement (not just presence).
  • Float switch: ₹30–₈0. Mechanical switch that triggers on water level rise. Zero electronics required — simplest approach.
Recommended: UNO WiFi R3 NodeMCU ESP8266 — NodeMCU ESP8266 with built-in WiFi is perfect for a water leak detector that sends instant alerts over your home WiFi network.

Circuit Design

/* Water Leak Detector Circuit */

// Components:
// - ESP8266 (D1 Mini or NodeMCU)
// - Water/rain sensor module
// - 5V buzzer (optional)
// - Green LED (normal) + Red LED (alert)
// - 12V solenoid valve + relay (for automatic shutoff, optional)

// Water sensor to ESP8266:
// Sensor module VCC  → 3.3V (NOT 5V for digital pin reading)
// Sensor module GND  → GND
// Sensor module DO   → ESP8266 D5 (GPIO14) - Digital Output
// Sensor module AO   → ESP8266 A0 - Analog (optional for level measurement)

// Indicator LEDs:
// Green LED → D6 (GPIO12) via 220Ω
// Red LED   → D7 (GPIO13) via 220Ω

// Buzzer:
// Buzzer +  → D8 (GPIO15) via 100Ω
// Buzzer -  → GND

// Water sensor calibration:
// Dry sensor: DO = HIGH (no leak)
// Wet sensor: DO = LOW (leak detected!)
// Most sensor modules are active-LOW when water detected

ESP8266 Code with Notifications

#include <ESP8266WiFi.h>
#include <WiFiClientSecure.h>
#include <ESP8266HTTPClient.h>

const char* ssid     = "YourWiFi";
const char* password = "YourPassword";

#define SENSOR_PIN  D5   // GPIO14 - Water sensor digital output
#define RED_LED     D7   // GPIO13
#define GREEN_LED   D6   // GPIO12
#define BUZZER_PIN  D8   // GPIO15
#define VALVE_RELAY D1   // GPIO5 (for solenoid valve)

// Alert thresholds to prevent spam
unsigned long lastAlertTime = 0;
const unsigned long ALERT_COOLDOWN = 300000;  // 5 minutes between alerts

bool leakDetected = false;
bool previousState = false;

void setup() {
    Serial.begin(115200);
    
    pinMode(SENSOR_PIN, INPUT);
    pinMode(RED_LED, OUTPUT);
    pinMode(GREEN_LED, OUTPUT);
    pinMode(BUZZER_PIN, OUTPUT);
    pinMode(VALVE_RELAY, OUTPUT);
    
    // Start with valve open, green LED on
    digitalWrite(VALVE_RELAY, LOW);  // Valve open
    digitalWrite(GREEN_LED, HIGH);
    digitalWrite(RED_LED, LOW);
    
    WiFi.begin(ssid, password);
    Serial.print("Connecting to WiFi");
    while (WiFi.status() != WL_CONNECTED) {
        delay(500);
        Serial.print(".");
    }
    Serial.println("
Connected! IP: " + WiFi.localIP().toString());
    Serial.println("Water leak detector armed and ready");
}

void loop() {
    // Read water sensor (active LOW = water detected)
    bool waterDetected = (digitalRead(SENSOR_PIN) == LOW);
    
    // Leak started
    if (waterDetected && !previousState) {
        leakDetected = true;
        Serial.println("WATER LEAK DETECTED!");
        
        // Visual and audio alert
        digitalWrite(RED_LED, HIGH);
        digitalWrite(GREEN_LED, LOW);
        
        // Beep buzzer urgently
        for (int i = 0; i  ALERT_COOLDOWN)) {
        sendTelegramAlert("⚠️ Water leak still active! Please check immediately.");
        lastAlertTime = millis();
    }
    
    previousState = waterDetected;
    delay(500);  // Check every 500ms
}

Telegram Alert System

WiFiClientSecure client;
const String BOT_TOKEN = "your-bot-token";
const String CHAT_ID = "your-chat-id";

void sendTelegramAlert(String message) {
    if (WiFi.status() != WL_CONNECTED) {
        Serial.println("WiFi not connected - alert not sent");
        return;
    }
    
    client.setInsecure();  // Skip cert verification for simplicity
    
    if (client.connect("api.telegram.org", 443)) {
        String url = "/bot" + BOT_TOKEN + "/sendMessage?chat_id=" + 
                     CHAT_ID + "&text=" + urlencode(message) +
                     "&parse_mode=HTML";
        
        client.print("GET " + url + " HTTP/1.1
");
        client.print("Host: api.telegram.org
");
        client.print("Connection: close

");
        
        delay(1000);
        while (client.available()) {
            String line = client.readStringUntil('
');
            if (line.indexOf(""ok":true") > 0) {
                Serial.println("Telegram alert sent successfully");
            }
        }
        client.stop();
    }
}

String urlencode(String str) {
    String encodedString = "";
    char c;
    for (int i = 0; i < str.length(); i++) {
        c = str.charAt(i);
        if (c == ' ') encodedString += '+';
        else if (isalnum(c)) encodedString += c;
        else encodedString += '%' + String(c, HEX);
    }
    return encodedString;
}
Recommended: Mega WiFi R3 with NodeMCU ESP8266 — Scale up to monitor multiple water sensors throughout your home with this more capable board.

Automatic Valve Shutoff

For automatic water shutoff, add a 12V or 24V solenoid valve:

  • 12V Solenoid Valve (1/2 inch): ₹300–₆00 on Amazon India. Install on main water supply line.
  • NC (Normally Closed) solenoid valve: Stays CLOSED when no power — fails safe during power cuts
  • NO (Normally Open) solenoid valve: Stays OPEN when no power — requires power to close

For Indian homes: Use NC type for main supply line shutoff — if power goes out during a leak, valve stays closed (safe). Use NO type for water distribution lines where you want normal operation during power cuts.

Sensor Placement in Indian Homes

  • Under kitchen sink: Under the pipe connections where Indian homes commonly leak
  • Under washing machine: Behind or beside the machine on the floor
  • Bathroom near AC drip pipe: Where split AC condensate drains
  • Near water heater/geyser: Geysers leak from pressure relief valves and connections
  • Terrace/balcony drain: Detects blockage before water enters the home
  • Basement (if applicable): Common leak point in older Indian buildings during monsoon

Frequently Asked Questions

How long do water sensor probes last in Indian conditions?

Resistive water sensor modules (copper trace PCBs) can corrode in 6–12 months in humid Indian conditions. Use stainless steel probes or capacitive sensors for longer life. Coating the PCB with conformal spray (except the sensing area) extends life significantly.

Can this system detect slow pipe leaks inside walls?

Surface water sensors detect water after it has reached the floor — they cannot detect leaks inside walls. For wall leaks, professional acoustic leak detection equipment is needed. For DIY monitoring, place sensors at every possible exit point of wall cavities (floor level at skirting).

What solenoid valve size is needed for Indian residential water lines?

Indian residential water supply pipes are typically 1/2 inch (15mm) or 3/4 inch (20mm) near fixtures. Use a 1/2 inch valve for single fixture monitoring and a 3/4 inch to 1 inch valve for main supply shutoff at the metre.

Can ESP8266 run on battery for water leak sensing?

ESP8266 active WiFi draws 80–200mA — too much for battery. For battery-powered sensors, use deep sleep: check sensor every 30 seconds, transmit alert only when leak detected. With 3000mAh LiPo and 30-second check interval, battery life is several months. Add a capacitor (470μF) to handle WiFi startup current spikes.

Is there an Indian standard for water leak detectors?

No specific IS standard for DIY home water leak detectors. For commercial installations (hotels, hospitals), IS: 2189 for fire detection applies to some water detection equipment. DIY systems are for personal use — ensure the electrical parts are properly isolated from water using appropriate IP ratings.

Shop Home Automation at Zbotic →

Tags: ESP8266 IoT, smart home India, solenoid valve, Telegram Alert, Water Leak Detector
Share Post
  • Facebook
  • Linkedin
  • Whatsapp
Smart Power Outage Detector wi...
blog smart power outage detector with ups alert and telegram india 598827
blog e bike torque sensor vs cadence sensor riding feel guide 598833
E-Bike Torque Sensor vs Cadenc...

Related posts

Svg%3E
Read more

MQTT for Home Automation: ESP32 + Mosquitto + Home Assistant

April 1, 2026 0
MQTT is the backbone protocol of professional home automation systems. If you are building a smart home with multiple ESP32... Continue reading
Svg%3E
Read more

Curtain and Blind Automation: Stepper Motor Controller

April 1, 2026 0
Curtain automation is one of the most satisfying smart home upgrades you can build. Imagine your curtains opening automatically at... Continue reading
Svg%3E
Read more

Smart Doorbell with Camera: ESP32-CAM Video Intercom

April 1, 2026 0
A smart doorbell with a camera lets you see who is at your door from your phone, even when you... Continue reading
Svg%3E
Read more

Blynk IoT Platform: Control Arduino and ESP32 from Mobile

April 1, 2026 0
The Blynk IoT platform is the fastest way to control your Arduino and ESP32 projects from your mobile phone. Instead... Continue reading
Svg%3E
Read more

PIR Sensor Automatic Light: Save Electricity with Motion Detection

April 1, 2026 0
PIR sensor automatic lights are the simplest and most effective way to save electricity in Indian homes. By automatically turning... Continue reading

Add comment Cancel reply

Your email address will not be published. Required fields are marked

Facebook Twitter Instagram Pinterest Linkedin Youtube

Get the latest deals and more.

Download on Google Play Download on the App Store

Call us: 020 69134444 / 1800 209 0998

Monday - Saturday 09:30 AM - 06:00 PM
For Technical Supports Email: [email protected]
For Sales / Enquiries Email: [email protected]

  • My Account

    • Cart

    • Wishlist

    • Checkout

    • My Orders

    • Track Order

    • My Account

  • Information

    • FAQs

    • Blogs

    • Career

    • About Us

    • Contact Us

    • Payment Options

  • Policies

    • Privacy Policy

    • Terms & Conditions

    • GST Input Tax Credit

    • Shipping Return Policy

    • E-Waste Collection Points

    • Our Sitemap

© Zbotic.in is registered trademark of Moxie Supply Pvt Ltd – All Rights Reserved
Login
Use Phone Number
Use Email Address
Not a member yet? Register Now
Reset Password
Use Phone Number
Use Email Address
Register
Already a member? Login Now