Water Tank Depth Sensor

Water is a precious resource in many parts of the world, and many people rely on water tanks to supplement their water supply by storing collected rainwater or water pumped from a well or bore. But how do you measure how full a tank is? Tanks are constructed of opaque material to prevent algae growth and often kept closed up to prevent mosquito infestation or access by small rodents so it's inconvenient to physically look inside. And besides, having a way to measure tank depth electronically opens up a world of possibilities such as automatic control of pumps to top up tanks when they get low or to disable irrigation systems when not enough water is available.

The obvious way to measure tank depth is by placing a series of conductive pickups at various heights inside the tank and measure the resistance between them. For example, placing ten exposed terminals at equal intervals attached to a length of material such as PVC tubing and inserting it into the tank will allow you to measure the depth in 10% increments by reading the resistance between the bottom terminal and each of the terminals above it. The downside to this approach though is that you'll need to do a lot of wiring and you'll also need to read an analogue input for every individual terminal - while most Arduino designs have no more than 6 analogue inputs.

This project works a little differently. It uses a device called a differential pressure transducer to measure the water pressure at the bottom of the tank, and from that to calculate how full the tank is. Water pressure increases by about 9.8067kPa per meter of depth so a full tank 2m tall will have a pressure at the bottom of about 19.6134kPa above ambient atmospheric pressure. The "above ambient atmospheric pressure" part is important: it's not enough to simply measure the pressure at the bottom of the tank because varying climate conditions will alter the reading. That's why this project uses a "differential" pressure transducer that has two inlets. By leaving one inlet open to the atmosphere and connecting the other to the bottom of the tank the transducer will output the difference between the two, automatically compensating for varying air pressure and giving a constant reading for constant depth.

The Arduino then reads the output of the transducer and reports the depth of the tank. In this project we will use an Ethernet shield to have the Arduino connect to an online datalogging service called Pachube to generate graphs of water depth over time, but you could also have it make decisions on the basis of the reading to control items such as a water pump or irrigation system solenoid.

Water Tank Depth Sensor Schematic

Download as JPG: water-tank-depth-sensor-schematic.jpg

Download as PDF: water-tank-depth-sensor-schematic.pdf

Download as SCH: water-tank-depth-sensor-schematic.sch

Source Code

github.com/practicalarduino/WaterTankDepthSensor

Resources

MPX2010DP pressure transducer datasheet: pdf1.alldatasheet.com/datasheet-pdf/view/86195/MOTOROLA/MPX2010DP.html

MPX2053DP pressure transducer datasheet: pdf1.alldatasheet.com/datasheet-pdf/view/93834/MOTOROLA/MPX2053DP.html

LM324 op-amp datasheet: www.national.com/mpf/LM/LM324.html#Documents

Errata

If you find a mistake in this project please let us know.

A couple of people have kindly taken the time to write concerned about water coming into contact with the pressure sensor. They raise an important issue as the sensor is only rated for "dry" use. In hindsight we could have spelled it out better and/or added a diagram, but the intention is that there is always a column of air, even if just a short one, between the water and the sensor itself. Thus the sensor doesn't come directly into contact with water.

100nF capacitor missing from schematic. The explanatory text, the parts list, and the construction photos all show a 100nF capacitor next to the 10K trimpot, but it's not shown anywhere on the schematic. The capacitor connects directly between GND and 5V, and helps smooth out the power supply for the op-amp to reduce "noise" in the readings.

Gallery

Have you built this project or something inspired by it? Please let us know and we'll put a picture of it here!