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 IoT & Smart Home

IoT Water Leak Detector: ESP32 + Sensor + Telegram Alert

IoT Water Leak Detector: ESP32 + Sensor + Telegram Alert

March 11, 2026 /Posted byJayesh Jain / 0

Water damage is one of the most expensive and preventable disasters in Indian homes, offices, and factories. An IoT water leak detector with Telegram alerts built using ESP32 can save you from flooded basements, burst pipes under kitchen sinks, or leaking AC drain pipes — all for under ₹500 in components. In this complete project guide, we will build a real-time water leak detection system that sends instant Telegram notifications to your phone the moment water is detected anywhere in your premises.

This project is perfect for Indian homeowners living in apartments prone to pipeline issues, small business owners with server rooms, or anyone who wants peace of mind during the monsoon season. Let us get started.

Table of Contents

  1. How the IoT Water Leak Detector Works
  2. Components Required
  3. Setting Up Telegram Bot for Alerts
  4. Circuit Diagram and Wiring
  5. Complete Arduino Code
  6. Enclosure and Deployment Tips for Indian Conditions
  7. Advanced Features: Multiple Zones and Auto Shutoff
  8. Frequently Asked Questions

How the IoT Water Leak Detector Works

The system is elegantly simple. A water/moisture sensor — typically a PCB with exposed copper traces — changes its electrical resistance when water bridges the gap between the traces. The ESP32 reads this change via an analog GPIO pin. When moisture crosses a threshold, the ESP32:

  1. Connects to your Wi-Fi network
  2. Sends an HTTPS POST request to the Telegram Bot API
  3. Your Telegram app receives a push notification within 1-2 seconds
  4. Optionally activates a buzzer or relay to cut off the water supply

The entire system can run on a 5V USB adapter or a battery pack, making it easy to deploy near washing machines, under kitchen sinks, behind water heaters (geysers), or at the base of water tanks.

Components Required

Component Quantity Notes
ESP32 Development Board 1 Any variant works
Water/Moisture Sensor Module 1-4 One per zone
Buzzer (active, 5V) 1 Optional alarm
5V Relay Module 1 For auto shutoff
USB 5V Adapter 1 For continuous power
Jumper Wires Several Male-to-female
Ai Thinker NodeMCU-32S-ESP32 Development Board

Ai Thinker NodeMCU-32S-ESP32 Development Board

The brain of this water leak detector — dual-core 240MHz with built-in Wi-Fi for fast Telegram notifications and multiple analog GPIO pins for multi-zone sensing.

View on Zbotic

Setting Up Telegram Bot for Alerts

Telegram is the ideal notification platform for Indian IoT projects — it is free, reliable, works on 2G/3G, and the Bot API is simple to use over HTTPS. Follow these steps:

Step 1: Create a Telegram Bot

  1. Open Telegram and search for @BotFather
  2. Send the command /newbot
  3. Follow the prompts to name your bot (e.g., “My Home Leak Alert”)
  4. BotFather will give you a Bot Token — save it, looks like: 123456789:ABCdefGHI...

Step 2: Get Your Chat ID

  1. Start a conversation with your new bot (send it any message)
  2. Open this URL in a browser: https://api.telegram.org/bot{YOUR_TOKEN}/getUpdates
  3. Find the "id" field inside the "chat" object — this is your Chat ID

Step 3: Test the API

Test that your bot can send messages by visiting this URL:

https://api.telegram.org/bot{TOKEN}/sendMessage?chat_id={CHAT_ID}&text=Hello+from+ESP32!

If you see a message in Telegram, your bot is working correctly.

Circuit Diagram and Wiring

The wiring for this project is minimal:

Component Pin ESP32 Pin
Sensor VCC 3.3V
Sensor GND GND
Sensor AOUT (Analog) GPIO 34
Sensor DOUT (Digital) GPIO 35
Buzzer (+) GPIO 26
Buzzer (-) GND

Important for Indian conditions: Place the sensor probes (the exposed PCB pad) flat on the floor. Run waterproof wiring from the probe to the ESP32 control unit mounted at a higher, dry location. Use food-grade silicone sealant to protect any exposed PCB components near damp areas.

Complete Arduino Code

#include <WiFi.h>
#include <WiFiClientSecure.h>
#include <HTTPClient.h>

const char* ssid = "YOUR_WIFI_SSID";
const char* password = "YOUR_WIFI_PASSWORD";
const String BOT_TOKEN = "YOUR_BOT_TOKEN";
const String CHAT_ID = "YOUR_CHAT_ID";

#define SENSOR_ANALOG_PIN 34
#define SENSOR_DIGITAL_PIN 35
#define BUZZER_PIN 26
#define LEAK_THRESHOLD 1000  // Adjust based on your sensor
#define ALERT_COOLDOWN 60000 // 60 second cooldown between alerts

unsigned long lastAlertTime = 0;
bool leakDetected = false;

void setup() {
  Serial.begin(115200);
  pinMode(SENSOR_DIGITAL_PIN, INPUT);
  pinMode(BUZZER_PIN, OUTPUT);
  
  WiFi.begin(ssid, password);
  Serial.print("Connecting to WiFi");
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  Serial.println("nConnected! IP: " + WiFi.localIP().toString());
  sendTelegramMessage("Water Leak Detector Online - Monitoring started");
}

void loop() {
  int analogValue = analogRead(SENSOR_ANALOG_PIN);
  int digitalValue = digitalRead(SENSOR_DIGITAL_PIN);
  
  Serial.printf("Analog: %d, Digital: %dn", analogValue, digitalValue);
  
  bool waterPresent = (analogValue > LEAK_THRESHOLD) || (digitalValue == LOW);
  
  if (waterPresent && !leakDetected) {
    leakDetected = true;
    digitalWrite(BUZZER_PIN, HIGH);
    String msg = "WATER LEAK DETECTED!nLocation: Kitchen SinknSensor Value: " + String(analogValue) + "nTime: " + String(millis()/1000) + "s uptime";
    sendTelegramMessage(msg);
    lastAlertTime = millis();
  } else if (!waterPresent && leakDetected) {
    leakDetected = false;
    digitalWrite(BUZZER_PIN, LOW);
    sendTelegramMessage("Water leak CLEARED. Area is now dry.");
  } else if (waterPresent && (millis() - lastAlertTime > ALERT_COOLDOWN)) {
    // Repeat alert if leak persists
    sendTelegramMessage("REMINDER: Water leak still detected! Please check.");
    lastAlertTime = millis();
  }
  
  delay(1000);
}

void sendTelegramMessage(String message) {
  if (WiFi.status() != WL_CONNECTED) return;
  
  WiFiClientSecure client;
  client.setInsecure(); // Use proper cert in production
  
  HTTPClient https;
  String url = "https://api.telegram.org/bot" + BOT_TOKEN + "/sendMessage";
  
  if (https.begin(client, url)) {
    https.addHeader("Content-Type", "application/json");
    String body = "{"chat_id":"" + CHAT_ID + "","text":"" + message + "","parse_mode":"HTML"}";
    int code = https.POST(body);
    Serial.println("Telegram response code: " + String(code));
    https.end();
  }
}

Enclosure and Deployment Tips for Indian Conditions

Indian homes present unique deployment challenges — humidity, monsoon moisture, power fluctuations, and sometimes rats chewing cables. Here are practical tips:

  • Use IP65-rated junction boxes for the ESP32 unit if mounting in semi-exposed areas
  • Power via PoE adapter or 5V phone charger — keep the device always on, do not rely on batteries alone
  • Add a TVS diode across the power input to protect from voltage spikes common in Indian electrical grids
  • Label your sensor probe cables clearly — in multi-zone setups, a sticker on each cable saves confusion during maintenance
  • Monsoon preparation: Check all sensor pads before the monsoon season. Clean corroded probes with a pencil eraser or fine sandpaper
  • Mount control unit high: In areas prone to flooding (ground-floor flats, basements), mount the ESP32 unit at least 50cm above floor level
18650 Lithium Battery Shield V8

2 x 18650 Lithium Battery Shield V8 for ESP32

Keep your water leak detector running even during power cuts with this dual 18650 battery shield — provides UPS-like backup power for continuous protection.

View on Zbotic

Advanced Features: Multiple Zones and Auto Shutoff

Once your basic system is working, here are upgrades to consider:

Multi-Zone Monitoring

ESP32 has up to 18 ADC channels. Connect multiple sensor pads to different GPIO pins and detect leaks in the bathroom, kitchen, balcony, and utility room simultaneously. Modify the code to tag each alert with the zone name (e.g., “LEAK at: Bathroom — near Western Commode”).

Automated Water Shutoff

Add a solenoid valve controlled via a relay to your main water line. When a leak is detected, the ESP32 triggers the relay to close the valve, stopping water flow before damage spreads. Include a manual override button so you can reopen the valve after fixing the leak.

Telegram Inline Buttons

Use Telegram’s InlineKeyboardMarkup in your API call to add buttons to the alert message like “Silence Alarm” or “Reopen Valve” — the ESP32 can poll the Telegram Bot API for updates and respond to these button presses.

30Pin ESP32 Expansion Board

30Pin ESP32 Expansion Board with Type-C USB

This expansion board makes multi-zone wiring easy — all 30 pins are broken out with convenient screw terminals, ideal for connecting multiple sensor probes across your home.

View on Zbotic

Frequently Asked Questions

Q1: Will the water leak detector work during Wi-Fi outages?

The local buzzer and LED will still activate during Wi-Fi outages. The Telegram alert will be queued and sent once connectivity is restored (if you implement a retry mechanism in the code). For critical installations, consider adding a GSM module (SIM800L) as a fallback alert channel.

Q2: How long do the water sensor probes last before corrosion?

Standard resistive sensors corrode within 1-3 months if frequently exposed to water. To extend lifespan: only power the sensor during measurement (use a GPIO pin as VCC, pull it HIGH only when sampling). Alternatively, use capacitive soil/water sensors which have no exposed metal contacts and last years.

Q3: Can I monitor multiple locations in my house?

Yes. Use multiple sensors connected to different GPIO pins on a single ESP32, or deploy multiple ESP32 units and have them all post to the same Telegram group chat. The second approach is more reliable for large homes or offices.

Q4: Can I use this with ESP8266 instead of ESP32?

Yes. The ESP8266 (D1 Mini, NodeMCU) also supports the Telegram Bot API via HTTPS. Use the WiFiClientSecure and ESP8266HTTPClient libraries. However, ESP32 is recommended for its more stable TLS implementation and additional GPIO pins for multi-zone monitoring.

Protect Your Home Today

Get the ESP32 boards, sensors, and accessories needed to build your water leak detector from Zbotic — fast delivery across India with genuine components.

Shop IoT Components on Zbotic

Tags: ESP32, home automation, iot, Telegram Alert, Water Leak Detector
Share Post
  • Facebook
  • Linkedin
  • Whatsapp
ESP32 LED Strip Controller: WS...
blog esp32 led strip controller ws2812b wled firmware guide 595352
blog troubleshoot esp32 wifi drops and reconnection issues 595355
Troubleshoot ESP32 WiFi Drops ...

Related posts

Svg%3E
Read more

IoT Home Insurance Sensor Kit: Leak, Smoke, and Motion

April 1, 2026 0
Table of Contents IoT and Home Insurance Water Leak Detection Smoke and Fire Detection Motion and Intrusion Sensing Building the... Continue reading
Svg%3E
Read more

IoT Pet Tracker: GPS Collar with Geofencing Alerts

April 1, 2026 0
Table of Contents Introduction and Overview Hardware Components Required GPS Module Integration with ESP32 Cloud Platform Setup Real-Time Tracking Dashboard... Continue reading
Svg%3E
Read more

IoT Aquaponics Controller: Fish and Plant Automation

April 1, 2026 0
Table of Contents The Water Monitoring Challenge in India Sensor Technologies for Water Building the Sensor Node Data Transmission and... Continue reading
Svg%3E
Read more

IoT Composting Monitor: Temperature and Moisture Tracking

April 1, 2026 0
Table of Contents Why Temperature Monitoring Matters Sensor Selection Guide Hardware Assembly and Wiring Firmware Development Cloud Data Logging Alert... Continue reading
Svg%3E
Read more

IoT Beehive Monitor: Weight, Temperature, and Humidity

April 1, 2026 0
Table of Contents Why Monitor Beehives Weight Measurement System Temperature and Humidity Sensing Building the Monitor Data Analysis for Bee... 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