Options to display water level in Tank

Hi all.

Anyone have some nice examples of display a liquid level in a tank (inside HA before I get suggested another tooling option), would like to be able to increment level display at 1% increments.

Thinking is to get level from MQTT topic.


I have heard of people using the HC-SR04 ultrasonic distance sensors.

Infact this might be a better option as its waterproof.

I built a wemos-based sensor using an ultrasonic sensor like this one:

The level is calculated and passed to OpenHab via MQTT. It works ok, but condensation inside the tank messes with readings. Since I covered our tank it works better. And the shortest distance it can measure accurately is about 20cm which is problematic if the tank is full (assuming you mount the sensor in the top/ lid).

1 Like

interesting to know…
Pity that sensor is out of stock…
I’m looking at doing this for now… and will be ordering pressure sensors for the V2 version ltr


My go-to shop for electronics is DIY: https://www.diyelectronics.co.za/store/proximity-sensors/1181-ultrasonic-waterproof-distance-sensor-module.html?search_query=ultrasonic&results=27

Robotics sometimes have something specific I need: https://www.robotics.org.za/AJ-SR04M?search=ultrasonic

1 Like

@Gh3kko can assist you. His got something up and running that you can check water level in a tank.

1 Like

Stil in Beta like all my projects, but here goes hope this helps.

I use esphome(on HA) and the cheap hc-sr04 the controller is a nodemcu, can probably use a wemos or the smaller esp8266 if you want, the node is just easier to program for me and I standardize all my sensors on them, i had issues with the single probe water proof sensors as their angle is wider(70-120 deg) and had alot of noise on them and over a certain range inconstant results, hc-sr04 is 15 deg if i remember correct

I have ran these non water proof sensors for about 4 years first on blynk but now moved over to HA the last month and only lost 1 sensor in that time(my fault).

I still need to do some custom gauges in HA. atm just run the default to show % wise. the sensor needs 5v, so i run a voltage divider on the data pin as the nodemcu is 3.3v (sensor gets 5v from Vin pin)
i run 12v over cctv cable to a small ip rated enclosure inside a step down buck converter to 5v, goes into vin/gnd and 2 holes carefully drilled/dremeled out for the ultrasonic senor with silicone to seal the enclosure and rest of the electronics, both are in sun/rain daily exposed to the elements. They sit on top of the water tank lid(2 holes in there aswell, i have a rock on the one as the neighbors cat likes to knock it off(also where i had to move for better wifi see below))

attached 2 pics, one is from blynk, the red circles was from another post but it just shows when our cleaning lady was cleaning the house and the water consumption dips was interesting(the big surge of water is pump from one tank to another(tank has 2 water sources, RO filter discharge and pump from main rainwater tank)
Other pic is the 2 tanks and my one sensor, tank 2 was offline cause I had to take it out to split the sensor and the node for better signal(moved about 0.5m)

Project cost sr04 - 25, node 120, buck 25, lug 2.50, enclosure was around 100 if i remember correct and 5-15m of cctv cable

spikes on the graph are either rain or pump usage, i still need to filter some more, cut top and bottom values, measure over a longer period/ave that out ect. atm i just ave over 5 values


  - platform: ultrasonic
    trigger_pin: D5
    echo_pin: D6
    unit_of_measurement: "%"
    icon: "mdi:water-percent"
    accuracy_decimals: 0
    update_interval: 0.5s
    name: "2kl Water tank"
      - median:
          window_size: 5
          send_every: 5
          send_first_at: 1
      - lambda: return (1-((x-.22)/2))*100;
      - filter_out: nan
# tank height: 190cm, width 120
    # height from full to sensor: 22cm (essentially sensors minimum distance)
    # full tank: 180cm
    # current reading: x
    # ergo: used = (x - 22)
    # ergo: remaining = (180 - used)
    # ergo: percent = (remaining / 180) * 100
1 Like

This looks like a nice option (if you don’t see the price):

For that price I would use this… and the Tank 140 on the CerboGX.

1 Like

Has it been reliable, don’t those sensors corrode away in the moisture?

allot of the sensors i’m seeing available all seem to be analog based.
I primarily se Raspberry pi’s with Python…
anyone got a good option for a analog to digital converter…
allot of the sensors seem to output a amperage based on the measurement.
think I’ve seen some that either direct of via a converter board output a voltage based on measurement.

… ANYone find a non ultrosonic sensor that can measure say 0-5m of liquid (saying 0-5 as that’s as close as I can expect to come for 2m DoJo tanks which are normally 2 or 3 m height).


Water is easier to measure since it’s not corrosive.
In industrial applications the use of pressure transmitters is popular since it’s reliable assuming the tank is uniform in shape.
You will need to calibrate the maximum output of the transmitter for a full tank.
Typically these will be analog devices however.

like device… want to switch to a pressure transducer, my wallet its just laughing at me…

Then still need to figure out how to convert the analog to digital.
Thinking i might need to ask for help, I got some D1Mini’s… As far as I know the D1 range can work with analog (and they cheap and you can get them vs Pi’s which is neither), use that to run a program to do the conversion and post values onto MQTT topic.