Updated November 2026

An automatic pet feeder Arduino project lets you dispense measured meals on a schedule using a microcontroller, a real-time clock module, a servo motor and a food hopper. In this guide, you will learn which parts you need, how to wire them, how to structure the code, and how to calibrate portions so the feeder works reliably every day. The build is straightforward for a beginner, and it is a useful way to understand how commercial timed feeders work under the hood.

Before you start, keep in mind that a DIY feeder is not a substitute for a tested commercial product when your pet’s health depends on precise, uninterrupted meals. If your animal has a medical condition or a strict diet, talk with your veterinarian before automating any feeding schedule. Electrical components should also be kept away from food and water, and the feeder should never be left unattended with exposed wiring near a curious cat or dog.

Shopping for one? See our guide: 4 Best Automatic Pet Feeder PetSafe Models Compared (2026).

What You Need Before You Start

A typical automatic pet feeder Arduino project uses inexpensive, widely available modules. The core electronics are an Arduino board, a DS3231 real-time clock (RTC) to keep time even when power drops, and an SG90-style micro servo to open and close the food gate. Many builders also add a small LCD or a few buttons to set feeding times without reprogramming the sketch each time.

  • One Arduino Uno or Nano-compatible board
  • DS3231 RTC module with a CR2032 coin cell
  • SG90 micro servo or a similar small hobby servo
  • A 5V power supply sized for the servo (a separate supply is safer than powering the servo from the board)
  • Jumper wires, a breadboard or perfboard, and a small enclosure
  • A food container with a gravity-fed gate, such as a cut plastic tub or a dispenser with a sliding door
  • Optional: a 16×2 I2C LCD and two push buttons for setting times
  • Optional: a load cell and HX711 amplifier if you want to weigh portions

How the Automatic Pet Feeder Arduino Project Works

The logic is simple. The Arduino reads the current time from the RTC every second. When the time matches one of the stored feeding times, it commands the servo to rotate a set number of degrees, which opens the gate for a fixed duration. Then it closes the gate again. Portion control in a basic build depends on timing and gate geometry rather than weight, so the feeder dispenses roughly the same amount each time only if the food flows consistently.

Because the RTC keeps its own clock, the feeder still knows the correct time after a brief power outage, provided the coin cell is fresh. This is one of the main reasons to use an RTC instead of relying on the Arduino’s internal timer, which resets when power is lost.

Step-by-Step Build

Step 1: Wire the RTC and Servo

Connect the DS3231 to the Arduino’s I2C pins. On an Uno, that means SDA to A4 and SCL to A5, with VCC and GND shared from the board’s 5V and ground rails. Connect the servo’s signal wire to a PWM-capable pin such as D9. Power the servo from your external 5V supply, and tie that supply’s ground to the Arduino’s ground so the signal references match.

Step 2: Mount the Gate Mechanism

Attach a plastic flap or sliding plate to the servo horn so that a rotation of roughly 60 to 90 degrees opens a meal-sized aperture. Test the mechanism by hand before powering it, and make sure the flap seals fully when closed. Loose seals cause dribbling between meals, which ruins portion accuracy and invites pests.

Step 3: Set the Clock

Upload a short sketch using the RTClib library to set the RTC’s time from your computer. Once it reads correctly in the serial monitor, you can remove the time-setting line and upload the main feeder sketch so the clock is not reset on every boot.

Step 4: Write the Feeding Logic

A minimal sketch stores two or three feeding times as hours and minutes in an array. In the main loop, it compares the current time to each entry. When a match occurs and the feed has not already run that minute, it moves the servo to the open position, waits for the set dispense duration, and returns it to closed. Include a flag so the feeder does not trigger repeatedly during the same minute.

Step 5: Calibrate Portions

Run the feeder manually several times and weigh the output on a kitchen scale. Adjust the open duration or angle until each dispense matches your target portion. Record the average, and check it again after switching to a different kibble size, since the flow rate changes with shape and density.

Step 6: Enclose and Test

Place the electronics in a sealed enclosure above or beside the food container, never inside it. Run the feeder for at least three days with a shortened schedule, such as feeds every few minutes, to confirm the servo, RTC and gate all behave correctly before setting real meal times.

Common Mistakes

  • Powering the servo from the Arduino’s 5V pin. Servos draw current spikes that can reset the board. Use a dedicated supply.
  • Forgetting a shared ground. Without a common ground between the servo supply and the Arduino, the servo may jitter or ignore commands.
  • Letting food bridge in the hopper. Damp or powdery food clumps and stops flowing. Use dry kibble and add a gentle agitator if needed.
  • Trusting volume alone. Kibble size changes output, so recalibrate every time you change the food.
  • Leaving the coin cell dead. Replace the CR2032 yearly to keep the clock accurate through outages.
  • Exposing wiring to pets. Chewing a live wire is a real hazard. Keep cables routed and enclosed.

Tips for a Reliable Feeder

Add a simple status LED that blinks when a feed occurs, so you can confirm operation at a glance. Consider a manual override button that dispenses one portion on demand, which is useful for testing and for feeding when you are running late. If you plan to travel, a commercial unit with battery backup may be a safer choice than a prototype, since failures during extended absences are harder to catch.

  • Arduino Uno board: A well-documented controller with extensive community examples for timing and servo control. View on Amazon
  • DS3231 real-time clock module: Keeps accurate time through power loss, which is the main reason to use it in a feeder. View on Amazon
  • SG90 micro servo: A lightweight servo suited to opening a small food gate with a short, repeatable arc. View on Amazon
  • Load cell with HX711 amplifier: Lets you weigh portions directly instead of relying only on timing. View on Amazon

FAQ

Is an automatic pet feeder Arduino project safe for my pet?

It can be, if the enclosure is sealed, wiring is out of reach and the portions are verified by weighing. It is not a medical device, so confirm the feeding plan with your veterinarian, especially for animals on prescription diets.

Which Arduino board should I use?

An Uno or Nano is the most common choice because of its size, documentation and library support. Any board with I2C and PWM output will work with the same approach.

Why does the feeder dispense different amounts each time?

Variation usually comes from inconsistent flow, damp food or a gate that does not open to the same position each time. Check the servo horn for play and recalibrate after any change in food.

What happens if the power goes out?

The external supply will stop, so the servo will not move during the outage. The RTC keeps time through its coin cell, so feeds resume on schedule once power returns.

Do I need a load cell?

No. Timing-based dispensing works for many households. A load cell adds accuracy and lets you confirm each portion, which is useful for animals that need careful intake monitoring.

How do I stop the feeder from running twice in one minute?

Store a flag that records the last feed time and skip any trigger that matches it. Reset the flag once the clock moves to the next minute.

Can I control the feeder from my phone?

Basic builds do not include wireless control. You can add a Bluetooth or Wi-Fi module, but that increases complexity and should be tested thoroughly before relying on it.

Conclusion

A well-built automatic pet feeder Arduino project combines a real-time clock, a servo-driven gate and a calibrated food hopper into a dependable timed feeder. The keys are a stable power supply, a sealed gate, careful portion calibration and routine checks of the clock battery. Treat it as a learning project and a practical helper, and check any feeding changes with your veterinarian.

Ethan Brooks

About Ethan Brooks

Ethan Brooks is part of our editorial team and reviews and edits our everyday pet gear guides, checking product details against manufacturer specifications and owner feedback.