0-5V Water Level Sensor + ESP32

It works! I replaced the 12v adapter with 24v and connected ESP32 ground to the power adapters V- and I'm getting proper readings. Only replacing the adapter with 24v without connecting the grounds hasn't helped, so that appears to have been a critical step.

The output voltage measured by ESP32 behind the voltage divider sits at around 0,26v when the sensor is barley submerged and at around 1,19v when at 110cm depth. Not sure how accurate the readings will be, but I just need a rough water level to know when automatic irrigation is running out of water, so should be fine.

I created a lambda to transform the voltage to water level cm in ESPHome

  - platform: adc
    pin: 32
    name: "Napięcie czujnik ciśnienia studnia"
    unit_of_measurement: "V"
    attenuation: auto
    update_interval: 5s
    filters:
      - lambda: |-
          id(adc_value) = x;
          return x;
  - platform: template
    name: "Głębokość czujnik ciśnienia studnia"
    unit_of_measurement: "cm"
    update_interval: 5s
    lambda: |-
      return (id(adc_value)-0.26) * 118;

Updated schematics:

Thanks so much for everyones help, wouldn't have figured it out on my own! :grinning:

Looks good!

1 Like

You don't need template sensor and lambdas (I expect you are not looking for ADC voltages on your dashboard). Just use linear calibrate filter.

  - platform: adc
    pin: 32
    name: "Napięcie czujnik ciśnienia studnia"
    unit_of_measurement: "CM"
    attenuation: auto
    update_interval: 5s
    filters:
      - calibrate_linear:
          - 0.26 -> 0.0
          - 1.19 -> 110

You could also add median filter for smoother output.

1 Like

I'm making something similar with a simple starters uno R3. Although my sketch is almost ready a can choose a other sensor and i'm interested in a RS485 sensor without any extra pcb. So my question: Does this sensor need to bee submerged at the bottom of the tank or well (measures water pressure?)?..i can't tell on the product web page. thx!

The sensor I'm using needs to be submerged, as it measures the pressure to which it is exposed.

I have seen other water level sensors that measure distance and they are not to be submerged, but placed at the top of the tank. The reason I haven't chosen one of those is that I have hoses and cables going down for the pump and I was afraid they would interfere with line of sight of the distance sensor. So I opted for the submergible type. They apparently also have a RS485 version. Can't say how durable they are, but mine looks pretty sturdy at first glance.

1 Like

Water Level Transmitter 4-20mA 0-10V 0-5V RS485 Submersible Level Sensor 0-5m 304SS Level Probe Liquid Level Sensor Transmitter

I thought that "Submersible" meant you can fully submerge it but not necessarily.

1 Like

No. It's measuring pressure. If you make hermetic tube from sensor to bottom of the tank, it can be out of water as well.

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.