Need advice on Water tank level monitoring

Is this the one you got?

Gravity: Throw-in Type Liquid Level Transmitter | DFRobot KIT0139 | Core Electronics Australia (core-electronics.com.au)

Or this one?

Gravity: Analog Water Pressure Sensor | DFRobot SEN0257 | Core Electronics Australia (core-electronics.com.au)

Dean
the Df robot one.
Pat

Thanks, do you know when they say a measurement like 5m, are referring to 5m squared of water? Or 5m depth maximum for pressure readings?

Iā€™m just trying to working out if it will be too much pressure for the sensor

Well Iā€™m hoping that it means 5m depth - otherwise my past 3 years of tinkeering will be met with a roar of rage.

Just curious as I just got this response from someone locally here

That sounds a little weird. If I dive into a pool and go to 3m the pressure is ā€˜xā€™ā€™. If I dive into an ocean and go to the same depth my pressure is ā€˜xā€™ also (discounting salt effects etc).
The amount of water surrounding the depth should have no influence on the vertical pressure.
Pat

Haha I agree, I recon heā€™s trying to pull a sales tactic on me.

That is so interesting!

Iā€™m still just trying to get my head around this a little bit.

The majority of the sensors out there appear to output say 0-5v.

What do I need to read the output on a esp32? ADC? and why?

I understand the esp32 has a logic level or 3v3.

Sorry, do you mind just explaining to me, im not sure what im missing to understand this.

What is the board for included with the dfrobot version.

Thanks

Iā€™ll try and help out, and understand your confusion (been there!).

For more accurate water level reading, depending on your sensor type your build would be:

  1. Pressure sensor (4-20mA loop) > current/voltage converter (0-5V output) > ADS1115 (analogue in, digital out) > ESPxxxx.
    OR
  2. Pressure sensor (0-5V) > ADS1115 (analogue in, digital out) > ESPxxxx.

As you note the majority of these pressure sensors have a 0-5V, or a subset of that range, as itā€™s the simplest to read. Note that often the ā€œempty tankā€ reading is a non-zero voltage (like 0.5V) so itā€™s easy to differentiate from a ā€œmy sensorā€™s brokenā€ reading. You fix the offset with a filter / offset in code.

A voltage output is easy to read on an ADC, but if youā€™ve got a long-ish cable run from the sensor then youā€™ll see some voltage loss and need to calibrate your readings. On a long cable the drop could be enough that your sensor doesnā€™t work, but Iā€™ve tried my 5V sensor at 3.3V and itā€™s worked fine so I donā€™t think the supply voltage loss over a 5-10m cable run is a concern.

Switching to a current loop (4-20mA) gets over voltage loss issues - these loops are very common in household alarm circuits with lots of PIRs using a current loop for movement sensing. But ESPxxxx devices donā€™t have a current loop interface so youā€™ll need to convert back to 0-5V to read it. Dfrobot helpfully throw one of these boards in knowing most people will need them.

While the ESPxxxx is great at many things, itā€™s not so great (apparently) at reading an analogue voltage input. Iā€™ve never plotted it but others have noted non-linearity in the ADC conversion - so you may need to add a filter or conversion table to code if youā€™re really concerned. The ESP32 (Wemos clone board) should read voltages up to around 3.2V but mine seems to unhelpfully max out at 1.04V for some reason.

For water head, I wouldnā€™t care about being out a few % but seeing my tank level go UP when Iā€™m using water (due to ADC non-linearity) would really bug me!

To add extra ADC inputs or to get more accurate readings, as @Patraff noted above you can add an external ADC module like the ADS1115 which has a load of analogue inputs and is quite linear, with itā€™s digital output connected to the ESPxxxx.

It would be SO much simpler if you could buy a pressure sensor with a one-wire or I2C interface, and read a digital output. I gave up using analogue temperature/humidity sensors years ago and have never looked back.

1 Like

Howā€™s everyone plotting along with things on this matter?

I still havenā€™t bought anything. Is everything working as expected and you are happy with the results?

Iā€™m still trying to work out the best sensor to buy! Have you guys had your sensors in your tanks for long? No dead sensors from bad seals etc.

Ideally, I want to buy once and buy right as the wait to get one will be long.

There are just so many different options out there for these things!

Appreciate the update!

Iā€™m still using a pressure transducer, connected to the tank outlet. [Donā€™t connect your sensor to the outlet - when your pump is running pressure drops dramatically! I did this for ease of install while testing.]

The transducer is connected to an ADC on a Wemos ESP32 Mini, and 95% of the time reads very accurately. The other 5% of the time I get results all over the shop, from 0% to >100%. This happens sporaidically, with sometimes not a single accurate reading (Iā€™m sampling every 10 seconds) for an hour or more.

Aside from that, results (when reading correctly!) are very linear over the complete range (I think itā€™s 0.5 - 2.55V for me, now Iā€™ve fixed the ESP32 ADC range). Temperature variation causes more impact than I expected, and I can see a 15cm level change on some warm days.

These transducers are commonly used on machinery and vehicles, so I doubt itā€™s the sensor causing such wild variations. I just needs time and willpower to investigate; will probably add a second ESP32 on a different power source to try and work out if itā€™s the ESP32/ADC causing the errors or not.

Iā€™m currently filtering out over/under readings, and using an exponential_moving_average filter with 0.05 alpha and 20-sample intervals.
image

Thatā€™s good news! Sounds promising!

Thanks for the update, would love it if you could do a nice detailed write up :stuck_out_tongue:

I do have one question, what would you say the expected life span of one of these submerged pressure sensors be?

Iā€™ve got no basis on which to draw a conclusion, but my cynical side says just a little longer than the warranty period :slight_smile: . Hopefully longer given theyā€™re more expensive & industrial than most sensors. At least theyā€™re easy to replace if you ever need to.

Ok iā€™m looking at biting on one of these now for testing but I still cannot decide what to go for for integration with ESP32;

Do I need a analog output such as a 20mw etc etc or a voltage output 0-5v?

And do both require a ADC?

Also, are ideally I want one that can operate with 5v Supply voltage rather then 12 or 24v. Is there anything out there like this?

Also the 2wire vs 3wire, whats the difference and how does the 2wire version work?

Thanks again for your patience :rofl:

Hey @deanfourie , how did you get on with this? Iā€™ve got 3 tanks Iā€™d like to start monitoringā€¦

To be fair this one is still sitting on the to do list, which grows 3 times a day every day.

You know how it is.

Ill try get onto next, the worst part is getting the parts in :frowning:

Hey @TommySharpNZ,

what I did was,
Hook up a shelly uni to a level sensor https://www.aliexpress.com/item/1005004940352922.html
I actually brought the wrong one which was a 4-20ma one instead of the 0-10v one. but it works well with a resister.
I hooked up a 24V power supply and its been working good :slight_smile:
Also a temp sensor to monitor if the water is above 20 degrees Iā€™ll add some chemicals so we dont get legionnaires disease.

I have two tanks connected, with some water retention at the top.

Same here; my tank is about 3.8m deep so I went for 5 metres range and 0 - 5v, measuring voltage with ADS1115 ADC. My lines are 25m long (and include a Dallas sensor as well) I also measure network pipe pressure (another pressure sensor through another channel on the ADS1115 (the pump needs an automation on it to ensure it is turned off when the water level gets too low)

Worked now for about two years.

Hey Julian, are you doing this with ESPHome?