transfering water from a slow syphon into my water tank

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 :slight_smile:

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!

SANY0020.JPG

WaterLevelSensorParts.jpg

SANY0010.JPG

SANY0012.JPG

Solar_Charging_and_Pump_ControllerDEBUG.ino (3.82 KB)

if ( water level is less than 4" from sensor )
{
pump OFF
}
else
{
if ( water is more than 7" from sensor )
{
pump ON
}
}

okay?

Hi GoForSmoke, thanks for that but...

I can't quite get it through my head.

you said:

if ( water level is less than 4" from sensor )
{
pump OFF
}

I may not have been clear...the IR sensor is in the cap of the jerry can, looking down. I need to empty the can into my big tank located uphill every time the Jcan fills. So when the water level is less than 4" from sensor the status of the container is FULL. OK, so I'll turn the pump on then. Right?

Now it must run until the Distance is 7 and shut off:

else
{
if (water is more than 7" from sensor)
{
pump OFF
}
}

So, thinking through a cycle, starting out empty and filling:

Water distance > 7" so pump is off,
Water trickles in and the can fills, it gets to 6"... Thats what I don't understand...what happens in this case? Will it fill until it gets to less than 4 inches? It is no longer more than 7"...so what happens? Nothing? it just skips over and loops until one of the if else conditions is met? That would great! I'll try it.

I know this is basic stuff and really sometimes I do pretty good but the more I thought about this one the more I was chasing my tail. Thanks GFS

Water trickles in and the can fills, it gets to 6"... Thats what I don't understand...what happens in this case?

You do nothing.

if ( water level is less than 4" from sensor )
{
pump OFF
}
else if ( water is more than 7" from sensor )
{
pump ON
}
else
** {**
** DO NOTHING**
** }**

"Do nothing" is not the same thing as turning the pump on or off. It is leaving it in the same state it was.

I'm writing to wrap up this in case someone like me and in need stumbles upon it. Great moments in programming logic: DO NOTHING!

I had it lodged in my gob that I HAD to tell the pump to DO NOTHING when I did not want it to pump. Now I get it... I, the Programmer, had to do nothing. Once the instructions were given to turn on in case 1 and off in case 2, there was no need for further instruction.

It is now controlling an LED in responce to water level, but will "harden" the system and install the pump...I am happy to work with someone who might have a similar application and similar "low-tech" background as me. Big relief to have steady, albeit slow, water when the rains fail.

Thanks to the usual suspects, GFS and Nick for your indulgence!