WATER Level Sensor for tank Algorithm.

Thread Starter


Joined Jun 29, 2010
Hello Sir/Mam,
I am like this forum from my bottom of heart from the first day, you are my Honorable guide/Teachers.
So, i was thinking of my Water tank on my Roof how to avoid overflow n save electricity.
I was building this using Ultrasonic sensor but i think using flow sensor contact will be absolutely fine for this project i have no problem if you want to suggest some good idea you are most welcome.
But what will be the logic if i use 2 sensor at top and bottom to detect with micro controller.

for example lets my logic diagram.
0 for no water

1 for half or less than it.

1 fully filled

Do you think using only two condition will satisfy the whole process.
00 and 11


Joined Dec 19, 2007
If you had an indication of 01, less than half full, what would do? If "nothing", than you don't need it. You need to think out each step and the action you want to take place by your system and by you. Perhaps 01 would be "almost empty" and 00 is empty. But again,what would you do?



Joined Nov 23, 2012
You might want four sensors. Two for low and two for high as follows in a tank...

- alarm if the higher of the two high sensors detects water
- Fill until the lower of the high sensors detects water,

- start filling if the higher of the low sensors sees no water
- alarm if the lower of the low sensors sees no water.

Use a flip flop (or software logic) to set the next state - otherwise the lower of the high level sensors will keep triggering the pump to restart every time the water level falls a millimeter below the sensor.

Thread Starter


Joined Jun 29, 2010
I am using 2 LINE LCD just for displaying the Name at top "water control"
and at bottom "TANK FILLED/EMPTY 25%/100%" I THINK 2 or 3 float switch will be better.
Actually i want to sale them in market.


Joined Nov 23, 2012
You can also put a pressure sensor in the bottom of the tank. That way, there is no fear if the float getting tangled or wedged against the side of the tank.


Joined Jun 13, 2014
If you are looking for a relatively simple yet accurate measuring method, you might want to consider this Water Level Sensor

It works in almost any type of liquid, and seems to be pretty accurate. Not sure if this is what you are looking for, but you might want to look at it.

There are also other types of sensors that work in different ways. In this case, the sensor is capacitively based, but other sensors are based on a float system (such as one you might find in a toilet) or resistively
I am not an engineer of any kind, just a person fascinated by what what electronics can do.I got a sketch which I think will indicate level of any liquid,provided the 'voltge divider' can be manufactured. A series of small resistances, or as required by the design, is grounded at the bottom and a float in the liquid, which grounds the voltage divider at the level of the liquid, will change the value of V.Is this idea is too naive? It reminds me my adviser's favorite phrase 'the result is too good to be true' ! If what is expected is true, V can be fed to a micro-controller and many app lications can be devised.
Level Indicator.png


Joined Sep 17, 2013
You will have problems with corrosion of the resistors (through chemical attack or electrolysis) if they're exposed to the liquid.