Solar water pump dry-run protector
Build it step by step
0 of 8 doneSet the buck output
Adjust the LM2596 to 5.0 V with a meter.
Wire the current sensor
Put its terminals in series with the pump.
Test with a small load
Use a 12 V bulb and read the current on the LCD.
Measure the pump with water
Note the running current.
Measure it dry briefly
In a safe setup note the lower current.
Set LOW_AMPS
Pick a value in between.
Test the float
Lift it and see the pump stop.
Install with a fuse
Mount in a dry box with a fuse on the supply.
How do you build a solar water pump dry-run protector?
A controller measures the pump's current and the well's water level, and stops a solar pump before it runs dry or stalls. You need Arduino Nano, ACS712 current sensor module (5 A / 20 A / 30 A), Float switch (vertical), Relay Module 5V, 16x2 LCD with I2C backpack (PCF8574) and LM2596 Buck Module. It takes 8 steps and about 180 minutes.
- Level
- Advanced
- Time
- About 180 min
- Parts
- 6
Parts list
- Development BoardsBuyArduino Nano × 1
- SensorsBuy
- SensorsBuy
- InterfacesBuyRelay Module 5V × 1
- DisplaysBuy
- PowerBuy
Tick what you already own. It saves to My Garage, so “Build with what I have” knows.
Wiring
| From | To | Why |
|---|---|---|
| Supply + (12 V from the solar system) | LM2596 IN+ and relay COM | Buck input and pump supply |
| Supply - | LM2596 IN-, ACS712 path return and pump - | Common return |
| LM2596 OUT+ | Nano 5V pin, ACS712 VCC and relay VCC | Set to 5.0 V with a meter first |
| LM2596 OUT- | Nano GND, ACS712 GND and relay GND | Ground |
| Relay NO | ACS712 IP+ terminal | Pump current path in |
| ACS712 IP- terminal | Pump + | Pump current path out |
| ACS712 OUT | Nano A0 | Current signal, 185 mV per amp on the 5 A version |
| Relay IN | Nano D7 | Pump control |
| Float switch | Nano D2 and GND | Closed when the water level is high enough |
| LCD I2C SDA and SCL | Nano A4 and A5 | Display |
Code
A pump that loses its water runs lighter and hotter and its seals can burn out in minutes, so the controller watches two signs: the float switch in the well (closed while the water is high enough) and the pump current. A dry pump draws noticeably less current than a pump moving water. To set LOW_AMPS, first run the pump in water and note the current, then briefly run it dry in a safe setup and note that lower figure, and pick a value between the two; the controller waits 10 seconds below it, stops the pump, and tries again after 30 minutes. Use the ACS712 version (5, 20 or 30 A) that suits the pump, and use a relay rated for the pump's current. This is a low-voltage DC design for a 12 V solar pump; keep it wired with proper fuses and thick cable. Arduino IDE, board "Arduino Nano" (processor ATmega328P, or ATmega328P (Old Bootloader) for clones).
Runs on a virtual Arduino Nano in your browser, with sliders for the sensors. Happy with it? Verify and upload to your real board from the same page (Chrome or Edge on a computer).
// Library: LiquidCrystal_I2C. ACS712 5 A: 185 mV per amp, output 2.5 V at zero current.
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);
const byte CURRENT = A0, FLOAT_PIN = 2, RELAY = 7;
const bool ACTIVE_LOW = true;
const float LOW_AMPS = 0.8; // between dry and wet running current, set after measuring
const unsigned long DRY_TIME_MS = 10000; // low current this long means dry running
const unsigned long RETRY_MS = 30UL * 60 * 1000; // wait before trying again
enum State { RUN, WAIT };
State state = RUN;
float zeroV = 2.5;
unsigned long lowSince = 0, waitStart = 0, runMs = 0, lastTick = 0;
void pump(bool on) { digitalWrite(RELAY, (on == ACTIVE_LOW) ? LOW : HIGH); }
float readAmps() {
long s = 0;
for (int i = 0; i < 64; i++) { s += analogRead(CURRENT); delayMicroseconds(300); }
float v = (s / 64.0) * 5.0 / 1023.0;
return fabs(v - zeroV) / 0.185;
}
void setup() {
Serial.begin(9600);
pinMode(FLOAT_PIN, INPUT_PULLUP);
pinMode(RELAY, OUTPUT); pump(false);
lcd.init(); lcd.backlight();
delay(500);
long s = 0; // calibrate zero with the pump off
for (int i = 0; i < 200; i++) { s += analogRead(CURRENT); delay(2); }
zeroV = (s / 200.0) * 5.0 / 1023.0;
lastTick = millis();
}
void loop() {
bool waterOk = (digitalRead(FLOAT_PIN) == LOW);
unsigned long now = millis();
float a = 0;
if (state == RUN) {
if (waterOk) {
pump(true);
delay(1500); // let the starting surge pass before judging
}
if (!waterOk) { pump(false); state = WAIT; waitStart = now; }
else {
a = readAmps();
runMs += now - lastTick;
if (a < LOW_AMPS) { if (lowSince == 0) lowSince = now; if (now - lowSince > DRY_TIME_MS) { pump(false); state = WAIT; waitStart = now; lowSince = 0; } }
else lowSince = 0;
}
} else if (now - waitStart > RETRY_MS && waterOk) {
state = RUN; lowSince = 0;
}
lastTick = now;
lcd.setCursor(0, 0);
lcd.print(state == RUN ? "Run " : "Wait "); lcd.print(a, 1); lcd.print("A ");
lcd.setCursor(0, 1);
lcd.print("Today "); lcd.print(runMs / 60000UL); lcd.print(" min ");
Serial.println(a);
delay(500);
}What the serial monitor should show
Open the serial monitor at the baud rate in the code. This is what our simulator prints for a virtual Arduino Nano with its sensors at their default values. Your numbers will follow your real readings, but the format should match.
0.00
Test checklist
What you should see at each check. If a reading is far off, stop and use the troubleshooting list.
| Check | Expected |
|---|---|
| Pump in water | Normal current and runs |
| Pump dry | Lower current and stops after 10 seconds |
| Float lifted | Stops at once |
| After 30 minutes | Tries again if the float is ok |
If it does not work
Current reads about zero with the pump on
Check the sensor is in series and wired correctly.
Pump stops while pumping
LOW_AMPS is too high; lower it.
Reading drifts
Recalibrate the zero with the pump off.
Relay chatters
Check the supply voltage with the pump running.
Still stuck? Find the fault step by step with your multimeter →
Common questions
What parts do I need for the solar water pump dry-run protector?
Arduino Nano, ACS712 current sensor module (5 A / 20 A / 30 A), Float switch (vertical), Relay Module 5V, 16x2 LCD with I2C backpack (PCF8574) and LM2596 Buck Module.
How long does the solar water pump dry-run protector take to build?
About 180 minutes for a advanced maker, in 8 steps.
How do I know the solar water pump dry-run protector works?
Pump in water: Normal current and runs. Pump dry: Lower current and stops after 10 seconds. Float lifted: Stops at once.
Current reads about zero with the pump on: what should I check?
Check the sensor is in series and wired correctly.
Pump stops while pumping: what should I check?
LOW_AMPS is too high; lower it.
Reading drifts: what should I check?
Recalibrate the zero with the pump off.
Relay chatters: what should I check?
Check the supply voltage with the pump running.
