We are starting to have more frequent droughts. We use rainwater to fill a 20k liter tank but in the summer that is no longer enough to get us through to spring wet season. My neighbor allows me to tap into his spring some 600 meters away. It will just siphon onto my property line at a rate of about 1 liter per minute through 20 mm black plastic pipe.
I dug a hole and put a plastic jerry can to collect some 20 liters at a time. I found a really cool distance sensor project (1-Wire Water Level Measurement Sensor), copied it with mods and it works…uses a Sharp IR sensor, a length of PVC and a reflective float. The pvc was just right to snugly press fit into a recess in the jerry can cap.
A 24 v 190 Watt PV panel is located just up the hill, drives a 90 volt 2 amp piston pump (runs at just the right rate when connected to the panel or the 24 Volt battery (2 X 12V truck batteries).
It might sound silly to use a 90VDC pump on a 24 panel but it only draws about 0.3 amp under load and it trickles uphill about 15 feet vertical, 30 yard horizontal distance just the right rate. And it is paid for
I’ve built a battery charger based on fig 2 of Arduino Solar Battery Charge Controller. the idea is to use the batteries to run the pump 24/7 instead of just during daylight by direct pump to Panel connection. The batteries are huge (450 X 200 X 200 mm each, 2 X 12 V in series).
Soooo, here is my problem: I am not good at logic. I need the pump to turn on when the level is 4 inches from sensor and turn off when 7 inches from sensor. I tried using this:
If Distance (from sensor to float) < 4 (inches) && Distance >> 7 inches then turn on pump. But of course that is true as soon as a little water siphons into the jerry can and the pump just turns on/off too rapidly.
My sketch is “in progress” but I’ve attached in case it is helpful. It is my typical hack job of the work of others. Also, I am using a spare Jeenode V6 instead of an Uno.
Please suggest some code to cycle this system to capture the trickle of water efficiently, Thanks!