Pet water bowl monitor using HX711 and ESPHome

I’ve seen folks make sensors that could tell water level using a conductivity sensor, but I wanted one that was independent of the bowl, couldn’t be inadvertently knocked out of the bowl by excited dogs, and allowed the bowl to be cleaned easily. I figured since water is 1kg per Liter, it should be easily monitored with a load sensor.

So, I grabbed some load sensors, HX711, and an esp32 and viola! a dog bowl sensor that will not only let me monitor things on the dashboard, but I have an automation that will push a critical alert to me and flash an indicator light if the water gets below 10% level.

I started with two platforms made of bamboo cutting boards because the water bowl is on an uneven waterproof mat on my floor. Sandwiching the load sensors between the rigid boards would give me an even weight distribution.

I wired up four sensors, one in each corner of the platform, following the wiring diagram from circuitjournal. Hot glue kept everything in place

Then I wired it to the HX711 and wired them to my esp32, putting them in a small project box for neatness.

To keep the two platforms aligned, I used three pass-through pins so the dogs wouldn’t knock the sandwich apart.

esp32 code was super basic, here is the important part. I calibrated the sensor to read an empty bowl as 0 and a full bowl as 100 using calibrate_linear.

# Dog Dish configuration entry
sensor:
  - platform: hx711
    name: "dogBowl Weight"
    dout_pin: 25
    clk_pin: 26
    gain: 128
    update_interval: 60s
    filters:
      - calibrate_linear:
        - -83000 -> 0
        - -163800 -> 100
    unit_of_measurement: percent
    accuracy_decimals: 0

    # Uptime sensor.
  - platform: uptime
    name: dogBowl Uptime
    update_interval: 600s

  # WiFi Signal sensor.
  - platform: wifi_signal
    name: dogBowl WiFi Signal
    update_interval: 600s

My automation is super basic: if the bowl is below 10% for 10 minutes, it sends me a critical alert and starts blinking the alert light incessantly. I put in the 10 minute delay to allow for pulling the bowl from the sensor for refilling it.

alias: dog water critically low
description: ""
trigger:
  - platform: numeric_state
    entity_id:
      - sensor.esphome_web_8888d0_dogbowl_weight
    for:
      hours: 0
      minutes: 10
      seconds: 0
    below: 10
condition: []
action:
  - service: notify.mobile_app_phonename
    data:
      message: Hey, the dog water is critically low
      title: Dog Water Low!
      data:
        push:
          interruption-level: critical
  - repeat:
      sequence:
        - service: light.turn_on
          metadata: {}
          data:
            flash: long
          target:
            entity_id: light.alert_light
        - delay:
            hours: 0
            minutes: 0
            seconds: 20
            milliseconds: 0
      until:
        - type: is_value
          condition: device
          device_id: device
          entity_id: dogbowl_entity
          domain: sensor
          above: 30
mode: single


Then a basic gauge on the dashboard:

type: gauge
entity: sensor.esphome_web_8888d0_dogbowl_weight
name: Water Dish
min: 0.4
max: 100
needle: true
segments:
  - from: 0
    color: red
  - from: 10
    color: '#edde5e'
  - from: 30
    color: '#32d0fa'
unit: '%'

4 Likes

Nice project. You should be aware that these sensors are known to drift a bit with time. You may find you have to implement a tare function to overcome this (set a zero offset when a button is pressed). You could even implement an auto tare function like that found here: GitHub - markusressel/ESPHome-Smart-Scale: An ESPHome based Smart Scale.

Hi Tom,

I’m fine with drift. This is measuring approximate water level in a water dish for a dog.

As far as auto-tare, that won’t work at all, because the bowl is always on the sensor, and will hopefully always have water in it.

If I notice that drifting becomes a big issue, I may put in a manual tare, but until then, I’m good.

1 Like