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 Sensors & Modules

Water Level Sensor Guide: Tank Monitoring with Arduino and ESP32

Water Level Sensor Guide: Tank Monitoring with Arduino and ESP32

April 1, 2026 /Posted by / 0

A water level sensor connected to Arduino or ESP32 solves one of the most common household problems in India — knowing when your overhead tank is full, half-empty, or running dry. Instead of climbing to the terrace every few hours or running the motor blindly, a simple sensor setup gives you real-time water level data on a display, your phone, or even triggers the pump automatically. This guide covers every sensor type suitable for water tank monitoring, with wiring diagrams, Arduino code, and a complete IoT solution using ESP32.

Table of Contents

  • Water Level Sensor Types Compared
  • Ultrasonic Water Level Monitoring
  • Float Switch for Simple Level Detection
  • Capacitive and Resistive Sensors
  • Arduino Water Level Project
  • ESP32 IoT Tank Monitor with Alerts
  • Automatic Pump Controller
  • Frequently Asked Questions

Water Level Sensor Types Compared

There are four main approaches to measuring water level, each with trade-offs in accuracy, cost, durability, and ease of installation:

Type How It Works Accuracy Price (₹) Durability
Ultrasonic Measures distance to water surface ±3mm 150-500 Excellent (no contact)
Float switch Magnet in float triggers reed switch Fixed points only 50-150 Good (moving parts)
Capacitive Detects water through container wall On/off only 80-200 Excellent (non-contact)
Resistive probe Measures resistance between probes Graduated levels 30-80 Poor (corrodes)

Ultrasonic Water Level Monitoring

Ultrasonic sensors are the best choice for continuous water level measurement. They mount at the top of the tank (no water contact), measure the distance to the water surface, and you calculate the water level by subtracting from the known tank height.

JSN-SR04T — The Waterproof Choice

While the standard HC-SR04 works for experiments, its electronics aren’t waterproof. For a real tank installation, use the JSN-SR04T or AJ-SR04M — they have sealed ultrasonic probes connected by cable to a separate control board that stays dry. The probe mounts through a hole in the tank lid or hangs inside the tank opening.

🛒 Recommended: JSN-SR04T Waterproof Integrated Ultrasonic Ranging Module — Sealed probe with separate controller board, perfect for permanent tank installations.
🛒 Recommended: AJ-SR04M Waterproof Ultrasonic Module (21.5mm probe) — Compact waterproof probe, fits through small openings in tank lids.

Key specifications for water tank use:

  • Minimum distance: 20 cm (mount the sensor at least 20 cm above maximum water level)
  • Maximum distance: 450 cm (covers most residential tanks)
  • Beam angle: About 75° — in narrow tanks, reflections off walls can cause false readings
  • Operating voltage: 5V DC

Dealing with Condensation

Indian water tanks, especially plastic ones on rooftops, develop condensation on the lid during temperature changes. This can cause water droplets on the ultrasonic probe, affecting accuracy. Mounting the probe at a slight angle (10-15°) and using a small ventilation hole in the enclosure helps prevent moisture buildup.

Float Switch for Simple Level Detection

Float switches are the simplest and most reliable water level sensors. A buoyant float contains a magnet that triggers a reed switch at a set level. They output a simple HIGH/LOW signal — water reached this level, or it hasn’t.

Use multiple float switches at different heights (25%, 50%, 75%, 100%) for graduated level indication. Wire each to a digital pin on Arduino.

// Multi-level float switch reader
const int LEVEL_25 = 2;
const int LEVEL_50 = 3;
const int LEVEL_75 = 4;
const int LEVEL_100 = 5;

void setup() {
  Serial.begin(9600);
  pinMode(LEVEL_25, INPUT_PULLUP);
  pinMode(LEVEL_50, INPUT_PULLUP);
  pinMode(LEVEL_75, INPUT_PULLUP);
  pinMode(LEVEL_100, INPUT_PULLUP);
}

void loop() {
  int level = 0;
  if (digitalRead(LEVEL_25) == LOW) level = 25;
  if (digitalRead(LEVEL_50) == LOW) level = 50;
  if (digitalRead(LEVEL_75) == LOW) level = 75;
  if (digitalRead(LEVEL_100) == LOW) level = 100;

  Serial.print("Water level: ");
  Serial.print(level);
  Serial.println("%");
  delay(1000);
}

Float switches are common in Indian pump controllers because they’re mechanical — no calibration, no software, just a switch. The drawback is that you only get level readings at the points where switches are installed, not a continuous measurement.

Capacitive and Resistive Sensors

Capacitive Non-Contact Sensors

Capacitive sensors detect water through the tank wall (plastic or glass, not metal). They’re ideal when you can’t or don’t want to make holes in the tank. Stick the sensor on the outside of the tank wall at the desired detection level. They output a digital signal when water is present at that level.

These work best with thin-walled plastic tanks. Thick concrete tanks may not work. Install a sensor at each level you want to monitor.

Resistive Water Level Sensors

The common PCB-style water level sensor uses exposed traces that measure resistance based on how much of the sensor is submerged. They’re extremely cheap (₹30-50) and great for learning, but they corrode quickly in real-world use. The exposed copper traces develop a layer of corrosion within weeks of continuous water contact, making readings unreliable.

For prototyping and learning, they’re fine. For a permanent installation, use ultrasonic or float switches instead.

Arduino Water Level Project with Ultrasonic Sensor

Here’s a complete water level monitor using a waterproof ultrasonic sensor and LED bar graph display:

#include <SoftwareSerial.h>

const int trigPin = 9;
const int echoPin = 10;
const int ledPins[] = {2, 3, 4, 5, 6}; // 5 LEDs for level indication
const int buzzerPin = 7;

const float TANK_HEIGHT = 100.0; // Tank height in cm
const float SENSOR_OFFSET = 5.0; // Distance from sensor to full level

void setup() {
  Serial.begin(9600);
  pinMode(trigPin, OUTPUT);
  pinMode(echoPin, INPUT);
  pinMode(buzzerPin, OUTPUT);

  for (int i = 0; i 95%) or empty ( 95 || percentage < 10) {
    tone(buzzerPin, 1000, 200);
  }

  delay(2000);
}

float measureDistance() {
  // Take 5 readings and return median for stability
  float readings[5];
  for (int i = 0; i < 5; i++) {
    digitalWrite(trigPin, LOW);
    delayMicroseconds(2);
    digitalWrite(trigPin, HIGH);
    delayMicroseconds(10);
    digitalWrite(trigPin, LOW);
    readings[i] = pulseIn(echoPin, HIGH) * 0.034 / 2;
    delay(50);
  }
  // Simple bubble sort for median
  for (int i = 0; i < 4; i++) {
    for (int j = i + 1; j < 5; j++) {
      if (readings[j] < readings[i]) {
        float temp = readings[i];
        readings[i] = readings[j];
        readings[j] = temp;
      }
    }
  }
  return readings[2]; // Return median
}

void updateLEDs(float percentage) {
  int activeLEDs = map(percentage, 0, 100, 0, 5);
  for (int i = 0; i < 5; i++) {
    digitalWrite(ledPins[i], i < activeLEDs ? HIGH : LOW);
  }
}
🛒 Recommended: HC-SR04 Ultrasonic Distance Sensor Module — For prototyping and indoor testing before installing a waterproof variant in the tank.

ESP32 IoT Tank Monitor with Mobile Alerts

An ESP32-based monitor adds WiFi, enabling you to check water levels from your phone and receive alerts. Connect the JSN-SR04T the same way — Trig to GPIO5, Echo to GPIO18.

Popular dashboard options for Indian users:

  • Blynk — Free tier supports 2 devices, has a polished mobile app. Good for families who want a simple interface
  • ThingSpeak — Free for up to 3 million messages/year. Great for data logging and trend charts
  • Telegram Bot — No app installation needed beyond Telegram. Send level readings on request or when level crosses thresholds
  • Custom web dashboard — ESP32 hosts a simple webpage showing current level. Access from any device on the same WiFi network

For Telegram alerts, use the UniversalTelegramBot library. Set up a bot via BotFather, get the chat ID, and send messages when the water level drops below 20% or rises above 95%.

Automatic Pump Controller

The logical next step is automating the pump. Use a relay module to switch the pump motor based on water level:

  • Turn pump ON when level drops below 20%
  • Turn pump OFF when level reaches 90% (not 100% — leave headroom to prevent overflow)
  • Add a dry-run protection check — if the level doesn’t rise within 5 minutes of pump activation, the underground sump may be empty. Shut off the pump to prevent motor damage.

Safety considerations for pump control:

  1. Use an appropriately rated relay (10A minimum for most domestic pumps)
  2. Add a manual override switch so the pump can be operated without the controller
  3. Include a hardware safety cutoff (float switch at the overflow level) independent of the Arduino
  4. Use opto-isolated relay modules to protect the Arduino from mains voltage spikes
  5. Ensure proper earthing of the pump and relay enclosure per IS 732 standards
🛒 Recommended: Browse water level and ultrasonic sensors at Zbotic — Waterproof probes, float switches, and complete sensor modules for tank monitoring projects.

Frequently Asked Questions

Which water level sensor is most reliable for Indian rooftop tanks?

The JSN-SR04T waterproof ultrasonic sensor is the most reliable for long-term installations. It has no moving parts, no water contact with electronics, and handles the temperature extremes on Indian rooftops (0°C winter nights to 60°C summer surface temperatures). Float switches are a close second for simplicity.

Can I monitor underground sump and overhead tank together?

Yes. Use two sensors — one in each tank — connected to the same Arduino or ESP32. The controller reads both levels and runs the pump only when the sump has water (above 20%) and the overhead tank needs filling (below 20%). This prevents dry-running the pump.

How do I waterproof the electronics enclosure?

Use an IP65-rated ABS junction box (available at electrical shops for ₹100-200). Seal cable entry points with silicone sealant. Mount the box in a shaded spot — direct sunlight on a plastic enclosure can push internal temperatures above 70°C, damaging the ESP32. If shade isn’t available, use a white enclosure and add small ventilation holes (covered with mesh to keep insects out).

Does ultrasonic work with metal tanks?

Yes, ultrasonic sensors work inside metal tanks — sound bounces off the water surface regardless of tank material. The sensor mounts at the top looking downward. Capacitive sensors, however, won’t work through metal walls.

My ultrasonic readings are jumping erratically. How do I fix it?

Common causes: water splashing (from inlet pipe), condensation on the probe, or the sensor detecting tank walls instead of the water surface. Solutions: mount the sensor away from the water inlet, use a PVC pipe sleeve to create a calm measurement column (a 10cm diameter pipe hanging in the water), and take the median of 5-10 readings instead of a single reading.

Conclusion

A water level monitoring system can be as simple as a ₹50 float switch with an LED indicator or as sophisticated as an ESP32-based IoT controller with phone alerts and automatic pump management. For most Indian homes, a JSN-SR04T ultrasonic sensor with an ESP32 and Telegram alerts hits the sweet spot — accurate, reliable, affordable, and accessible from anywhere on your phone.

Get started with the right sensors from Zbotic’s sensor collection and bring intelligence to your water management.

Tags: Arduino, ESP32, iot, Sensors, Water Level
Share Post
  • Facebook
  • Linkedin
  • Whatsapp
Oscilloscope for Beginners Ind...
blog oscilloscope for beginners india what to buy and how to use 612423
blog teensy board guide audio projects and high speed usb 612428
Teensy Board Guide: Audio Proj...

Related posts

Svg%3E
Read more

Encoder Module: Position and Speed Measurement with Arduino

April 1, 2026 0
A rotary encoder converts the angular position and rotation speed of a shaft into electrical signals that Arduino can count... Continue reading
Svg%3E
Read more

Infrared Obstacle Sensor: Line Follower and Object Detection

April 1, 2026 0
Infrared obstacle sensors are the building blocks of line-following robots, edge detection systems, and proximity triggers. These tiny modules emit... Continue reading
Svg%3E
Read more

Rain Sensor and Raindrop Detection Module: Arduino Guide

April 1, 2026 0
A rain sensor module detects the presence of water droplets on its surface, giving Arduino a simple signal to trigger... Continue reading
Svg%3E
Read more

LiDAR Sensor TFmini: Distance Measurement Beyond Ultrasonic

April 1, 2026 0
When ultrasonic sensors hit their limits — range too short, accuracy too coarse, outdoor sunlight causing interference — LiDAR sensors... Continue reading
Svg%3E
Read more

Pressure Sensor BMP280: Weather Station and Altitude Meter

April 1, 2026 0
The BMP280 barometric pressure sensor by Bosch measures atmospheric pressure with ±1 hPa accuracy and temperature with ±1°C precision. These... 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