Make a Smart Automatic Pet Feeder with Arduino Uno (Cont.)

automatic pet feeder

Cont. from Part 1 Here >

Step 4: Adding the RFID

The RFID will be used as a key for the system. When your pet is close to the feeder, the RFID will read the value from the tag and will decide whether to supply more food or not. The RFID system uses SPI communication and stores the values from the tags in EEPROM memory. In this case, if the system breaks down (e.g. due to a power supply issue), the information will still be in the memory.

For more information on Arduino SPI Communication, please refer back to Arduino Communication Protocols Tutorial.

For the RFID, the following libraries must be added:

  • SPI
  • MFRC522


automatic pet feeder

Figure 13: Wire diagram with RDIF added


automatic pet feeder

Figure 14: Connection between RFID and the rest of the components


We have 2 RFID tags. The red one will be attached to a pet and the blue one, for the sake of testing, will be attached to an outsider (i.e. basically not your pet/something else). The system has 2 functions:

  1. Day: during 8am-8pm the feeder will release food 3 times every 4 hours. The signal that determines food arrival is a sound made by a buzzer that calls your pet to come and eat. When the sound is generated, the pet knows that it’s time for a meal and it will come closer to its bowl (food container). When the tag is near RFID reader, the food will come out.
  2. Night: no sound is made, but if the pet approaches to the RFID after 0am, it will have one-time meal.


automatic pet feeder

Figure 15: Tags assigned shown on serial monitor

Step 5: Adding the motor

We’ll be using servo motor SG90. It has an wide angle for servo (0-180 degrees). Our locking system will be similar to lock controlled by an angle (we will control how much food is released when the “lock” is opened/unlocked).

Here are some important points:

  • 0 degree: “Lock” is totally closed and there will be no food released;
  • 180 degree: “Lock” is totally opened and all the food will be released;
  • Between 0-180: you can choose how much food you want to release.


automatic pet feeder

Figure 16: Wire diagram for the whole project


Step 6: Building the mechanical part

Before we can talk about the programming of the motor, we need to build support for the feeder. Now is a good time to look into the mechanical part of the feeder. We’ll need the following material:

  • A metal plate (or a wooden board)- 35×25 cm
  • A bottle (or plastic container)
  • 2 x pieces of hard material for the food dispenser opening/closing


  1. Fix the bottle on the metal plate
    With a drill you need to make 4 holes on the metal plate, leaving space for the bowl (this distance depends on how tall your bowl/food container is. After that, you need to attach the bottle upside down with two wires connected to the plate.


automatic pet feeder

Figure 17: Bottle (food dispenser) attached to the metal plate using two wires


The “lock” system can’t stand in the air so we need to fix it with a piece of hard material. This provides a nice opening of the food dispenser. This also needs to be fixed with drills or tape it to the metal plate, so it doesn’t collapse in case you put a lot of food in the dispenser. As you can see in the picture below, the metal part is bent on the outer edge in order to prevent the misalignment of the lock.


automatic pet feeder

Figure 18: How to position the stand

  1. Placing the servo motor
    We need to attach the motor to the metal plate. I drilled into the metal plate to securely fasten the servo.Next, we need to connect to servo motor to the mechanical system that opens and closes the lock by sliding the cover. This is done by in the middle of the cover plate (near the outer edge) and connecting it to the motor using wires (Figure 17). You can use any material to do this, really. You just have to make sure the cover opens and closes as it’s supposed to.
automatic pet feeder

Figure 19: Finding the right place to drill a hole to wire to the motor

You’re pretty much done at this point. All you need to do is to fix the feeder wherever you wish, preferably in a safe place where your pet can’t demolish the feeder.

automatic pet feeder

Figure 20: Catching the motor near the stand

For better precision, it’s recommended that you don’t curve wire that connects the food dispenser cover to the motor because otherwise, it can diminish the force of the motor.

automatic pet feeder

Figure 21: Complete pet automatic feeder


automatic pet feeder

Figure 22: The final product

This concludes the first portion of this project. This device combines my passion for electronics and programming but also relieves me from having to feed my pet multiple times a day. This represents the perfect balance between a simple project and a practical invention for your home. In the next portion, we will look into advanced user interface where you can control feeding wirelessly…