Water is a precious resource and it is highly important today that we conserve it. This project is a small step in that direction. The system will stop a pump pumping water from a ground level reservoir or pit to an overhead tank(OHT) once the OHT is full. The system will also monitor the water level of the OHT and the reservoir and won't let the pump run if the reservoir level is lower than a specified level.
Water level is sensed with the use of magnetic float switches. Three switches each are used in the reservoir and the OHT for three different water levels (full, mid, low). The magnetic switches are fitted with a brass weight at the bottom to keep them in position, so that rushing water from the pump outlet does not sway them out of position. The switches are installed in such a way that when the float rises, it closes the switch. The reverse can also be done, with a minor modification in the code.
A bypass switch is provided, so that if the system malfunctions, the pump can be run.
I have not used an arduino board here. I have used an Atmega8a with Arduino Bootloader. The Atmega8a board option is from MCUdude of Github.




🛠️ เจาะลึกเบื้องหลังการทำงาน (Deep Dive / Technical Analysis)
Turning on a tiny $2 DC fish-tank pump is easy. Automatically managing an enormous 1-Horsepower AC centrifugal pump that draws 1500 Watts to fill a towering 500-gallon roof tank requires bulletproof fail-safes. The Water Pump Controller project introduces terrifying physical danger: If the logic loop fails, a massive commercial pump runs completely dry, violently melts its own impeller shaft, catches fire, and floods the house!
The Dual Float-Switch Hysteresis Check
You cannot use a generic analog depth sensor. You must use massive, physical Magnetic Reed Float Switches installed at the absolute Top and Bottom of the 500-gallon tank.
FloatTop (Pin 2): Detects if the tank is overflowing!FloatBottom (Pin 3): Detects if the tank is bone dry!- The Catastrophic Wave Error: If you just code
if (FloatTop == LOW) { turnOffPump(); }, you will fail instantly! When water reaches the top, the splashing waves will bounce the float up and down rapidly! The 1-HP AC motor will violently flicker ON and OFF 10 times a second, instantly destroying the electrical contactor! - The Hysteresis Dead-Band Trap:
if (digitalRead(FloatBottom) == HIGH) {
// Tank is totally empty! Turn it on!
digitalWrite(PumpRelay, HIGH);
pumpIsRunning = true;
}
// Do absolutely NOTHING until the water hits the very top limit!
if (digitalRead(FloatTop) == HIGH && pumpIsRunning == true) {
// Tank is entirely full!
digitalWrite(PumpRelay, LOW); // Kill power!
pumpIsRunning = false;
}
The "Dry Run" Failsafe Timer
Even with perfect floats, what if the municipal water supply is shut off down the street?
- The Arduino initiates the
PumpRelay! Water should be entering! - The C++ code starts a massive
unsigned long safetyTimer = millis();. - If 20 minutes go by, and
FloatTopis STILL not triggered, the Uno realizes there is NO WATER in the pipes! - It violently overrides the entire system, killing the Heavy Relay, blasting a Piezo Siren, and locking out the interface until human intervention!
High Voltage AC Pumping Setup
- Arduino Uno/Nano (Standard execution speeds).
- Two Physical Magnetic/Mechanical Float Switches.
- Heavy Duty 30A AC Contactor Relay or Solid State Relay (SSR) (A tiny blue 10A Arduino relay will literally melt and fuse shut on a 1-HP AC pump motor surge!).
- Standard 16x2 LCD for telemetry and system lockout feedback.
- (DANGER: Lethal Mains Voltage! Never run the 110V/220V lines anywhere near the water tank float switches. The float switches must be grounded exclusively through the safe 5V Arduino logic pins!).