Updated November 2026
A diy automatic pet feeder using raspberry pi is a practical project: a small computer runs a timer, a motor turns a dispensing mechanism, and the feeder drops a measured portion at set times. In this guide you will learn which parts to buy, how to wire and test the hardware, how to schedule meals with a short Python script, and what usually goes wrong. The project takes a weekend for most people with basic electronics comfort.
Parts and Tools You Need
Most builds use a Raspberry Pi board, a microSD card, a 5V power supply, a small servo or stepper motor, and a food reservoir with a rotating outlet. A relay or motor driver board protects the Pi from current spikes, and a real-time clock module keeps time if the Pi loses power.
Shopping for one? See our guide: 4 Best Automatic Pet Feeder PetSafe Models Compared (2026).
- Raspberry Pi with a 16 GB or larger microSD card running Raspberry Pi OS
- Servo or stepper motor rated for your food reservoir weight
- Motor driver or relay module and jumper wires
- Real-time clock module (such as a DS3231)
- Food-safe container with a rotating disc or auger outlet
- Dedicated 5V power supply with enough amperage for the motor
Wiring the Hardware Safely
Connect the motor to the driver board, not directly to the Pi’s GPIO pins. Power the motor from its own supply and tie the grounds together so signals reference the same ground. Keep food and water away from exposed wiring, and mount the Pi in an enclosed box.
- Power off the Pi and unplug all supplies before wiring.
- Connect the real-time clock to the I2C pins (SDA and SCL) and enable I2C in the Pi configuration menu.
- Wire the motor driver’s control pin to a free GPIO pin, typically one you note in your script.
- Connect the motor power to the external supply and share ground with the Pi.
- Test each connection with a multimeter before powering on.
Writing the Feeding Schedule Script
A simple Python script can read the time and trigger the motor at set hours. Use the scheduling library or a cron job so the feeder runs even after a reboot. Calibrate the motor run time by dispensing into a measuring cup and adjusting until one cycle matches your target portion.
Calibrating Portions
Dispense five test cycles and weigh the output on a kitchen scale. Divide the total by five to get a per-cycle weight, then set the number of cycles per meal to hit your target. Recheck after changing the food type, because kibble density affects the result.
Testing and Making It Reliable
Run the feeder empty for a full day before loading food. Confirm it fires at the right times, stops after each cycle and restarts after a power cut. Add a log file so you can see every dispense event when you check back later.
Common mistakes
- Powering the motor from the Pi’s 5V pin, which can cause brownouts and corrupt the SD card.
- Skipping the real-time clock, so schedules drift or reset after an outage.
- Using a motor too weak for a full reservoir, leading to stalls and jams.
- Leaving the feeder unventilated, which invites moisture and mold in the food.
- Not checking food freshness, since a homemade system still needs regular cleaning.
Recommended gear
A reliable power supply and an enclosed housing matter more than fancy features in this project. For a sturdy dispensing body, many builders start from a commercial feeder shell.
- A dedicated 5V USB power supply rated for Raspberry Pi use: View on Amazon
- A DS3231 real-time clock module for keeping accurate time: View on Amazon
- A weatherproof project enclosure to protect the Pi from pet dander and moisture: View on Amazon
FAQ
Do I need programming experience to build this?
Basic Python and Linux command-line skills are enough for a simple timer script. Beginners can copy a working example and adjust the times and pin numbers.
Is a homemade feeder safe for my pet?
It can be, provided food is stored in a sealed, food-safe container and the mechanism is cleaned regularly. Consult your veterinarian before changing your pet’s diet or feeding schedule.
Can the feeder work during a power outage?
Not without a battery backup or uninterruptible power supply. The real-time clock keeps time, but the motor and Pi need power to dispense.
Conclusion
A diy automatic pet feeder using raspberry pi gives you precise control over timing and portions for a modest parts list. Calibrate carefully, power the motor separately and test thoroughly before relying on it. If you prefer a ready-made option, compare models in Wopet Automatic Pet Feeder: 4 Best Picks Compared in 2026 before deciding.

