first of all, Im from Cuba, that means I may have some problems to find parts...

I have a little system to measure the water level in my house water tank. The system is pretty rough: a proximity sensor HC-SR04 well fixed in the top of the tank, some long wires to an ArduinoNano, and a LCD screen where I display information as: water level in liters and in %.

The problem is the proximity sensor HC-SR04 seems to be broken now, not work at all and I was thinking in replace it by raw cables

Something like in the image below, but maybe with more steps: enter image description here

So... My questions are:

-Is this posible? I just test it with a glass of water and two short wires and it work, but sometimes it throw me some falses-positives... It may be my code: just light on a led if digitalpin X is high when I put two wires in the water (1 wire to arduino 5V pin and the other to the digitalpin I wanna check if is high), and it do it, but when I pull out the wires the led stay on for more than a few seconds.

-If it is posible, how long can be the wire? Is 10m ok?


  • have you thought of using a float?
    – jsotola
    Jun 3, 2020 at 5:17
  • Hi @jsotola, how can I connect the float to the arduino in order to show the level tank in a display?
    – k.Cyborg
    Jun 3, 2020 at 5:19
  • You need large pulldown resistors to prevent the input signal from floating.
    – Majenko
    Jun 3, 2020 at 6:42
  • @k.Cyborg I'm thinking of a pulley mounted high above the tank ... cable over the pulley ... a weight atached to each end of the cable ... one weight heavier than the other ... the heavier weight inside the tank attached to a float .... the lighter weight outside of the tank .... code disk on the pulley
    – jsotola
    Jun 3, 2020 at 7:06
  • Several years ago I tried something similar for the company I worked at that time. Since DC (direct current) lets the electrodes corrode faster, we used AC (alternating current) with a rectangular wave form. Sounds scientific, but it was simply done by changing between VCC and GND. The current through the water is different from the current through air, and it can be detected. You might need some analogue circuitry, though, before you can attach your Arduino. However, I don't recall any experiences how long this worked. Jun 3, 2020 at 9:38

1 Answer 1


As others have said, you need to make sure you have pull-up or pull-down resistors on all digital inputs so their value doesn't "float" (fluctuate between high and low.)

Given that water tanks and wells tend to be strongly earth grounded, I would suggest some changes:

Change the common wire to a ground, not +5V

Change all of your other pins to analog inputs. Connect them to high ohm pull-up resistors (say 10kΩ). They will read a full 5V when their ends are not in water. When the water rises and the ends dip into the water, their voltages will drop. Use analog readings to detect those voltage drops.

You could also use something like graphite a pair of graphite rods in the water, and a voltage divider circuit. As the water level rises, the current would travel through less graphite, and the resistance would drop. I don't know if that would give you enough top-to-bottom measuring distance.

  • 1
    You can also create a capacitive sensor using aluminium foil and plastic piping. instructables.com/id/Capacitive-Fluid-Level-Sensor
    – Majenko
    Jun 3, 2020 at 15:11
  • 1
    I sort of stumbled on how to determine the depth of my outside fish pond, about 1.5 meters. I run a air pump to oxygenate the water for the fish and fitted it with a sensitive pressure transducer. I put a meter reading the pressure and added analog alarm set points. I noticed the first summer as the water went down so did the pressure, conversely when the water rose the pressure rose. With some experimenting I was able to determine the water level. The pond is outside, the air pump is in basement with an outside air inlet because of the cold temperatures. It has been operational 5 years
    – Gil
    Mar 2, 2021 at 0:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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