Calculating the volume of water in liters using pressure sensors

Hello Everyone

I have 7 water tanks.
One large underground tank that holds 70000 liters
and 6 that hold 4500 liters each.
I have water pressure sensors at each tank and they deliver data in the form of mV - 500mV is equal to atmospheric pressure and therefore 0 liters - the maximum voltage is 4500mV for these units.
I have used the statistics sensor to smooth out the voltage over time so that I don’t get erratic data.

My question is how to convert the mV to Liters.

The underground tank gives a reading of 4013 mV when it has 70000 liters.

the other six tanks give a reading of 2500 mV when full with 4500 liters.

This is what my yaml code for the Underground Tank looks like. All suggestions are gratefully accepted as I am very new to all this.
Cheers
Gareth

captive_portal:


sensor:
  - platform: adc   
    pin: GPIO03
    raw: false 
    attenuation: auto
    accuracy_decimals: 0 
    unit_of_measurement: "mV"

    filters:      
      - offset: 0.0
      - multiply: 2000.0 
      - calibrate_linear:
          - 0.00 -> 0.00
          - 2500.00 -> 2500.00
      - sliding_window_moving_average:
          window_size: 2
          send_every: 1
          send_first_at: 1

    id: underground_water_tank_level_id
    device_class: moisture            
    name: "Underground Water Tank Level"
    update_interval: 90s

  - platform: wifi_signal       
    name: "Underground Water Tank Level - WiFi Signal"
    update_interval: 90s

binary_sensor:
  - platform: analog_threshold
    sensor_id: underground_water_tank_level_id
    name: "Underground Water Tank Level Full"
    threshold: 4013

Hello Gareth, This is a ESPhome yaml and you might want to properly tag this thread.

I convert mv into depth metres as it is easy for me to measure and check. My tank is a cylinder so i then create a template sensor in ESPhome to calculate the volume in litres (as I have measured the rest of the internal dimensions). Within HA i then use a statistics integration to calculate the change in the volume and therefore the flow rate. It is very rough as I find the variance in large tanks can be quite large. Just need to manage your expectations

1 Like

I believe that should be 2500 -> 4500
And then you can change the unit from mV to liter

2 Likes

Thanks Julian
I need to learn how to create a template in ESPHome to calculate the liters and the percentage of fullness.
Perhaps you could point me in the right direction.

You can create a template sensor in ESPHome which takes other sensor(s) as input and can perform logic and math on them to create an output.

1 Like