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,
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.
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!
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…
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
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
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!