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.
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.
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.
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.|
|A probe used in a sway suppression tank in a new skyscraper in Melbourne.|
"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:"
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: