ESPHome water level sensor

Hello everyone, I am attempting to monitor the water level in a cistern using a pressure transducer. However, whether I connect the transducer directly to the A0 pin of an ESP8266 or use an ADS1115 in between, I observe a voltage drift, as shown below.


I would greatly appreciate any advice or suggestions you could provide.
Kind Regards
Alexander

When you say “drift” what do you mean by that?

Is the level constant in the tank over the time period?
Or, is it actually falling as the trend of the line shows?

Do you mean the noise (fluctuations above and below the “true” value) that make the line wide/fuzzy?

Drift typically means a slow movement.

Hello Neel,

thank you for your fast feedback and your question.
I mean that only the voltage reading is falling while the tank has constantly the same water level. The fluctuations are not so important for me, I know how to mitigate them. Here below you can find the drop over night.


The voltage decreased from 2.93V at 2:30 PM to 2.74V at 7:30 AM.

What sensor are you using?

I experienced something similar using a submersible pressure sensor; I didn’t realize the purpose of the tube that was inside the wire harness and I terminated it inside heat shrink tubing when I was making the electrical connections.

That tube provides the atmospheric pressure for the back side of the differential pressure sensor. As the atmospheric pressure would change (due to air temperature & weather changes), the air would slowly leak into the tube and it would show up as drift on the sensor. Or, it may not have been leaking and instead I did seal it perfectly, so instead air and water temperature changes would have changed the pressure in the sealed tube. Either way, the end result is drift.

If this is your issue, you just need to ensure the end of the tube is open to the air.

Hello mekaneck,
I am using an MPX5010DP like this one here below.


This is a differential pressure transducer. Port 1 is connected to one end of a hose, with the other end submerged at the bottom of a water tank. Port 2 remains unconnected, open to the atmosphere. This configuration should produce the same effect as the tube in your harness.I would rule out the possibility that my issue shares the same root cause as yours.

Is the pressure sensor located at a height equal or lower than the bottom of the tank, and can you confirm the tube is full of liquid without bubbles?

pictures?

What is the routing of the hose?

That’s not going to work unless you have some way of regularly purging the tube of water. What will be happening is that the tube is slowly filling with water so the point at which you are measuring the pressure is rising.

The transducers that are immersed in the tank are designed so that the reference tube is only open to the air, not water. A tube with one end open in water will slowly fill even if the top is perfectly sealed, due to the air dissolving in the water.

Hello Mekaneck, the sensor is designed to be placed at the top of the tank, outside the water. When filling the tank, the hose becomes partially filled (only a few centimeters at the bottom) until an equilibrium is reached between the hydrostatic pressure of the water and the air pressure inside the hose. The sensor should measure the air pressure, which corresponds to the pressure at the lower end of the hose.

0.19V over 17 hours: what liquid level change would that correspond to? Perhaps that is accurate if the bottom of the tube is filling with water due to dissolved air (as mentioned by @clydebarrow) or due to temperature change of the air inside the tube, decreasing the volume and allowing more liquid in.

The arrangement doesn’t seem very robust.

The only other typical source of drift is temperature change of the sensor itself (but yours is temperature compensated, and I’m assuming we’re dealing with liquid somewhere around room temperature?) or temperature change of resistors on the PCB used in the measurement circuit (but I’m assuming the PCB isn’t subjected to any significant temperature swings?)

Hello Malik,
please find below a schematic of the system.

Hello clydebarrow,
thank you for your reply.
Why do you think that I have to purge regularly the water?
The water should fill the tube until a certain point at which an equilibrium is reached depinding mostly by the hidrostatic pressure of the water and the pressure of the compressed air. Is this assumption wrong in your opinion?
I can notice a reduction over time of the indicated pressure (expressed in volts) not a rising.
Air dissolves in water, if possible, over a lot of time, not over a coupple of hours, doesn’t it?.

Hello mekaneck,
0.19V would correspond to approximately 7cm of level reduction (presuming a linear depency of voltage and water level). I can’t observe any significant level reduction, not even 1mm in the tank. Do you really think that air dissolution would have such a big efect in such a short time?
Due to the fact that I am performing the test inside my flat, I would exclude signioficant temperature exchanges. Furthermore I observed always only the phenomenon of reduction of voltage never an increasing of it (excluded the random up and down peaks).

Are you able to observe the level of the water in the tube? I understand the tank level is not changing, but the concern is that the water level in the tube (which is supposed to be mostly full of air) is rising. 7cm would be a lot if due to air dissolution, but instead could simply be due to air leaking through the pressure sensor, and/or a poor seal at the hose barb connection and/or a leak in the tube.

Most likely option.
Also, while some plastic/rubber tube tube might be highly impermeable to water, it might be highly permeable to air.

No, unfortunately I am not able to see inside the hose while it is submerged. The hose fitting on the sensor inlet is very tight. May be I can check it with some soap-water. In case of leakage it sholud make some boubles. I will try.

It is a silicone tube like this in the link here below (sorrythe page is in German):
https://www.amazon.de/dp/B0CYGMLPM7?ref=ppx_yo2ov_dt_b_fed_asin_title&th=1
I can’t see any bubble in the water, but I will try to check the sealing of the hose-sensor inlet junction.

This is what some professionals use to get the data you seek:
https://www.plctalk.net/threads/measuring-water-level-in-a-tank.127458/#post-870530

I have never heard of anyone doing it the way you are, so I am not surprised it isn’t working.

You have to measure the pressure at the bottom of the tank. Your method has inaccuracies as others have mentioned. If you filled the tube with water and used the siphon method (with the sensor at the bottom of the tank but outside it) it might give better results.

I will give a look to those pages. Thank you, Malik.

Those bubbles that pass plastic walls of tube are so tiny that you can’t see them with naked eyes. But most plastics pass air, that’s why best plastic tubing is composite with aluminum layer between multiple plastic layers. PEX is also quite impermeable.
This is what google gives for silicone:


In fact silicones are often used for high quality breathable exterior paints.