October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
Bettesworth Construction
automation

IoT-Based Water Level Controller Using ESP32 and Blynk

A practical design for an ESP32 water-level controller that keeps pump decisions local while Blynk provides telemetry and optional remote control.

By Bettesworth Construction Team 6 min read
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

An ESP32 water-level controller should make the pump decision locally, then use Blynk to display the level, report pump state and accept optional remote commands. That arrangement keeps automatic filling available when Wi‑Fi or Blynk.Cloud is unavailable. The ESP32 reads a sensor, applies high- and low-level rules, and drives a pump-rated switching stage; Blynk is the monitoring and remote-control layer.

How the controller works

The practical signal path is:

Level sensor → ESP32 → local control and safety logic → relay or suitable driver → pump

In parallel, the ESP32 sends measurements and device state to Blynk through datastreams. A virtual pin is a hardware-independent channel: one can carry the measured level, another the pump state, and a third a manual command or operating-mode value. The cloud connection is useful for visibility and remote intervention, but it should not be required for the immediate threshold response.

Choose the sensing method for the tank

There is no universally best sensor. Tank shape, mounting position, condensation, fouling, wiring access and the consequence of a missed reading determine the appropriate choice.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Sale
Luubom Automatic Water Level Controller System for Tank, Well & Cistern
  • ACTIVE PUMP CONTROL & AUTO WATER FILLING: Unlike basic monitors that only detect water levels, the Luubom automatic water level controller actively manages your pump. It automatically refills your tank, well, or cistern when low and shuts off when full, preventing water shortages and eliminating wasted electricity from forgotten pumps.
  • SMART DRY-RUN PROTECTION FOR MOTOR SAFETY: Protect your expensive water pump from costly burnouts. Our intelligent system automatically cuts power if the water source runs dry. This reliable safety feature prevents motor damage, significantly extends your pump's lifespan, and provides complete peace of mind for unattended operations.
  • 3KM WIRELESS RANGE & SOLAR-POWERED SENSOR: Enjoy maintenance-free remote control with a robust wireless signal reaching up to 3km (1.86 miles) in open areas. The outdoor liquid level sensor is fully solar-powered with auto-charging technology, eliminating the hassle of battery replacements for remote tanks, pools, or agricultural irrigation.
  • INTUITIVE DIGITAL DISPLAY & 9-IN-1 FUNCTIONS: Stay informed with a clear indoor digital display showing real-time water levels. This versatile system features 9 smart functions, including auto-fill, timed water supply, manual control, and low-battery alarms. Perfect for home water systems, RVs, livestock troughs, and water towers.
  • WIDE COMPATIBILITY & EXPANDABLE SENSOR RANGE: Works seamlessly with most single-phase pumps up to 5kW (40A, 75V-400V AC). Includes a 2.9m antenna and 1.8m sensor wire. Need a longer reach? Easily customize the detection length for deep tanks by adding a Luubom Extension Cable (Search 'Luubom Extension Cable' on Amazon).
Approach What it measures Advantages Design concerns
Ultrasonic distance sensor Distance from the sensor to the water surface Continuous measurement and a percentage display are possible Needs a stable overhead mount; condensation, turbulence, foam and an unsuitable echo path can produce implausible readings
Float or level switch A discrete level at the switch location Simple high/low control and straightforward fault checking Does not provide a continuous percentage without additional switches or another sensor; moving parts and mounting require inspection

A 2025 conference paper, “Implementation of an Internet of Things (IoT) Based Water Level Monitoring System Using Ultrasonic Sensors and the Blynk Application,” documents one example using an ESP32, HC-SR04 ultrasonic sensor, relay module and Blynk. That is an implementation example, not evidence that every HC-SR04 clone or relay board is suitable for every tank.

Parts and electrical checks

  • ESP32 development board with Wi‑Fi.
  • A level sensor selected for the tank and environment. The HC-SR04 is one documented example.
  • A relay module or other driver rated for the pump’s voltage, running current, starting current and switching type.
  • Power supplies appropriate to the ESP32, sensor and pump circuits. Do not assume one supply arrangement fits every installation.
  • Enclosure, strain relief, fusing and wiring suitable for the location and the pump circuit.

Protect the ESP32 input

Espressif’s ESP32 Series Datasheet v5.3 lists 3.6 V as the absolute maximum input voltage. This is a stress limit, not a recommended operating target. Check the exact ESP32 board, sensor module and level-shifter requirements before connecting a signal. The electrical output of HC-SR04 modules is not identical across every clone, so verify the particular unit or add appropriate level shifting or conditioning.

Match the pump interface

A relay symbol in a tutorial does not establish that its contacts, isolation, coil supply or PCB clearances are appropriate for your pump. Compare the pump’s voltage, current, inrush, AC or DC switching requirements and protective components with the switching device’s ratings. Mains wiring should be installed and tested by a qualified person in accordance with local requirements.

Rank #2
12V DC Water Level Controller Module, Anti Interference PCB Board
  • ➤【SUPPORT FUNCTION】-- Water level sensor controller, supports automatic water pumping, filling and draining. With a small, simple wiring
  • ➤【WATER LEVEL DETECT】-- According to water level of the detection pool (water tower), the high‑current relay is controlled to realize the control
  • ➤【ANTI‑INTERFERENCE】-- Small size, low power consumption, large switch capacity, strong anti‑interference, high functional stability
  • ➤【WORKING PRINCIPLE】-- Stable realization of when the pool (water tower) is short of water, and automatically stops when it is full
  • ➤【SIMPLE EASY WIRING】-- Using high‑quality materials, excellent performance, easy wiring, and long service life

Define the control policy before writing code

Write the behavior as a small state machine rather than letting a cloud widget directly energize the pump.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Automatic mode: start filling below the chosen low threshold and stop at the high threshold.
  • Manual mode: accept a Blynk command only within the safety rules you define.
  • Sensor fault: treat missing, out-of-range or contradictory readings as a fault and choose a safe output, commonly pump off.
  • Startup: initialize the output to a known safe state before the first measurement.
  • Maximum runtime: stop the pump after a defined duration if the expected level change does not occur.
  • Hysteresis: use separate start and stop thresholds so small measurement fluctuations do not chatter the pump.

These are firmware design decisions, not behaviors guaranteed by Blynk.

Convert distance into a meaningful level

Raw ultrasonic distance is not a universal percentage. Measure the tank’s empty reference distance and usable full reference distance from the installed sensor, then map the current distance between those points. In a simplified installation:

Rank #3
Water Level Sensor Control Relay 10A GRL8-01 AC/DC 24V-240V Liquid Level Control Relay in Din Rail, Automatic Drain and Inlet Electronic Liquid Level Controller with 5ft Detector Sensor PLT-01
  • FUNCTION & APPLICATION : grl8-01 water level controller liquid level relay, with 5ft detector sensor PLT, a wide operating voltage of AC/DC 24-240V (50-60Hz), and a rated current of 10A. Sensitivity 5-100kΩ, maximum and minimum water level monitoring and control. By connecting electric ball valves, water pumps, and controllers, it can realize automatic water supply and drainage in fish ponds, reservoirs, swimming pools, water tanks, etc.
  • INDICATOR BUTTON : grl8 01 ac dc 24-240v adjustable liquid level relay working status is indicated by LED indicator: power indicator: green LED (constantly on means the input power terminal is normal). Take the relay connected to the water pump as an example. When the water level in the container is higher than the highest probe position, the red indicator light is on, the connected water pump starts to drain, and the water level drops; when the water level is lower than the lowest probe position, the red indicator light goes out, and the connected water pump starts to supply water. This cycle ensures that the water level is within the normal safety range
  • COMPACT AND EASY TO INSTALL: grl8 01 liquid level control relay dimensions are dimensions: 90 x 18 x 64mm/3.5 x 0.7 x 2.5 inches, mounted on 35mm DIN rail, 3.8 ounces, easy to install, portable and compact, electrical components supporting this standard can be easily clipped on the rail, no screws required, maintenance is also very convenient
  • CHOICE MATERIALS : grl8 01 level relay relay made of industrial grade plastic , compliant with , CE, CB, RoHS standards, flame retardant, relay switch has a sealing ring that can isolate dust and oxygen, and can work stably in humid environments to protect your expensive equipment
  • WORRY FREE AFTER-SALES SERVICE: We provides a 30 day no reason return and a 3-year warranty for this product. If you have any questions about installation or use, or if you encounter any problems during use, please feel free to reach up to us at any time, watch the video and instructions before operation, which can better help you use the grl8 01 relay

levelPercent = (emptyDistance - measuredDistance) / (emptyDistance - fullDistance) × 100

Clamp the result to 0–100 percent and reject readings outside the physically possible range. Keep the physical reference points in the firmware configuration; do not copy dimensions from a different tank. A float switch can instead expose states such as low, normal and high without pretending to know a continuous percentage.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Build the Blynk dashboard

  1. Create a Blynk template and the device credentials required by your ESP32 firmware.
  2. Create a datastream for measured level, such as a virtual pin used by a numeric display or gauge.
  3. Create a separate datastream for pump state so the dashboard reports what the controller actually believes the output is doing.
  4. Add a command datastream for manual control and, if needed, another for automatic/manual mode.
  5. Set a sensible update interval. Blynk recommends event-based sends or timers rather than sending on every pass through loop(); excessive messages can disconnect the hardware from the cloud.

Blynk’s hardware documentation also advises proving the sensor locally first: “If you can’t get readings from the sensor without Blynk, you won’t be able to move further.” The sensor value should be timestamped and sent through a datastream to Blynk.Cloud, where the app can display it.

Rank #4
Roamoris Automatic Water Level Controller,Liquid Level Sensor ,Auto 110V Pump Float Switch Relay ,Pump Control with 6.5ft Detector,4 Modes NC01
  • 【4 Modes】Water Supply Mode,Drain Mode,Lack Water Stop Mode,Joint Mode.
  • 【110V-120V】The water level controller can be used for the 110v solenoid valve, electric ball valve, water pump to use with the controller.The load current of the controller is 10A.
  • 【Stainless Steel Detector with 6.5ft Wires】Corrosion, no rust, suitable for long-time use.
  • 【Application】This pump controller can help you realize the automatic water supply and drainage of fish ponds, reservoirs, swimming pools, and water tanks.
  • 【Noitce】Before installation, please make sure you have electrical knowledge. If you have questions about product use, please contact us.

Handle virtual-pin commands deliberately

When a widget changes, Blynk delivers the value to a firmware callback. The callback should update a requested command or mode; the main control logic should still enforce sensor faults, maximum runtime and any dry-run or overflow protections. Some relay boards are active-low, meaning a logic LOW energizes the relay. Verify the selected board and define the firmware’s ON/OFF mapping accordingly.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Firmware structure

Use separate timed tasks for measurement, control and telemetry. The following is a design outline rather than a drop-in program; pin numbers, Blynk credentials, thresholds and relay polarity must be adapted to the actual hardware.

setup:
  configure sensor pins
  configure pump output
  force pump output to SAFE_OFF
  start serial diagnostics
  connect Wi-Fi/Blynk without blocking local control

repeated tasks:
  every measurement interval:
    reading = read_sensor()
    if reading is invalid or outside calibrated range:
      sensorFault = true
    else:
      sensorFault = false
      level = convert_to_percent(reading)

  every control interval:
    if sensorFault or runtime_exceeded:
      pump = OFF
    else if mode == AUTOMATIC:
      if level <= LOW_THRESHOLD: pump = ON
      if level >= HIGH_THRESHOLD: pump = OFF
    else:
      pump = manualRequest subject to safety rules

  every telemetry interval:
    send level, pump state, mode and fault state to Blynk

Keep the local control task independent of successful cloud sends. If Wi‑Fi drops, the controller should continue measuring and applying its local policy; only reporting and remote commands become unavailable.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
DIYables Water Sensor Detector for Arduino, ESP32, ESP8266, Raspberry Pi, 5 Pieces
  • Used to detect the presence of water, water leakage
  • Used to measure the water level
  • Supply voltage: 3.3 - 5V DC. Current consumption: less than 20mA
  • Water sensor for Arduino, ESP32, ESP8266, Raspberry Pi, or any 5V or 3.3V microcontroller.
  • Tutorials for Arduino, ESP32, ESP8266 and Raspberry Pi are provided => search for: DIYables Water Sensor

Commission the system in the right order

  1. Bench-test the ESP32 and sensor without Blynk. Print raw readings, verify the empty and full reference positions and confirm invalid-reading handling.
  2. Test the output without the pump connected. Confirm startup is off, automatic thresholds have hysteresis and the relay’s active-high or active-low behavior is correct.
  3. Test with a safe substitute load. Observe the complete start/stop sequence and maximum-runtime timeout.
  4. Install the sensor and repeat calibration in the real tank. Check turbulence, condensation, obstructions and the sensor’s mechanical stability.
  5. Add Blynk telemetry. Confirm level, pump state and fault state update at the chosen interval without flooding the connection.
  6. Add remote commands last. Disconnect Wi‑Fi and verify local operation, then reconnect and test that manual commands cannot bypass the safety policy.

Common failure modes

The level is wrong or jumps

Check sensor alignment, reference distances, surface turbulence, condensation and wiring. Reject implausible samples and consider requiring several consistent readings before changing state.

The pump runs continuously

Verify threshold order, hysteresis, sensor-fault policy, runtime timeout and relay polarity. A dashboard value alone must not be treated as proof that the physical pump is on or off.

Blynk disconnects

Reduce telemetry frequency and use a timer or event-based update. Confirm Wi‑Fi credentials and keep control logic non-blocking so cloud communication cannot starve safety checks.

The ESP32 resets or reads unstable values

Inspect supply capacity, grounding, relay noise and separation between pump wiring and sensor lines. Confirm that no sensor signal exceeds the board’s permitted input range.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What a robust design reports

Expose more than a single percentage gauge. A useful dashboard includes measured level, pump state, automatic/manual mode, sensor-fault state and, where implemented, a runtime or timeout indication. This lets an operator distinguish “tank low,” “pump commanded on,” “sensor fault” and “cloud unavailable” instead of treating them as the same condition.

The Bottom Line

Build the ESP32 as a self-contained local controller and use Blynk for measured data, status and carefully constrained remote commands. Calibrate the sensor in the actual tank, protect ESP32 inputs, select switching hardware for the real pump load and test every safety state before connecting the pump.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

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

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Site Office

Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.