I am working on an electronic water sensing mechanism.

I need to sense various levels of water as the water level is consumed and refilled in an underground water tank. Later, I want to control the sump motor with logic when various conditions are met.

Focusing on just electronic sensing mechanism there are many choices available:

  • bias a transistor with the help of water as conductor
  • use logic gate inputs to become HIGH/LOW when water touches probes. There are several choices for gates, any gate can be used in general, even a NOT gate can do.
  • Ultrasonic depth sensing
  • LDR based
  • various other

I am working with logic gates at the moment but will transfer it to a microcontroller later when I am satisfied with 'water sensing.'

The problem with many of the techniques above is that their reliability changes with many environmental effects. Water vapour, hydration, corrosion, electrolysis, temperature and many similar factors change parameters which can affect changes in sensing.

Currently I am working with CD4093 NAND. It has built in Schmitt trigger so it can shape inputs.

I prefer to give oscillating inputs to this logic gate, so at least electrolysis can be prevented. Probes will be usually dipped in water.

To perform oscillation in sensing probe I can use transistors (AC biased), 555, opamp.

  1. Which one would be better option for oscillating in this scenario?
  2. How can I simulate the properties of tap water in the reservoir e.g. water conductance and other electrical properties in NI multisim? Currently I ground the inputs with a switch to give the effect of water touching the probes in NI Multisim. How I can model the real water properties affecting my probes?
  3. any other idea to achieve the task?

I want 8 points of level detection, each point is one foot higher than the previous one.

From full to empty, the difference is approximately 10 feet. This is an underground tank of concrete.

I want it reliable and long lasting, free from errors and safe from enviromental changes. A one time install solution, no corrosion at probes, no electrolysis, no reading errors due to temp changes, hydration, vaporization, etc.

Tank bottom is approximately 10 feet from top.

Level readings at the moment will only light up LEDs but at the next phase they will be the inputs to a micro controller based logic algorithm implementation where two pumps will be in service in parallel but one at a time, next time next up, will take turns. several conditions will be checked to turn on the right pump, or to just give warning beeps, and more. This all will come in the next phase, later.

      • Updated - - -

I understand all three oscillators I mentioned, AC biased transistors, 555 clock generator, op-amp generating square waves.

I want an oscillator which will oscillate in +ve and -ve polarities, this scheme can avoid electrolysis.

I think an op-amp will do that better.

How can I make reading from probe non-oscillating so that it can be fed to a logic gate, otherwise logic gate output will also oscillate.

Should I use de-bouncing before giving input to logic gates?

Are there any stray capacitive/inductive or other parameters in tap-water other than the conductance (or resistance) that should be taken care of when considering digital inputs?

I am trying to avoid any commercial sensors. I prefer building my own.


4 Answers 4


Too Complicated/Expensive/Unreliable

The approaches you suggest require expensive and power-consuming hardware with complex signal analysis to extract water-level information.

All you need is a few $4 float switches arranged at different depths like this:

array of descending float switches

I had suggested this approach to another similar question.

Now, life is really simple. Each of the switches corresponds to a different water level (you might want eight of them 1ft apart?). As the water level changes, more (or fewer) of the switches will be closed.

This can be read with digital logic or a microcontroller extremely easily.


If you want to spend more money to improve reliability:

  • You could use two (or more) independent arrays in parallel and compare the results to detect sensor failures.

  • Use more expensive (higher quality) float switches

  • Increase the number of float switches

  • \$\begingroup\$ +1. Your upgrades bucket list could do with another option: A graduate intern with a scale, using a dip-stick and toggling the pumps. j/k :-) \$\endgroup\$ Jun 16, 2013 at 4:53
  • \$\begingroup\$ I am using something similar at the moment as temp solution. the dipped object actuates/de actuates mounted micro switches on top cover of tank with rise and fall in water level. this is a mechanical arrangement. I am thinking of something without moving parts. \$\endgroup\$
    – sunnyimran
    Jun 20, 2013 at 8:09
  • 1
    \$\begingroup\$ Sure... but why? \$\endgroup\$ Jun 20, 2013 at 9:18

Just put a pressure sensor at the bottom of the tank, and measure the water pressure with a suitable MCU with an ADC. The water pressure is proportional to the depth, of course.

Q.3 any other idea to achieve the task?

Well, you are trying to avoid commercial sensors, but I am doing something similar using a pressure sensor Freescale MPX5050 and it's output is read via a micro analog port.

As you, I wanted something that was installed permanently and very reliable. My setup is a copper pipe into the tank, this pipe is pressurized with just enough airflow to generate bubbles coming out of the pipe end which is at the bottom of the tank. The air pressure in the pipe is directly proportional to the water height.

The drawback of this system is that you need a small air compressor + pressure regulator to generate air pressure. This cost money, but for me it was worth it.

The advantage is no parts in the tank to corrode and maintain. I have two tanks, one potable water and one grey water.

I want it reliable and long lasting, free from errors and safe from 
enviromental changes. a one time install solution, no corrosion at 
probes, no electrolysis, no reading errors due to temp changes, 
hydration, vaporization, ...................

Let's see: Water + metal + electric potential. Tough call. The only solution I can think about is capacitive sensors where the metal plates are covered in plastic. Cheap? No.


For a "set and forget" level of reliability, I would suggest using magnetic float switches. They are fairly cheap and have no moving parts that need a water tight seal.

magnetic float switch internals magnetic float switch

Use a stainless steel rod or any other non-corrosive material to hang 8 of these in a row so that they can trigger at the different water levels. You can get right angle switches, too, so it is easier to mount on a vertical stick.

Each of these switches needs to be connected to a micrcontroller pin and ground. The terminal connected to the microcontroller pin must connected to a pull-up resistor (1K ohms would suffice) to the microcontroller's Vcc (5V for an Arduino Uno or 3.3V for a NodeMcu board.) A small capacitor (100nF) parallel to each switchs' terminals would be helpful to reduce switch bouncing noise.

Assuming the switch is open when there is water at its level, then the input will be high and the level calculation can be as simple as: (assuming Arduino-like code)

int waterLevel = digitalRead(sw0) + digitalRead(sw1) +... digitalRead(sw7);

If the switch is closed when there is water at its level, then change that to:

int waterLevel = !digitalRead(sw0) + !digitalRead(sw1) +... !digitalRead(sw7);

'waterLevel' will then vary between 0 and 8.


Not the answer you're looking for? Browse other questions tagged or ask your own question.