Lifeboat Farm


Arduino water level gauge
December 28, 2009, 2:16 pm
Filed under: Technology, Water

A couple of months back I was lucky enough to win an Arduino starter kit from the folk at Mindkits. With the Christmas break upon us we’ve finally had some time to get our first project underway – a wireless water tank level gauge.

Our main water tank for the farm is out of view of the house so a visual water level gauge wouldn’t be much use. Most of the time we can only tell when the tank is empty the hard way, although I’ve added some plumbing to the tank so we always have some water in reserve.

The first task was to find a simple, robust way of physically measuring the water level. I got an idea on this blog about using a string of resistors on a pole that short out below the water level, giving you a variable resistance that can be read by the arduino. In theory, all you needed was a long enough string of resistors running down a substrate, with a return path for the current.

waterlevel_circuit

Here’s Dave with the first prototype to prove the concept – resistors soldered together and hot-glued onto a piece of polybutylene plumbing pipe. There is a piece of nichrome wire hot-glued on the back to complete the circuit.

dave_prototype

Dave and I breadboarded this prototype and it worked! By worked, I mean we got varying numbers returned by the arduino as the gauge went up and down in the water. We still had to determine if the numbers meant anything, but I felt that part of the process sat more with Dave as the software guy than me as the fabricator ๐Ÿ™‚ The arduino is the little PCB attached to the blue USB cable.

prototype_small

The next step was a full-size prototype (although it will probably become the actual gauge). Once the tank was measured I cut some aluminium channel to length and mounted a longer piece of polybutylene down the channel. 20 1k resistors got soldered together and hot-glued down the length of the pipe. This should give us 5% increments of water level. I added cable ties as a backup to the hot glue in case the water in the tank made it too brittle to stay attached. In this picture you can see the leads attached for easier testing.

prototype_mounted

The final step in the prototyping was to take the contraption outside to a water tank near the house to test and calibrate the gauge in a real situation.The resistance varied as the gauge was submerged more or less in the water. We collected values at 0%, 25%, 50% and 100% submersion and the resistance values that came back are very close to a linear relationship (close enough to assume it’s our measuring that’s out). This means we can interpolate a fairly granular level ofย  water measurement from the resistance levels returned.

prototype_in_tank

There are a few more steps in the project now:

Wireless comms – we’re looking at using the farm’s existing 802.11 wireless network to send data from the gauge approx 200m back to the house.

Solar power – the arduino will happily run on 12v DC so a small solar cell and a car battery should keep it running 24/7

Software – Dave has volunteered to write a web app to present the data in a prettier form.

Phase 2: once we’ve got the gauge running well, we can look at future features that go beyond passive monitoring like alarms based on water level, auto-starting the water pump, calculating flow rate and tripping alarms or a shut-off servo if the flow is too high for too long (indicating a pipe break) – the possibilites are endless.

Advertisements

13 Comments so far
Leave a comment

Fun stuff!

In terms of an alarm you should link it up to a twitter account that way not only can we all watch it but you’d probably get notified quick enough. Alternatively @youdo have their @beetil webapp hooked up to a rotating emergency orange light via email – it get’s triggered on each signup.

Comment by Nahum Wild

Thanks Nahum – good ideas! Will look at those for phase 2 once we nail the basics ๐Ÿ™‚ I also have a spare arduino board (probably for a 2nd water tank gauge) so any other farm automation ideas would be welcome.

Comment by John

Just a thought… you might find the voltage on the bare wires in the water causes electrolysis – after a couple of weeks the wire gets eaten away! Don’t know a way around it short of using an infrared range sensor ($15-20) or perhaps an ultrasonic one mounted on the inside roof of the tank.

Comment by Anton

Thanks Anton

We did have concerns about this too, but the very low voltage combined with a small number of very short polling “pulses” every few minutes or so, should minimise this. We can configure the polling frequency once it’s in full-time use and it might turn out to need even less pulses. If it does become a problem I’ll just call this model a prototype and figure out version 2 ๐Ÿ™‚

Cheers
John

Comment by John

Hi, can you send me the conections to the arduino?
Are you using the analog input?

Comment by Bruno

We just used one of the analog pins to measure the resistance (and the earth pin for the return).

Comment by John

Simply Superb !

Comment by Raathigeshan

Excellent! Well done.

I happened into your site whilst doing an image search for 200L plastic barrels. After a bit of poking about I found that you’re also into Arduino! Marvelous stuff eh!?

I see that the question of corrosion has already been raised here. If you find that to be a problem then you might want to consider using capacitive sensing. It would be inside the plastic tube and sealed from the elements. I’ve been playing with it for touch sensing through glass but I understand it would work for water level sensing.

Comment by Marcel

Hi,
About electrolysis: You COULD drive each end of the resistor string from a separate Aruduino output. You could quickly alternate the polarity each time you take a reading to cancel out the DC offset and possibly counteract the electrolysis.

Or maybe you could have Two external series resistors going to two analog inputs and take two readings, one with each polarity across the resistor string, see the difference, average it out??

When you’re not taking readings, you might take both ends of the resistor string to GND.

Please keep us up to date on the longterm workability of this approach!

Regards, Terry King
On The Red Sea
terry@yourduino.com

Comment by Terry King

[…] I don’t expect too many problems long term (the tank and all its fittings are plastic). The original post has photos of the array being […]

Pingback by Lifeboat Farm » The finished Arduino wireless water sensor

Neat way of doing it, but one of my concerns would be if this is for drinking water.
As I wouldnt want to put any heavy metals into the household supply (OK I know it would be minimal)

Comment by Rob Smith

Use lead-free solder if the water is used for consumption. Galvanize all metal contacts with non-oxidizing material like nickel or gold to prevent corrosion/rust.

Comment by Anonymous

I’d be curious to see what effect contaminants in the water would have on the measured resistance. Wondering if it’s possible for low levels of impurities (still safe for drinking) to upset the resistance reading to the point where the level reported is significantly out.

As mentioned previously – capacitive sensing might be something to investigate for future versions ๐Ÿ™‚

Comment by Nick




Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s



%d bloggers like this: