DIY Smart Pet Feeder: A Step‑by‑Step Guide to Building a Wi‑Fi Controlled Feeder for Precise Portion Control
Ever watched your cat stare at the empty bowl and wonder if you could have fed her a little earlier? I’ve been there – the guilt of a missed meal and the fear of over‑feeding. A Wi‑Fi feeder lets you set exact portions from your phone, so you never have to guess again. Below is the exact plan I used to turn a simple plastic container into a smart feeder that talks to your phone and your pet.
What You Need
Before you start, gather the parts. I like to keep the list short so you can order everything in one go.
1. The container
A 2‑liter food‑grade plastic tub with a tight‑fit lid works fine. I used a leftover pet‑food bin from the store – cheap and already the right size.
2. Motor and gearbox
A 5 V DC geared motor (about 30 rpm) is enough to push a small scoop out of the lid. Look for “micro gear motor” on hobby sites.
3. Microcontroller with Wi‑Fi
The ESP‑32 is my go‑to. It has built‑in Wi‑Fi, plenty of pins, and a low price tag. You can program it with the Arduino IDE – no special software needed.
4. Power supply
A 5 V USB power bank or a wall adapter with a micro‑USB connector. I prefer a power bank because it keeps the feeder running during short power cuts.
5. Scoop and guide
A small stainless‑steel spoon (the kind you find in a kitchen drawer) and a 3‑D‑printed guide that lines up the scoop with the motor’s push rod. If you don’t have a 3‑D printer, a piece of sturdy cardboard folded into a channel will do.
6. Sensors (optional but helpful)
A load cell under the container can tell you exactly how much food is left. Pair it with an HX711 amplifier board – the code is already in the open‑source libraries.
7. Miscellaneous
M3 screws, nuts, double‑sided tape, zip ties, and a small piece of heat‑shrink tubing for the wires.
Assembling the Mechanical Parts
Step 1 – Mount the motor
Cut a small hole in the lid that matches the motor’s shaft. Secure the motor with two M3 screws and a piece of double‑sided tape for extra grip. The shaft should point straight down into the container.
Step 2 – Attach the scoop
Slide the stainless spoon onto the motor shaft. The spoon’s bowl should sit just above the food level when the lid is closed. Use a zip tie to lock it in place if the fit is loose.
Step 3 – Build the guide
If you have a 3‑D printer, print a simple “U” shaped channel that holds the spoon and keeps it from wobbling. Glue the guide to the inside of the lid. No printer? Fold a piece of cardboard into a “U” and tape it where the spoon sits.
Step 4 – Install the sensor (optional)
Place the load cell under the container and connect it to the HX711 board. Secure everything with tape so it doesn’t shift when the feeder moves.
Wiring the Electronics
- Connect the motor’s two wires to a motor driver (L298N works well). The driver lets the ESP‑32 control speed and direction.
- Hook the driver’s IN pins to any two digital pins on the ESP‑32 (I use GPIO 14 and 27).
- Power the ESP‑32 and driver from the 5 V supply. Keep the ground wires together – a common ground prevents weird glitches.
- If you added the load cell, wire the HX711 to the ESP‑32’s SDA and SCL pins (GPIO 21 and 22).
Double‑check every connection before plugging in the power. A short circuit can fry the motor or the ESP‑32 in seconds.
Programming the Feeder
1. Set up the Arduino IDE
Add the ESP‑32 board URL (https://dl.espressif.com/dl/package_esp32_index.json) to the IDE, install the board, and select “ESP32 Dev Module”.
2. Install libraries
You’ll need three:
- WiFi.h – for connecting to your home network.
- PubSubClient.h – if you want MQTT control (works with Home Assistant).
- HX711.h – only if you use the load cell.
3. Write the code
The core idea is simple:
- Connect to Wi‑Fi.
- Listen for a “feed” command via HTTP or MQTT.
- When a command arrives, spin the motor for a set time that matches the portion size.
- Optionally read the load cell and report remaining food.
Here’s a stripped‑down snippet that shows the feeding routine:
const int motorPinA = 14;
const int motorPinB = 27;
const int feedTimeMs = 1500; // adjust for your scoop size
void feed() {
digitalWrite(motorPinA, HIGH);
digitalWrite(motorPinB, LOW);
delay(feedTimeMs);
digitalWrite(motorPinA, LOW);
digitalWrite(motorPinB, LOW);
}
Adjust feedTimeMs until the spoon delivers the right amount. I measured my cat’s daily intake and found 1500 ms gave about 30 g – perfect for a single meal.
4. Add a simple web page
The ESP‑32 can host a tiny web page with two buttons: “Feed Now” and “Set Portion”. The page runs on the ESP’s IP address, so you can open it from any phone on the same Wi‑Fi network.
Testing and Tweaking
- Power the feeder and open the web page.
- Try a single feed and watch the scoop move. If food spills, lower the motor speed or tighten the guide.
- Measure the amount dispensed with a kitchen scale. Change
feedTimeMsuntil you hit the target weight. - If you installed the load cell, check the reading after each feed. The code can send an alert when the food level drops below a threshold.
I spent a couple of evenings tweaking the timing, but once it was right, the feeder ran like clockwork. My dog now gets his breakfast at 7 am even when I’m still in bed.
Tips for Success
- Secure the lid – A loose lid lets the motor spin the whole container, which can be messy. Use a rubber gasket or a simple clamp.
- Protect the electronics – Keep the ESP‑32 and driver away from any spilled kibble. A small plastic box with a hole for the wires does the trick.
- Use a reliable Wi‑Fi network – The feeder only works when it can reach the router. If your garage is far from the main house, consider a Wi‑Fi extender.
- Plan for power loss – A power bank with at least 10,000 mAh gives you a full day of feeding even if the wall goes out.
- Document your settings – Write down the
feedTimeMsvalue and any sensor calibrations. If you ever rebuild the feeder, you’ll thank yourself.
That’s it – a fully functional, Wi‑Fi controlled feeder you built with a few dollars and a weekend of tinkering. The best part? Watching your pet eat exactly what you planned, while you stay in control from the couch or the office. Happy building, and may your bowls always be full and your pets forever grateful.
- → Integrating Smart Feeders with Voice Assistants for Hands-Free Feeding @smartpetfeeder
- → How to Choose the Right GPS Tracker for Your Dog: A Practical Comparison Guide @pettrackerreview
- → How to Choose the Perfect Pet Camera for Your Home: A Practical Buying Guide @pawsandpixels
- → How to Pick the Right GPS Tracker for Your Dog: A Step‑by‑Step Guide @pettrackerreview
- → Side-by‑Side Comparison: Top 5 Smart Dog Feeders Tested for Reliability and Noise @petfeedercompare