Building a Smart Cat Feeder with ESPHome: DIY Pet Care Automation


Freed from the 5AM “Meow Alarm”




As much as we love our cats, there’s one universal truth every cat parent knows: the 5AM breakfast demand. If you're working long hours or often away from home, not being able to feed your cat at a set time can become a burden.

While there are plenty of automatic feeders on the market, many lack Wi-Fi integration, don’t alert you when food jams, or can’t connect to your smart home system. That’s why many tech-savvy cat owners have wondered:
“Why not build my own smart feeder?”

This guide walks you through how to build a fully integrated automatic cat feeder using an ESP32 board, ESPHome, and Home Assistant — from start to finish. The goal isn’t just basic automation, but professional-level control, monitoring, and safety.


Project Goal: Beyond Automatic, Truly Smart



This DIY feeder will go far beyond a basic timer-based device. It will include features that rival — or surpass — most commercial options:

  • Accurate portioning and timing: Dispenses the exact amount of food at scheduled times

  • Remote control: Feed your cat from anywhere via your smartphone

  • Live weight monitoring: See how much food remains in the bowl and storage container

  • Presence detection: Dispenses food only when your cat is present

  • Logging and notifications: All activity is recorded in Home Assistant; get alerts when food is low


Core Components: Hardware You’ll Need

All parts are readily available online. Here's what to prepare:

Component Description / Recommendation
ESP32 board The brain of the feeder (e.g., NodeMCU ESP32, ESP32-S3)
Servo motor Controls food dispensing (e.g., MG996R for strong, quiet action)
Load cell + HX711 Measures food bowl weight (5kg sensor is sufficient)
ToF distance sensor Detects if the cat is near the bowl (e.g., VL53L0X)
Food container/dispenser Custom 3D printed or repurposed cereal dispenser
Power + Accessories 5V 2A adapter, jumper wires, breadboard, etc.

💡 A rotating auger or screw-based design powered by the servo is more precise than a simple flap-style door.


ESPHome Configuration: Smarter with Less Code

ESPHome makes firmware easy by letting you use YAML configuration files — no traditional coding needed.

1. Calibrating the Weight Sensor (HX711)

When first connected, the load cell will not read correctly. You must calibrate using two known weights:

sensor:
  - platform: hx711
    name: "Bowl Weight"
    id: bowl_weight
    dout_pin: GPIO32
    clk_pin: GPIO33
    gain: 128
    update_interval: 5s
    filters:
      - calibrate_linear:
          - 0 -> 0.0         # Value when empty
          - 21500 -> 100.0   # Value with 100g object
      - lambda: return x / 1000;  # Convert to kg (optional)
    unit_of_measurement: 'g'

2. Servo Motor Precision Control

Use the servo platform for angle-based control:

output:
  - platform: ledc
    pin: GPIO25
    id: servo_pwm

servo:
  - id: food_servo
    output: servo_pwm
    min_level: 2.5%
    max_level: 12.5%

button:
  - platform: template
    name: "Feed Cat"
    on_press:
      then:
        - script.execute: dispense_food

script:
  - id: dispense_food
    mode: single
    then:
      - servo.write:
          id: food_servo
          level: 50%
      - delay: 1.5s
      - servo.write:
          id: food_servo
          level: 0%

3. Detecting Cat Presence (ToF Sensor)

Only feed the cat when it’s in front of the feeder:

i2c:
  sda: GPIO21
  scl: GPIO22
  scan: true

sensor:
  - platform: vl53l0x
    name: "Feeder Distance"
    address: 0x29
    update_interval: 1s

Integration with Home Assistant

After uploading the ESPHome firmware, the device will be automatically discovered in Home Assistant.

Automation 1: Feed Only When the Cat Is Present

alias: Feed at 8AM If Cat Is Present
trigger:
  - platform: time
    at: '08:00:00'
condition:
  - condition: numeric_state
    entity_id: sensor.feeder_distance
    below: 0.15  # in meters (15cm)
action:
  - service: button.press
    target:
      entity_id: button.feed_cat

Automation 2: Notify When Food Is Low

If you’ve added a second load cell to the food container:

alias: Food Supply Low Warning
trigger:
  - platform: numeric_state
    entity_id: sensor.food_storage_weight
    below: 500
action:
  - service: notify.mobile_app_yourphone
    data:
      title: "🚨 Low on Cat Food!"
      message: "Time to refill the feeder!"

Safety & Comfort: Considerations for Your Cat

  • Minimize noise: Choose a quiet motor and consider soundproofing the enclosure.

  • Protect from paws: Ensure there’s no risk of paws getting stuck in the dispenser.

  • Safe materials: Use food-safe plastics like PETG if 3D printing.

  • Manual override: Always have a backup feeding method in case of power failure.

  • Gentle transition: Place the DIY feeder next to your old bowl for a few days so your cat can adjust.


Advanced Upgrades: Multi-Cat & Camera Features

Once your feeder is working, take it to the next level:

  • Multi-cat feeding (RFID/NFC): Use an RFID reader (PN532) and collar tags to feed only specific cats.

  • Visual monitoring (ESP32-CAM): Capture a photo each time food is dispensed and send it to Home Assistant so you can see if your cat is eating.


Love Meets Tech: A Meaningful DIY Project



Caring for a pet means committing to daily responsibilities. A DIY automatic feeder isn’t just a smart gadget — it’s a reflection of your care and love.

With ESPHome + ESP32, you can build a smarter, more responsive, and fully integrated feeder that matches your routine and your cat’s needs — often at a lower cost than commercial products.

This project is not just about coding or hardware. It's about building a better life for your furry companion — with technology, love, and a bit of DIY magic.



댓글