Liquid level indicator by a pressure sensor

Hi,

Recently I made liquid level sensor by using nodemcu and ultra sonic sensor, it works fine for a year after that the sensor get rusty and start to send wrong readings, I am planning to replace the ultra sonic with 0-5v pressure sensor but i am not sure if it suitable for this purpose, and if it works how to convert pressure readings to percentage,

Thanks.

What liquid are you using it in?

Plenty of discussion on this device here:

2 Likes

whether it will work for the level sensing will depend on if the pressure in the tank you will be sensing is within the range of the sensor and the sensitivity of the sensor.

ex if the tank pressure when full is 5psi you don’t want to use a pressure sensor that maxes out at 2psi. and to help with the sensitivity you don’t want to use one that will read 100psi either. So just make sure you fit the sensor range to the actual psi range you are going to get.

then to do the calibration you just need to figure out the voltage output of the sensor at two different tank levels (and you should make them as far apart as possible to get better resolution) the enter those values in the linear calibration filter in ESPHome.

When I was looking into something a bit similar using an immersed Aqua temp/humidity/pressure sensor, I found that ambient atmospheric pressure variations were too large compared to my 0cm-30cm of water.

Even with a dedicated control device used to remove ambient effects, it still wasn’t adequate.

I’m not sure if your sensor is sensitive to ambient pressure… Perhaps just something to be aware of and keep an eye on.

PS a coat of clear nail varnish can provide rust protection. It’s basically just epoxy.

1 Like

I put a pressure sensor in my 3.7m deep tank; it had a small pressure equalisation tube in it. Stainless steel and only 16 months in. Still looks good!

2 Likes

In the industry, these sensors have 2 chambers with a membrane separating them, and the measurement is achieved by sensing the membrane deflection.
In your particular application, considering that the liquid container is vented, one of the chambers should be connected to the bottom of the container and the other chamber should be open to the atmosferic air.
This is a diferential pressure sensor and the atmospheric pressure is common to both chambers so it is ignored automatically.
Maybe the sensor you have is not a differential pressure one and the “not measuring” chamber is not vented… unless you drill a small hole on it… or maybe use 2 of those and calculate the difference…

The diff pressure sensor should look like this:

Marco

1 Like

2000 litters water tank with 1m in depth

sensor’s working pressure is 0 to 170 psi, the thank in which I want to put the sensor in is 1m in depth this mean that the maximum pressure will be around 15 psi :sweat_smile:

you are right, the sensor gives bout 0.5v even when there is no pressure applied and I think it’s due the atmospheric pressure, but it’s easy to fix with esphome calibrate_linear

do you have an idea about the working pressure range of the sensor you used ? and how accurate is it?

I don’t think that is correct unless the density of the liquid you will be measuring is 10 times that of water.

Water pressure increases at a rate of about 15psi per 10m. So the pressure at 1m will only be around 1.5psi.

And that seems right based on my experience using pressure transducers for tank level measurements in my job.

I think that pressure transducer won’t be anywhere near sensitive enough to read the water level in that small of a tank.

1 Like

Hello @Maku,

https://www.aliexpress.com/item/1005002655746818.html?spm=a2g0o.order_list.order_list_main.5.53cb1802DoPsFY

You can choose different specifications; 45cm is very shallow but if you choose 1m 0 - 5V that would mean that mean 45cm should be generating 2.4v (check with multimeter first!) You may want to use ADS1115 for greater accuracy than ESP ADC and to give you some voltage overhead in case the sensor output the full 5v. Remember to install the pressure sensor correctly so the end of the wire is open; there is a red tube down the middle which is pressure equalisation. The sensor is therefore NOT measuring atmosphere, but will generate a voltage when there is no water pressure. Hence why linear_calibration is needed.

Because your water is so shallow I might have gone a different route and used 3 or 4 basic sensors at different depths. Seems a bit overkill to measure the depth of 45cm; I assume this is perhaps standard for aquarium folk. Outside of my knowledge!

1 Like

You are right, I miscalculated water pressure, I thought 1m of water equal 1bar,
In this case the 170 psi sensor wouldn’t be useful at all.