Water Wave/Tide/Level Meter 2.0

Ken Sheridan and I have been working on a device to accurately measure the level of water in a tank, or on a lake, river or estuary. This document details the result of this work. Thanks Ken for the write-up.

Over the years since we first posted this many people have built these circuits with varying degrees of success. I've tried to include every suggestion and improvement, but of course there are so many ways of building such a sensor that caveat buildor!

Capacitance Probe

A basic probe design.

A simple probe can be made using insulated wire. The insulation is then the dielectric of an cylindrical capacitor with the inner conductor as one plate and the water as the other. The probe is not suitable for distilled or very pure water because it is not conductive enough. It works well even in relatively clean water such as roof runoff water in a plastic tank. PVC plastic coated multistrand hookup wire will work but is porous and may eventually give trouble. Better to use the PTFE (teflon) equivalent. Enamelled copper wire gives a high capacitance per unit length because the insulation is very thin and this is suitable for short probes of up to about 200mm.

For long probes a pipe with a sliding clamp to tension a single wire works well. Keep the wire away from the pipe to avoid turbulence effects. The problem with a single wire is sealing the end under water, especially the PTFE type. It may be possible to melt-seal the end but it is easier and more reliable to make a loop to form a U shape so that both ends are out of the water, connecting one or both ends to the electronics, with the metal frame being the other connection to the electronics common and to the water. A benefit is that the capacitance per unit length is doubled but in the case where the probe is being used to measure wave height it must be aligned so that both arms of the wire are normal to the wave, otherwise an error could result.

Light springs can be used at the top to maintain wire tension. Make sure there are no sharp edges at the bottom of the U where the wire is held to the frame. A plastic pulley gives a smooth turn. The probe needs to be attached to something fixed like the side or top of a water tank, or to a pier. If the water depth is not too great a stake can be driven into the bottom of a river or dam and the probe attached to it (which also provides a good grounding point). The electronics should be above water in a waterproof box that is attached to the metal probe frame. The box cannot be separated some distance away from the probe because the capacitance of a cable would be too great compared to the probe capacitance. The output cable can also bring low voltage unregulated DC power to the unit. It can be long and even be under water back to dry land if required.

Corrosion will be a problem, even with freshwater such as a rainwater tank. Make sure all external joins are soldered then coated in epoxy and heatshrink tube. If possible run the PTFE wire via a grommet into the sensor electronics unit as nothing sticks to teflon. The original prototype was mounted a meter from the tank being measured, and the signal was delivered to the PCB using a piece of coax thorugh a grommet. Water wicked along inside the coax and corroded the copper inside the cable. The DC bias provided by the oscillator will make things worse. A low temperature coefficient large capacitor inseries between the sensor and the oscillator can solve this problem, but is expensive and will reduce sensitivity. Better to avoid the problem in the first place!

The Eureka tower ballast tank probe Bottom detail Top detail Installed in the tube

PCB sensor

Andy Bartram writes: You may be interested in my probe. I wanted to record fairly small changes ie 0-250mm in a v notch weir - I had made some pressure sensing devices some time back to do 0-2M but at 250m there is a significant temp problem unless you use expensive sensors, 0.1% resistors and high spec op amps. My sensor is a piece of double sided PCB one side in contact with the water and the other using some mylar sail tape as the dielectric. I'll send you a pic.

Ground side Mylar side (covered in mylar sail tape)

Electronics Units

Analog Electronics Unit

Here's an analog water level meter that uses commonly available parts. The output is a voltage that is proportional to the water level:

The monostable is a 555, eg. LM555 or NE555, or could be a ICM7555, the CMOS version of the 555 for lower power consumption. The width of the pulses out of the 555 is proportional to the water level. R7 and C5 form a low pass filter to smooth the DC value of the pulse train. Their values can be increased to lower the cutoff frequency if dynamic response is not required. The lower the cutoff frequency the more noise immunity the device will have.

The zero offset is removed in the differential stage IC1B. The LM324 is a quad op. amp. that can be used in single supply configuration. The maximum output of an LM324 is about 1.5V less than the supply voltage Vcc. The supply can be from a 3-terminal regulator eg LM7808,LM7812, LM7815 - or LM78L08, LM78L12 or LM78L15. The voltage input to one of these regulators needs to be about 2V higher than the regulated voltage. For low power applications a micropower regulator like the MAX666 could be used.

Andy Bartram writes: I think you might need a load (10k) on the output of the analog circuit. It seems they made the output transistors without bias current. Therefore they produce horrible crossover distortion with audio signals unless you bias an output transistor with a DC load as a class-A amplifier.

Digital Electronics Unit

In many applications a digital value is desired (for storage, analysis or accuracy). Although the above circuit can be used as an input to an analogue to digital unit, a more elegant and robust solution is to go directly to digital from the probe.

The capacitance probe is connected to an ICM7555 running in astable mode. The 7555 has an advantage as an oscillator for this application because the timing capacitor is grounded. The probe will be the timing capacitor.

The period of oscillation is proportional to the capacitance and therefore to the water level. The period is measured using the capture feature of any Microchip PIC microcontroller that has the CCP (Capture, Compare and PWM) hardware. In this schematic and code example, a 16F88 is used. The output of the ICM7555 is connected to the CCP1 pin.

Timer 1 is setup to count the crystal frequency divided by four, so the count increments every 0.25 microseconds with a crystal frequency of 16MHz. The timer runs freely and rolls over to zero after the maximum count is reached.

CCP1 is setup to capture the timer 1 count after sixteen cycles of the 7555 oscillator, thus giving a larger count for better resolution, and some averaging. The difference in the timer 1 counts between successive captures is the measurement.

The time taken for the measurement is only a few milliseconds maximum, so further averaging can be done by taking multiple measurements without affecting the dynamic response in applications where a wave profile needs to be measured.

Only one resistor is needed on the 7555 in astable mode compared to two with a standard 555. The resistor should be a low temperature coefficient type eg. from the RC55 series from Farnell or equivalent. The value required can be determined by immersing the probe to the maximum level and setting the resistor value so that the 7555 frequency is about 5kHz. This will be the minimum frequency and the maximum period of oscillation. Typically, this is around 1nF.

The 7555 frequency can drift with temperature (see curve in data sheet) and for this reason the air temperature can also be measured so that a correction can be made if required, either in the PIC program or in post-processing of the data. Generally it is better to perform this correction using a computer to convert the values with suitable high precision. Alternatively, record the response of the probe over the desired temperature range and correct for this.

In this example, the ambient temperature near the 7555 is measured using an LM35 analog temperature sensor.

The level measurement can be scaled to water level in the PIC or in the post processing of the data. The measured value is generally more than enough for the probe resolution.

In the code example, the measured value is output without scaling to the RS232 serial port in ASCII format so that the data can be viewed and saved to a file using a terminal program such as gtkterm on Linux, Teraterm or Hyperterminal in Windows. Temperature is also output in degrees Celcius.

Only the 7555, the temperature sensor and a local +5V regulator really need to be near the probe - if the cost can be justified, a MAX485 can be used to transmit the 7555 pulses differentially (RS422 mode) via a twisted pair cable, eg. CAT5 data cable, to the rest of the electronics at some distance. At this end there is another MAX485 to convert the differential signals back to single ended. Other pairs in the cable can be used for the temperature and to send unregulated DC to the remote regulator.

PCB stakes are also known as PCB risers.

A photo of the original prototype board hooked up to a rainwater tank.

Notes from Darrel's implementation

"I had some time to think things over while my power was out for the last two weeks. Here is a summary of what I think I've learned:"

  1. Probe needs to be able to be installed seprately from the holding device (stake).
  2. Probe needs to be able to be easily removed for maintenance.
  3. Upper 3/4 of probe used for best resolution.
  4. Lower section of probe has less resolution.
  5. Leads from probe to control box connect to same point on PCB.
  6. Leads from probe to control box need to be short as possible to minimise self-inductance, self-capacitance and interference.
  7. Leads from probe need to be separated to reduce stray capacitance.
  8. Aluminum + stainless steel is bad because of electrochemical corrosion.
  9. Tight curves in wire are bad because of the increased chance of wire or insulation damage.
  10. Curves in sensing portion of the wire will slightly affect linearity.
  11. Probe wire and stake need to be the same length.
Here are some questions I still have:

How much can the minimum frequency (max probe) of the 7555 be above or below 5Khz and how critical is this value?

That value was found empirically. It should work a bit lower, but if higher you will run out of range sooner. For example, with 5kHz vs a 10kHz base frequency you'll measure depths as:


Can a LM34 be used (my pond has to get well below zero to freeze because of the wind and water movement)?

You can use either (just remember to calibrate), or any other temperature sensor (including digital ones).

Is the surface area of the stake critical?

No, don't think so.

Annodised Titanium(Ti) probe

Steve Cummins writes:

I had the idea to try anodized titanium for the wire, as the current drawn by anodizing slows down, the anodized layer must be an insulator. I noticed you said thin insulation seems to work better.

Using a fixed voltage when anodizing Ti, the current drawn drops down very quickly, suggesting the anodized layer must be a decent insulator. That's despite wikipedia reckoning 'the thickness of the anodized layer being in the range of 30 nanometres to several micro meters'

I haven't checked stability, but believe that as it's electrons entering the probe through the water which drive the anodizing, anodising should take place preferentially where the resistance of the surface layer is lowest. As long as the positive DC voltage applied to the probe never exceeds a set amount, the thickness should approach a fairly uniform limiting thickness . Think for anodizing to be reversed it would need a negative voltage to be applied to the Ti rod. That voltage would have to be quite high to induce any significant amount of current. Expect layer could thin by dissolving very slowing in to water. As it's already so thin this could be problematic.

I sourced some small lengths of thin (1.59-1.60mm dia) Ti rod, crimped a spade connection on one end, and mounted it in a short length of 8mm outside diameter (1mm wall thickness) copper tube using epoxy, projection of the uncrimpted end out of the expoxy is about 30mm. I then took a brass T fitting for the pipe, and soldered a spade connection on to it. Then added tap water, and applied 12V across the probe (rod is +) for "some time" to anodize the rod.

Probe isn't very aligned very straight wrt to the T piece. I haven't checked the linearity of the probe yet it as I was planning on using it as part of fairly simple high, intermediate, and low water level, pic uC controlled level switch simply by tweaking set point values.

This arrangement had this following measurements:

dry capacitance=38pF
wet cap=570nF
wet+dry resistance aprox 12M

I've just found TiO2 Nanotubes

Despite the use of TiO2 in memoristors I haven't noticed any residual effect on capacitance, due to exposing to high frequency +ve going AC, but when using the probe with a 7556 timer astable frequency output measured by my fancy multimeter seems to swing wildly immediately after changes in water level. Not sure if this is down to my meter, or the 7556 having issues being unable to respond properly, or if it's some genuine effect on capacitance -ain't got easy access to an oscilloscope to test properly. Despite my supply voltage being 5V I'm sure I've gotten the odd static shock like zap from the arrangement, so may be worthwhile adding some kind of warning notice that it might generate High Voltages . Over a very short period of time the energy in the capacitor shouldn't change, and if the capacitance changes in that time to keep the same energy requires the voltage in the cap to increase..The 5556 seems to have survived OK so far, but any voltage excess it could well be playing havoc with it's ability to time properly, and is also why I've not left the arrangement in the empty bath tub overnight fo measure stability over time.

One potential advantage I see with Steve's idea is that TiO2 is well known for catalysing oxidation of organic contaminants on the surface, especailly in the presences of UV (sunlight). So this probe may be self cleaning.