ESPHome water level sensor

Have you tried your solution ? Does the LM317 getting hot any more? I have the same problem feeding 24V.
I am thinking to change the R4 instead of R2.
According to the datasheet, with R4=1K and R2=240Ω the output voltage of LM317 will be about 7 V which is inside the range of 3-10 V supply voltage of LMC7660.
With the module as is, the supplied voltage of LMC7660 is about 10.65 V which is above the absolute maximum range of 10.5V the datasheet suggests. It can burn any time.

Update: I’ve changed the resistor as I wrote above, and with 24V the module works very well now without the LM317 getting hot.

1 Like

I’ve got difficulties to replicate this mounting.
I’ve got a water level sensor which output 0-10V and I have to divide the voltage to 3.3 using resistors.
I think my ADS1115 might have fried with this mounting (sorry for my poor english)


I know something is wrong but after many hours, I can’t find what.
Help will be gladly appreciated

Your voltage divider is incorrect. Have a look here as how to wire. I am not an electronics expert but I can see this bit is wrong. I would test the ADS115 with a 3.3v battery to see whether any A0,A1, A2 and A3 are still working?

In me case R4 is 1.8K, I fixed 3 modules and they have been working for more than a month

I am hoping to use a couple of 5v pressure sensors. I plan on powering the ads1115 with 5v so hopefully that side of it will be fine but my question is it safe to connect the ads1115 directly to the esp or do I need to use something like a digital level shifter inbetween the esp and ads1115

You can connect it directly. Remember same GND and wiring is i2c.

Hi guys.

First time posting here…
I have rain water storage near to 9.000 liters (round shape, max height 185cm).

1st setup:
ultrasonic measurement to detect height of water surface. It was working okay, but many huge spikes and after 6 months died because of moisture inside sensor → crap.
2nd setup:
Drop in preassure sensor 4-20mA, 0-2m with INA219. Was working good with small up and downs every day (no water level change) up to 1% maybe (usually 0,6%). And then about week ago INA219 suddenly stop working and can’t figured out why. On desk it’s working if I try with some DC consumable device as soon when I put it back to water measuring box with pressure sensor don’t want to work, I2C recognize it normally. Ordered new one last week.
3rd setup (actual):
I have on spare ADS1115 and current to voltage converter HW-685 so I make by @quizzical idea. Yeah, it’s okay, it’s working maybe with higher accuracy, but drifting a lot depend of ambient temperature, where I have this wired up (outside in shadow under the roof). Please check pic below (upper trend water height in centimeters, bottom trend outside temperature which is measured few cm out of the wiring box for water level). You can see at 18:00 temperature spike because sun shine direct on temp sensor for about an hour - I exposed to test this.

This is every day drifting, if sun shine direct into wiring box and warm it for few degrees then water level go up and vice versa. In percentage for me this is between 99% and 101%. More than I have with INA219. Actually if I’m looking on past trends when measurement was done by INA219 there was no drifting because of temperature, only jumping up/down for max 1%.

Which components are exactly being exposed to temperature changes?
In my case it’s only the pressure sensor that is outdoors (and that sensor is of course underwater). Then a cable goes to my basement where I have all the electronics. Obviously I don’t have too heavy temperature changes in the basement.

Hi @quizzical,

First of all, thank you for your idea and schematics. It helps a lot.

So, I have concrete storage tank buried in the ground, only cover is in line with grass/surface. So from that point of view temperature change of rain water inside is minimal and veeeery slow. From side below the concrete cover I have hole with plastic pipe where I insert pressure sensor TL163 and drop it to the ground of tank. Sensor cable (5m) goes under surface into plastic box where I have everything wired with wemos d1 mini. See picture below. On left site of box I have outside temp and humidity measurement with bme280 and on right site outside light intensity with bh1750.

do you use the temperature and humidity to adjust fro fluctuations in pressure (readings)? I have fluctuations with my in-ground tanks. I have not been able to definitively determine if it’s temperature, humidity or air pressure influencing looking at the data side by side. I have a Davis weather station 6 meters above my tanks.

No, I don’t use this data to adjust water level readings.

By the way, I’m pretty sure that impact to water level readings is outside temperature and not air preassure. Check graph below from yesterday. Water level drift is exactly same shape as temperature. So there must be some element (probably resistor or even trimmers on I to V converter) who has to big temperature tolerance and with few degrees change its value and this corespond to measuring result.

Hi Bart, do you mind sharing your wiring diagrams?

Interesting. I’ll pull mine up for the same period and have a closer look, although I think I already did this and couldn’t see a direct correlation. My tanks are 40,000l and 90% underground. Even my pool temperature doesn’t change radically.

I would agree that it should not be linked to air pressure. I am assuming that your pressure sensor has in addition to the 2 wires a small tube in the cable that you made sure is outside of the water and not in an airtight container that neutralises any pressure differences.

As you can see below there is no link between the temperature and the water levels in my case, but my electronics are not exposed to those air temperature differences. (the sudden spikes in water levels correspond to moments that we were in the pond :slight_smile: )

correct, as all TL-136 models also this one have togheter with +/- wires one small tube. I know, this is for outside air compensation and should not be blocked - and it’s not of course I pay attention on this (in past I work with industrial preassure sensors, radars, all kind of measurement solutions, etc.). I have my wiring box very close, but 5m of original cable is just a little bit to short to reach my box, so I proffesionaly extend + and - wire for about a meter, but small pipe hose is free inside protection installation hose where I run the cable under the ground. This protection hose I put in ground exactly for this preasure sensor to have level measurement, it’s dry and open on both sites (inside tank just below the cover and on the other side below wiring box 2m away where cable comes out.

Anyway, today at around 17:00 I move my wiring box behind the wooden board where it was a little bit exposed to sun in afternoon. Now is in shadow and immediately when I move it behind, temp. start falling slowly by 0,1°C per few minutes maybe and therfore also sensor level value start to stabilize, but then I notice also decreasing value. Of course, no change of water level.

Thanks to advice given by @JulianDH here in this thread, I went for QDY30A sensor (25m long cable, up to 6m measurement, 0-5V output): https://www.aliexpress.com/item/4000041842214.html?spm=a2g0o.order_list.order_list_main.79.8cc51802eFJ3Fb
I used Wemos D1 mini and ADS1115 to measure voltage. I am using 24V power supply and XL4015 stepdown module (https://www.aliexpress.com/item/32675514763.html?spm=a2g0o.order_list.order_list_main.121.8cc51802eFJ3Fb) to convert 24V to 5V to feed Wemos and ADS1115. Sensor is powered directly from 24V power supply.
Below is the code I am using, aside from water level, I also average my voltage measurement (just to make it easier to calibrate sensor). I still need to calibrate in larger tank, but I do not have anything to use at the moment. I am planning to mount the sensor in the 23m deep well in 2 days.

Code:

i2c:  
  sda: 04
  scl: 05
  scan: true
  id: bus_a

ads1115:
  - address: 0x48

sensor:
  - platform: ads1115
    multiplexer: 'A0_GND'
    gain: 4.096
    name: "Vyska Hladiny"
    id: wtd
    internal: false
    unit_of_measurement: 'm'
    accuracy_decimals: 3
    icon: "mdi:water-percent"
    update_interval: 1s
    filters:
      - median:
          window_size: 30
          send_every: 30
          send_first_at: 30
      - calibrate_linear:
          - 0.189 -> 0.228
          - 5.000 -> 6

  - platform: ads1115
    multiplexer: 'A0_GND'
    gain: 4.096
    name: "Napatie"
    internal: false
    unit_of_measurement: 'V'
    accuracy_decimals: 3
    icon: "mdi:current-dc"
    update_interval: 1s
    filters:
      - median:
          window_size: 30
          send_every: 30
          send_first_at: 30

And this is how it looks so far. Plastic cap will be at the top of well (concrete plate serving as cover, there is hole in it to put the sensor in, cap will hold it on the cover)

Really good job. Be careful of supply to ADS1115. You said 24v ! Data sheet says 6v maximum. I think 5v would be fine. That means maximum measurable voltage on A0 pin will be the supply voltage ( reference voltage).

Wemos and ADS1115 are powered from the stepdown module (means they both are using 5V directly from the stepdown module).
Only QDY30A gets 24V.
I will post couple pictures once I mount it and (hopefully) it will work as expected.

Be carefull. Don’t buy sensors on the shop “SENSOR WOLRD” on AliExp. They ignore me since 2 months. I have a problem with the sensor, they read my messages but they don’t help.

I managed to mount the sensor on the well, but did not realize one thing - electric box that is near the well is switched by pressure sensor inside the house. That means it has no constant power and turns on only while pump is running. That opened another challenge - drag electric cable from inside the house. This will be done in coming days/weeks.
I have tested only by connecting it to extension cord, works OK. However I would like to be able to see the trend, etc.
In the meantime, attaching only photo of installation.
One thing that surprised me - I was expecting to be able to “feel” when the sensor hits the bottom. But I could not - I assume the weight of 25m of “hanging” cable is more than sensor itself. Just stating it, it is definitely at the bottom of the well.