ESPHome water level sensor

This should work better for low levels.


But esphome does not support it.
1 Like

Has anyone tried using Time Of Flight laser sensors? I’m setting up rain collecting tanks around the garden as I’m trying to phase out using the brackish well for crops… Using cylindrical tanks that are too narrow to work with ultrasonic sensors and their 50 degree angle field of view.
Just ordered 4 of these: VL53L0X Time-of-Flight (ToF) Laser Ranging Sensor 940nm Breakout Modul - Hitam. These are fairly cheap at 3USD, are compatible with ESPHome, have a 27 degree FOV and seem very precise for distances up to 2m. I’m thinking of using these with ESP32’s so I can use these as Blutooth beacons at the same time. One tank may need solar power or a battery.
If I design a holder for these sensors in a 3/4 thread, I’ll post the link here.

I am using that sensor for my water softener salt level, works pretty well and is MUCH better than the sonic sensor I was using that had a lot of interference and bad readings when my dryer (sits right next to it) was running. I did have to take some measurements and use good ole slope to get my value to calculate how full it was, since obviously measuring from above. To go along with this, I do also use a couple of template sensors.

I am using a d1_mini though on the i2c bus, here is my ESPHome YAML

esphome:
  name: softenerlaser
  platform: ESP8266
  board: d1_mini

wifi:
  ssid: "wifissid"
  password: "xxxxxx"
  manual_ip:
    static_ip: xxx.xxx.xxx.xxx
    gateway: xxx.xxx.xxx.xxx
    subnet: xxx.xxx.xxx.xxx
    dns1: xxx.xxx.xxx.xxx 

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Softenerlaser Fallback Hotspot"
    password: "HotSpotPass"

captive_portal:

# Enable logging
logger:

# Enable Home Assistant API
api:
  password: "*******"

ota:
  password: "****"
i2c:
  sda: D2 # Light Blue
  scl: D1 # Blue
  scan: True
#Orange is 5v
#Brown is G

sensor:
  - platform: vl53l0x
    name: "Water Softener"
    update_interval: 60s
    unit_of_measurement: "Inches"
    filters:
      - multiply: 39.37        
  - platform: template
    sensors:
      water_softener_percentage:
         friendly_name: "Water Softener Percentage"
         unit_of_measurement: '%'
         value_template: "{{ ((states('sensor.water_softener')|float * -6.25) + 193.75)| round (2)}}"
         
  - platform: template
    sensors:
      water_softener_need_filled:
        friendly_name: "Water Softener - Needs filled?"
        value_template: >-
          {% if states('sensor.water_softener_percentage')| float < 35 %}
            on
          {% else %}
            off
          {% endif %}     

This thread is where I received some assistance from others while I tried to get it working originally:

Will this work on a water tank? I read some of the specs for a more high end model and water tends to refract the signal.

Hello, are you able to integrate this tranductor pressure on esphome? Can you share the solution? Thank you

1 Like

I’m hoping to hook up one of these float sensors to a xiaomi door sensor as the state transmitter using this technique. Hardware in snailmail. Portable rain drop sensor made with Xiaomi door sensor

I’ve got one setup and ready to put on a water tank. Read that the max distance you can measure is 60cm, which would not work for me. Let me know how you fared.

As per private message, still have not implemented this. Should work by reading voltage as per the data sheet.

Now stop me if this is a dumb idea or if I’m missing something basic (physics class was a long time ago), but is there any reason why I can’t pop a xiaomi temperature/pressure sensor in a condom and drop it in the bottom of a tank? Pressure range is up to 110kpa. That’s around 10m of water? https://m.gearbest.com/access-control/pp_626702.html

Nice idea, very imaginative. I think it could work and you would also have the temperature.
Don’t forget to tie a wire to pull the sensor up when you need to change the battery;)
Let me know if your experiment works as expected, please.

1 Like

Yep, same here, I would love to know how that works out.

I could need a sensor for the water tank of my espresso machine :smiley: :laughing: And fortunately I still have one of these aqara sensors laying around :slight_smile:

1 Like

Does anyone who knows a bit about waterproofing under pressure and water permeability of materials (and knots?) have a view on whether a condom or balloon (maybe two?) will leak water for this idea? I guess we know that a knot in a ballon is quite air tight but I don’t know how these things will hold up over time (creep)? I guess a nice silicone sealant dip could do it too but would make battery replacemnt harder. Thoughts?

Have you thought about using sealer or lamination? :slight_smile: Not sure, if these are the right terms, but here is, what I mean:

Both things could work, especially the sealer should do the trick. If I get time this weekend, I’ll experiment with both. :smiley:

1 Like

Cool. Yeah I probably won’t get to test for a few weeks. Keep me posted. I wonder if you’ll need to put a ‘sinker’ in there too?

Initial results are here: Use Xiaomi temperature/pressure sensor as water tank level sensor

@paddy0174, @malesci

For anyone wanting to implement a ultrasonic sensor as a liquid level monitor, here is a link to a very good video, Ultrasonic Level Sensors - Range, Tank Height, Fill Height and Dead Band Explained, about how to choose and setup an ultrasonic sensor as a liquid level gauge. It explains the basic things you need to know.

1 Like

I used on of those pressure transducers (5v, 5psi) to measure my 1.8m hight water tank level, connected to a Wemos D1 mini running ESPHome. Very simple to set up as a voltage sensor as the transducer simply outputs a voltage proportional to the pressure. However I’m finding it is not consistent, and varies by >30% all the time. I’m not sure why but maybe the supply voltage is not stable enough, or perhaps the influence of atmospheric pressure. Has anybody managed to get it working accurately?

I’d imagine that the atmospheric pressure is your issue. This is why when we use pressure transmitters to determine level in cases like this we (in industrial applications etc.) use pressure transmitters which give a value relative to atmospheric, so the output is automatically compensated.

I have this sensor hooked up to a 8266. Works perfectly with a 3,000 gallon 8 ft tall tank. Basically rock solid

2 Likes

Hi @teich, how did you connect it? And can you share the esphome config?

I read on the page:
We sold this product together with our Gravity: Analog Current to Voltage Converter. The converter can convert current into voltage signal which can be read…

Didi you do this? Or hook it up to 8266 directly?