Updated November 2026
Building an automatic pet feeder using Arduino lets you dispense meals on a fixed schedule with a simple microcontroller, a servo or motor, and a real-time clock module. This guide walks through the parts, the wiring, the core code logic, and the testing steps that keep the feeder reliable day after day. The result is a working prototype you can adjust for portion size and meal times.
Gather the Parts and Tools
Most builds use the same core components. Check that each item fits your plan before you start wiring, especially the motor and food container dimensions.
Shopping for one? See our guide: 4 Best Automatic Pet Feeder PetSafe Models Compared (2026).
- An Arduino Uno or Nano board and a USB cable
- A DS3231 real-time clock module with a backup battery
- A servo motor (standard hobby servos work for lightweight kibble) or a small DC motor with a driver
- A rotating dispenser disc or auger sized to your food container
- A 5 V power supply rated for the servo, plus a breadboard and jumper wires
- A food container with a lid, plus a shallow bowl that catches the output
Wire the Circuit and Mount the Dispenser
Connect the DS3231 to the Arduino over I2C: SDA to pin A4, SCL to pin A5 on an Uno, plus 5 V and GND. Connect the servo signal wire to a PWM pin such as pin 9, and power the servo from the external 5 V supply with a shared ground. Powering a servo directly from the Arduino’s 5 V pin often causes resets when the motor draws current. For another angle, check out Dog Crate Pet Smart: How to Choose and Set One Up (2026).
Mount the dispenser disc under the container outlet so that one partial rotation moves a single measured scoop. Test the mechanism by hand before you add any code. If kibble bridges or jams, widen the outlet or reduce the cavity depth.
Write the Scheduling and Dispensing Logic
The code has three jobs: read the current time, compare it to your meal times, and trigger one dispense cycle per meal. Store meal times as hour and minute pairs and track the last meal dispensed so the same slot never fires twice in one minute.
- Include the RTClib and Servo libraries and set your meal times in an array.
- In loop(), read the current time from the DS3231 once per second.
- When the time matches a meal slot that hasn’t run yet, move the servo through one full dispense rotation.
- Return the servo to its rest position and record that the slot has run.
- Reset the “already run” flags at midnight so the schedule repeats daily.
For portion control, the most reliable method is to count rotations rather than rely on time alone. Each rotation of a fixed-cavity disc releases a known volume, so you can match output to your pet’s daily calorie target once you measure it on a kitchen scale.
Test, Calibrate and Run Daily
Run the feeder for several cycles while you weigh each output. Adjust the number of rotations per meal until the weight matches your target. Check the clock’s accuracy after a few days, since cheap modules can drift, and replace the backup battery when the time starts resetting after power loss.
Because feeders handle food your pet will eat every day, keep all food-contact parts clean and dry. Consult your veterinarian before setting portions or changing your pet’s diet, especially for animals with health conditions.
Common Mistakes
- Powering the servo from the Arduino’s 5 V pin, which causes random resets.
- Skipping the “already run” flag, which can dispense twice in the same minute.
- Calibrating portions by time instead of weight, which leads to inconsistent meals.
- Leaving the RTC without a backup battery, so the schedule resets after a power cut.
- Using a dispenser cavity too large for the kibble size, which lets portions vary.
Recommended Gear
A DS3231 clock module with a coin-cell backup keeps meal times accurate through brief outages, which matters for a feeder that runs unattended. View on Amazon
A small digital kitchen scale helps you measure each dispense and tune portions accurately before you trust the feeder with your pet’s meals. View on Amazon
FAQ
Can I build an automatic pet feeder with Arduino without coding experience?
Yes, though you will need to follow the scheduling logic carefully. Starting with example sketches for the RTC and servo libraries makes the process much easier.
How accurate are homemade Arduino feeders for portion size?
Accuracy depends on calibration. Weighing several test dispenses and adjusting rotation counts usually gets you close, but check the results regularly.
Is a homemade feeder safe for daily use with my pet?
Use food-safe, cleanable materials and test the unit thoroughly before leaving it unattended. Ask your veterinarian to review portions and feeding schedules for your pet.
Conclusion
An Arduino-based feeder combines a real-time clock, a servo-driven dispenser and a simple schedule loop. Calibrate by weight, power the servo properly, and check the clock regularly. With those steps done, your pet gets reliable meals on time.

