Arduino water level gauge

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.


14 Comments »

  1. Nahum Wild Says :
    28 December, 2009 at 5:23 pm


    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.

  2. John Says :
    28 December, 2009 at 7:10 pm


    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.

  3. Anton Says :
    23 January, 2010 at 8:00 pm


    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.

  4. John Says :
    23 January, 2010 at 8:36 pm


    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

  5. Bruno Says :
    28 March, 2010 at 2:17 am


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

  6. John Says :
    15 April, 2010 at 9:26 am


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

  7. Raathigeshan Says :
    10 June, 2010 at 3:27 pm


    Simply Superb !

  8. Marcel Says :
    22 December, 2010 at 1:12 pm


    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.

  9. Terry King Says :
    9 March, 2011 at 8:16 pm


    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

  10. Lifeboat Farm » The finished Arduino wireless water sensor Says :
    20 June, 2011 at 11:22 pm


    [...] 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 [...]

  11. Rob Smith Says :
    29 August, 2011 at 11:04 am


    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)

  12. Anonymous Says :
    23 November, 2011 at 6:30 pm


    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.

  13. Nick Says :
    1 December, 2011 at 9:21 am


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

  14. Howard Says :
    27 August, 2012 at 3:34 am


    I came across your website while trying to find an old article on how to make a capacitive water level sensor for a pond monitor. I then came across the following article http://www.parallax.com/Portals/0/Downloads/docs/cols/nv/vol1/col/nv27.pdf that I thought would really be useful to your project. It uses a basic stamp but should be easily adaptable to the arduino. I would probably use a pvc pipe within a pipe. Put copper tape on the outside of the inner pipe which will have the water inside of it. Seal between the outer and inner pipes to keep the tape etc dry. Any capacitively trim-able oscillator would work. You could also select a frequency somewhere in the FM band put an antenna on it and tune your stereo to it. The tone will tell you what the water level is ;)

Leave a Comment