Email Address:

Lost your password?

This is the legacy website; please use the new website.

Ultrasonic Water Tank Level Gauge

Do you have a tank to collect rainwater? Do you know how much water is in it? This ultrasonic tank level gauge fires an energy burst which bounces off the surface of the water ? and then a microcontroller calculates how far down the tank water level is. Clever, eh!

by John Clarke


• Non-contact sensing

• Dot or Bar display

• Easy calibration

• Powered by 9V battery or DC plugpack

• Suitable for water or other fluids

• Temperature compensation

• Error indications

Having your own rainwater tank is great – and very, very green! In fact, it’s mandatory in most areas these days. If you just want to water the garden or wash your car in times of water restrictions, it’s not that much of a drama if it runs out.

But if you depend on it for your daily water supply, it is crucial to know how much water is in the tank at any time.

This Ultrasonic Water Tank Gauge shows the water level using ten LEDs with a display resolution of up to 19 levels.

We have published a number of water tank indicators over the years, the most recent being a design based on a pressure sensor, in the November & December 2007 and January 2008 issues.

That design is still valid, especially as it also provides a 433MHz link to an LCD panel which could be mounted indoors – much easier to check the levels.

This new design is a simple stand-alone unit which is somewhat easier to install and has the benefit that the sensors are not in contact with or submerged under the water. And the ultrasonic measurement method is also suitable for fluids other than water.

The Ultrasonic Tank Level Gauge uses two waterproof ultrasonic sensors mounted in the air space above the water in the tank – one sensor transmits a burst of signal while the other receives it. The idea is that the water in the tank will reflect the signal and the time it takes for signal to be received, divided by two, accurately represents the distance between the water in the tank and the sensor.

This is done measured by a microcontroller, which then displays the result on a LED dot or bar graph.

It’s very simple in principle but there is a complication in that the speed of sound in air varies with temperature – and you can get a big variation in the air temperature in typical water tanks. It can range from below zero up to 50°C or more.

But never fear, the microcontroller compensates for that and computes
a corrected reading.

LED dot/bar graph display

The Ultrasonic Tank Gauge shows the water level on a vertical LED dot/bar graph display (selectable). In dot mode, 19 separate levels can be displayed, using only 10 LEDs.

How’s that again? In fact, the dot display lights either one LED or two adjacent LEDs at a time, to show levels between each individual LED dot level.

For the bar graph display, ten separate levels can be displayed.

The Gauge is designed to suit many types of tanks, up to a height of 2.4m. It is powered from a 9V battery which should last a long time since current only flows for a brief time after the pushbutton switch is pressed to show the water level.

It is housed in a waterproof box with a clear lid so that the display LEDs can be seen.


As already noted, the circuit is based on a microcontroller, a PIC16F88-I/P (IC1). It generates the 40kHz signal to drive the ultrasonic transducer, computes the water level and drives the LED bar graph.

As well, it monitors the air temperature inside the tank to provide compensation for the variations of the speed of sound at different temperatures.

Click for larger image

Transistors Q1 to Q6 are used to provide push-pull drive to step-up transformer T1, which drives the ultrasonic transducer.

Outputs RB0 and RB2 of IC1 are configured to provide complementary 40kHz signals to drive the transistors. When no signal is being delivered, RB0 and RB2 are low at 0V and transistors Q1, Q3, Q5 & Q6 will be off. Transistors Q2 and Q4 will each be held off via the 10kΩ resistors between their base and emitter.

When RB0 goes high to about +5V, Q3 & Q5 are switched on. Q5 turns on Q2 and this pulls one side of T’s primary winding to

Click for larger image
The Water Level Gauge consists of the ultrasonic sensor assembly (above) which goes inside the tank and the processor/display (right) which is mounted outside the tank.

+8.7V. Meanwhile, the other side of the primary is pulled to 0V via Q3. After about 12.5μs, RB0 goes low, switching off the transistors Q2, Q3 and Q5.

RB2 now goes high to drive Q1 and Q6. Q6 switches on Q4. This reverses the current in the transformer primary and is maintained for about 12.5μs, when RB2 goes low and the transistors switch off.

The cycle repeats with outputs RB0 and RB3 producing bursts of 40kHz which last for 15 cycles or 375μs. The transformer steps up the output primary to about 85V peak-to-peak.

Diodes D1-D4 clamp spike voltages induced by the transformer each time the primary current is switched off. They clamp the voltage to about 0.6V above the 8.7V supply and below the 0V supply rail to protect the driver transistors Q1-Q4 from over voltage.

Ultrasonic signal is reflected from the water surface and is received by sensor 1, an identical ultrasonic transducer. Its signal is amplified by op amps IC2a and IC2b which are configured to provide a gain of about 67.7 each. Overall gain is therefore about 4,580 at 40kHz. Low frequency roll off is below 10.6kHz and high frequency roll off is above 159kHz. The amplifier itself also rolls off response above 100kHz.

IC2b’s output is fed to a window comparator comprising IC3a & IC3b. Its sensitivity can be varied by trimpot VR1.

Share this Article: 

Privacy Policy  |  Advertise  |  Contact Us

Copyright © 1996-2021 Silicon Chip Publications Pty Ltd All Rights Reserved