I'm making a water level detector to control my motor which supplies water in water tank and for that I'm going to use ultrasonic sensor to be attached to tank lid. My question is whether the vapor arising from water inside the tank hamper the overall working of ultrasonic sensor and/or it may be damaged permanently. I can cover complete ultrasonic sensor using hot glue stick but cannot cover its diaphragm as it will block sound waves. Please suggest something.

  • You may be able to find a data sheet for the usual in-air transducers giving humidity limits. You will not be able to seal them yourself without making them not work. Sealed ones do exist for vehicle parking systems, but require different electronics. Also beware minimum distances. Commented Sep 16, 2016 at 19:30
  • For fluid level measurement you are best off using a capacitive fluid level sensor.
    – Majenko
    Commented Sep 16, 2016 at 20:47
  • I'm not sure if there is even an issue here. But you could try out different types of plastic bags, to see which are "transparent" to ultrasonic sound. Alternatively, just replacing the sensor every one or two year, wouldn't be that bad. Just make sure that your code accounts for a bad sensor (e.g. turn of the pump after 10 minutes regardless of the water level).
    – Gerben
    Commented Sep 17, 2016 at 12:19
  • Plastic bag shields will not pass enough signal for the common sensors. Commented Sep 20, 2016 at 12:42
  • I am posting an answer just because I do not have enough reputation in order to comment. This is not a straight answer but more like a workaround. Have you tried using the system from a toilet water tank? also, you could put a floating magnet inside the tank (and limit its x-y movement) and a reed switch (or more) outside of the tank at the desired levels. Another idea (not sure of it works, depends on the water quantity) is to place a barometer on the bottom of the tank and measure the pressure. Commented Sep 20, 2016 at 17:04

3 Answers 3


Majenko, agreed. Use some FM antenna cable, if you can find it. Insulate the lower end by dipping in molten heat glue. Two rods, insulated with heat shrink tubing also works well. Use LM393 dual comparator as Schmitt trigger and inverter. That will oscillate at frequency dependant on the water level. Works well, recalibrate or clean the sensor when accuracy suffers due to being too dirty. should not be necessary more than annually.


A friend of mine worked on a liquid level monitoring project, and after many iterations finally abandoned the kinds of sensors you're talking about. Ultimately he just pointed a cheap USB webcam at the thing and used OpenCV and the edge detection algorithm to find the level of the water. Then it's just a matter of doing some math using the dimensions of the container, to figure out how full it is.

If you are using a clear container and if you have the option of using a Raspberry Pi (or a PC, whatever) that can run OpenCV, you might find that option worth exploring.


Sensors exist for exactly your use case. Here is an example;

Maxbotix MB7589 Ultrasonic Sensor

I have used several of these to measure river levels. they are virtually indestructible and have all the features that you would expect;

  • Temperature compensation
  • Self heating to deal with humidity/condensation
  • serial output
  • 1mm resolution

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