Ultrasonic-Based Water Level Detection and Automatic Pump Controller
This project is an Automatic Water Level Monitoring and Pump Control System designed to provide a reliable and efficient way of managing water inside a storage tank. It uses an HC-SR04 Ultrasonic Sensor, which is mounted at the top of the tank facing downward. The ultrasonic sensor measures the distance between the sensor and the water surface using sound waves. When sound waves are sent out, they bounce off the water and return to the sensor, allowing the system to calculate how much water is in the tank. As the water level rises, the distance measured by the sensor becomes smaller; as the water level drops, the distance becomes larger. This real-time measurement is converted into the actual water level from the bottom of the tank. Based on the measured level, the system uses a set of programmed thresholds to control a water pump automatically: Red LED (Low Level) – Lights up when the water level is low, and the pump turns ON to start filling the tank. Yellow LED (Medium Level) – Indicates that the tank is partially filled. Green LED (Full Level) – Shows that the water level is high (equal to or below 10 cm from the bottom), and the pump automatically turns OFF to prevent overflow. This solution helps avoid dry running of the pump, prevents overflow, saves electricity, and improves overall water management. It is especially useful for homes, farms, schools, hostels, hotels, factories, and any environment where water storage tanks are used. By combining Arduino technology, ultrasonic sensing, and relay-based pump control, this project delivers a smart, safe, and automated approach to water level monitoring.

The Water Level Monitoring and Pump Control System is designed to automatically track the amount of water in a tank using an HC-SR04 ultrasonic sensor. The system continuously measures the distance from the top of the tank to the water surface, converts this distance into a water level reading, and then controls a water pump based on preset thresholds.
The ultrasonic sensor works by emitting a short burst of high-frequency sound waves. These waves travel through the air, hit the water surface, and bounce back to the sensor. By measuring the time it takes for the sound to return, the system calculates the distance to the water. This method is safe, accurate, and does not require any physical contact with the water.
Using this distance reading, the system determines whether the tank is low, medium, or full. It communicates the tank status through three LED indicators (Red, Yellow, and Green) and automatically switches the pump ON or OFF using a relay module. This ensures efficient water usage, prevents pump damage due to dry running, and avoids tank overflow.
The system provides a smart and reliable solution for water management in households, schools, farms, and industrial environments.
This project is built using simple but highly reliable electronic components that work together to create an efficient water level monitoring and pump control system. Each component plays a unique role in ensuring accurate measurement, safe pump operation, and clear visual feedback.
1. Arduino Nano
The Arduino Nano serves as the main controller of the system. It processes the readings from the ultrasonic sensor, applies the logic for water level detection, and activates the appropriate LEDs and the pump relay. Its compact size makes it suitable for small control boxes and embedded installations.
2. HC-SR04 Ultrasonic Sensor
This sensor is responsible for measuring the distance between the top of the tank and the water surface.
It operates by sending out ultrasonic waves (40 kHz) and detecting the echo when the waves bounce back. The sensor calculates the distance based on the time taken for the echo to return. It is accurate, inexpensive, and ideal for non-contact water level measurement.
3. Relay Module
The relay module acts as a switch to control the water pump. Since pumps operate on high voltage and high current, the Arduino alone cannot power them directly. The relay safely isolates the pump’s electrical system and activates it only when required.
4. LEDs (Red, Yellow, Green)
Red LED: Indicates low water level and signals the pump to turn ON.
Yellow LED: Shows that the tank is at a medium level.
Green LED: Indicates that the tank is full or nearly full, and the pump is turned OFF.
These LEDs give a quick and clear visual indication of tank status, even from a distance.
5. Power Supply
Depending on the setup, the system may use:
A 5V USB adapter
A regulated 12V adapter (with onboard regulator for Arduino)
Battery power (if mobility is required)
6. Water Pump
This is the main device responsible for supplying water to the tank. The pump operates automatically based on the level thresholds programmed into the system, ensuring efficient and safe water management.
