ESPHome water level sensor

@stomko i have used one of these for two years

https://m.aliexpress.us/item/3256802469432066.html?spm=a2g0n.order_detail.order_detail_item.3.5726f19cPKejHM&gatewayAdapt=glo2usa4itemAdapt&_randl_shipto=US

They have different ranges of 1m to 10m. I choose 0-5v output and used ADS1115 as the ADC. My tank is not more than 3.7m deep but still over the voltage of ESP node

The throw in sensors won’t be an option. They have a depth limit of around 4m practically.
The other important element will be the cable length is rarely longer than 4m and it’s not something that you can extend. Mounting a sonic depth sensor will be problematic in that scenario as well. I am thinking that you might have to to Mount moisture sensors at nominated intervals up the wall.

The one in the link is pressure equalised by a central tube. I have one it works with cm accurate

That vendor claims they can provide sensors up to 200m

If you choose 7m depth variant, it comes with 10m wire.

I terminate and coil excess in the tower as I then have to run it over 25m back to ESP8266. Shielded and twisted cable as running close to other cables. So my cable is close overall to 30m from sensor head to ESP

Power supply 21v which helps with distance

I have 4m deep concrete tanks and a collection of thrown in sensors from different sources, some work, some occasionally. I will stand by my statement until proven otherwise kind sir! :wink:

To help others can you identify the ones that don’t work. That may help people to keep away from those ones

Difficult with different markets and vendors and no clearly defined brands. I purchased the two I am happy with from a local Australian supplier along with a DFRobot current converter.

I have half a dozen from Aliexpress and eBay, tempting as they were so much cheaper.

@JulianDH Thanks, I was looking at these. Seller is also offering custom lengths. So I am looking for measurement up to 6m with cable at least 25m. Can I easily change that cable myself? Because obviously, price is huge with what I need.
Additional question:

  • 0-5V? 0-10V? 4-20mA? RS485?

I was thinking that RS485 could be the most precise? I have other pressure sensor that is 0-5V at home, and even with external ADC and filter, values are just fluctuating (not much, but between 3,98-4,01 bar which is enough not to have flat line :slight_smile: ) Other than that, I have no preference, I have some rs485 modules at home.

Also, due to depth, I can only estimate when sensor would be at the bottom. Does it need to be in vertical position, or can it be just put in the water? Does it need to be in the center of the well, or can it be on the side? Well is 1m in diameter, I have option to slide it in by the wall completely to the bottom.

Thanks for valiable input

Hello @stomko

I would NOT change the cable; it is a single length of waterproof cable with a pressure equalising tube in the middle of it.

I believe the correct way to use it is to choose a length that gets a termination box above the tank level. I believe the weakness of this sensor is the equalising tube. It needs to be left open, with a loop and pointing downwards and to avoid moisture/ water making its way back down the small equalising tube to the sensor (which contains a PCB circuit). I have a suspicion that some failures are because of this. I could only terminate at the top of my rainwater harvesting top turret which is very damp. Small switch box with bottom drain holes and at a level above the tank overflow pipe.

I bought a reserve sensor just in case the first failed. I read some scare stories but so far so good.

Not familiar with RS485. I just used 0 - 5v output and ADS1115. Above in this thread there is quite a bit of discussion on using alternatives.

I focussed on the main run with external grade Cat6A. Dual shielded. Left me some room on the cable to include a temperature sensor.

When you lower it in the sensor is quite heavy. I could feel it when it “thunked” on the bottom and pulled back up by about 1cm. That means you then need to secure the cable into position; zip ties and/or cable glands to keep the vertical length fixed into place.

To calibrate you will need to record with no depth i.e. out of the water and full depth. For full depth, you will need the voltage produced AND and the actual depth of the water. (Piece of string with weight)

I calculate volume of litres in tank and do some moving average filter to take out noise. Above people have posted YAML to show you how they have tried to remove that noise. If it helps I am positing my volume statistics chart. There is a million ways to do things! Good luck

the build quality of a cheap aliexpress/ebay clone. note that lack of waterproofing.

the pressure equalizing tube at the top of the cable.

my solution to managing the pressure tube is to bring the cable into the weatherproof housing via a weatherproof grommet. I usually have some loosely sealed heat shrink over the end to allow for some air flow. I have tested this with multiple units with the hosing sealed and unsealed. No difference readings.

my readings over a week on the tank currently feeding the house. there are fluctuations that roughly correlate with atmospheric conditions. most likely the control box, not inside the water tank. all these can be suppressed with filters. a quality power supply makes a huge difference.



Antonio
I haven’t located a reputable oz supplier of the 0-10v throw in sensor. Core elec only have the 4-20mA ones. Any leads?
Pat

I am now only using the 24v one from core. I run the output via a filter in my main config yaml.

I run everything off a 24v power source and ‘buck down’ for other stuff. You need to be careful with your ground wires.

I should had added, I have mains power (240v) on all tanks to drive the pumps. No need for energy efficiency/ Solar etc.

When you say be careful with your ground wires are you talking about possible bounce back from a 24v system into a 3v esp one? Do you put in a diode?
Pat

No, I didn’t use a diode on the pressure sensor, the gravity card handles everything. Unless you have a common ground between the ADC, the sensor and the microprocessor you can get inconsistent readings. Even a messy solder can throw things out.

Ok - i’ll have to take another look at the gravity one I have. I was just getting weird readings and couldn’t work out why - maybe my crap soldering. All negatives were joined. Then I stumbled on the shelly uni and 0-10v sensor. It just worked with about 5 minutes to join it together.
I really need to work out the best power source though - I put a 180Ah 12v battery connected to a solar charger into the system. It ran flawlessly for about 4 weeks. Now it’s back to only running once the panel outputs enough power. I’m tossing up whether to integrate an esp32 with sleep mode to control a relay that then delivers power to the shelly uni and sensor only for enough time to provide a good reading - about 2 minutes i reckon.
I still need to work out in HA how to have the shelly uni data retained. it’s not connected by mqtt so I can’t use the inbuilt retain value setting there.
Pat

Thanks @JulianDH i went for 0-5V version, 6m sensing range and 25m cable. I will report back onece I receive it.

1 Like

Thanks for all the above. Figured out and created a setup with the throw in liquid sensor from Gravity, combined with an Nodemcu. Got the voltage read out in HA, now struggling getting a readable format in HA. Currently only getting the voltage and want to read the volume as percentage.

Got a 5000L tank, at a ± 100% I’m getting 1.157 V as a value.
How do I create a card that shows the percentage of the tank? Or more or less the volume that is in the tank.

Thanks!

Sidenote, done this with Arduino, got a read out that was pretty accurate with the code below:

void loop() 

    {
      if (millis() - timepoint_measure > PRINT_INTERVAL) {
        timepoint_measure = millis();

        dataVoltage = analogRead(ANALOG_PIN)/ 1024.0 * VREF;
        dataCurrent = dataVoltage / 120.0; //Sense Resistor:120ohm
        depth = (dataCurrent - CURRENT_INIT) * (RANGE/ DENSITY_WATER / 16.0); //Calculate depth from current readings

        if (depth < 0) 
        {
          depth = 0.0;
        }

        //Serial print results
        Serial.print("depth:");
        Serial.print(depth);
        Serial.println("mm");
      }