
Most houses in Nepal have the same setup: an underground sump (or a boring) and a tank on the roof. Someone has to remember to switch the pump on, and then remember to switch it off. This controller does both. More importantly, it protects the pump, because a motor running dry or against a closed valve burns out fast.
Protections:
| Problem | What the controller does |
|---|---|
| Sump runs dry | Stops the pump. Waits 5 min after water returns before trying again. |
| Pump runs 10 min and the level doesn't move (airlock, broken pipe, closed valve) | Stops and latches NO RISE until someone presses the button. |
| Pump runs 45 min non-stop | Stops and latches MAX RUN TIME. |
| Impossible probe pattern (75 % wet but 50 % dry) | Stops and latches PROBE ERROR. Usually a broken probe wire. |
| Restart too soon | Waits at least 60 s between starts, to protect the motor and contactor. |
| Waves and splashes | Every probe change must hold for 2 s before it counts. |
| File | What it is |
|---|---|
firmware/water_level_controller/water_level_controller.ino | Firmware |
firmware/build/water_level_controller.hex | Real-time build |
firmware/build/water_level_controller_sim_x10.hex | Long timers 10x faster, for Proteus demos |
test/sim_test.c | Automatic bench test (simavr) |
I can't produce the .pdsprj from this machine, but the circuit only takes about 10 minutes to draw:
ARDUINO UNO (or ARDUINO UNO R3), LM016L (16x2 LCD), RELAY, BUZZER, LED-GREEN + RES 220R, SW-SPDT × 6 (5 probes + AUTO/MANUAL) and BUTTON × 1.images/wiring.png. Each probe is a switch from the pin to GND (closed = water). LCD: RS = A0, E = A1, D4 to D7 = A2 to A5, RW to GND, VSS to GND, VDD to +5 V.firmware/build/water_level_controller_sim_x10.hex. Set the clock to 16 MHz.Save it as proteus/water-level-controller.pdsprj and commit it.
tools/test_all.shThe test fills and drains the tank, checks the splash filter, hysteresis, dry-run stop and the 5-minute restart delay, the no-rise fault and its latch, button reset, the probe fault and manual mode.