Arduino Automatic Fish Feeder Tutorial

This week marked the end of Fall quarter and the beginning of Winter break. My husband I are planning to visit family over the holiday, but we didn’t want to leave our little betta fish, Normy, without food while we’re gone. Enter the perfect opportunity for our very first Arduino project.

My husband and I have been wanting to play around with an Arduino since we heard about it a couple months ago. An Arduino is a circuit board that allows you to easily control an electronic device with your computer. My husband is a software developer, and I’m studying manufacturing engineering so the Arduino gave us an easy way to combine our skills on a project.

Keeping with the Arduino theme of open source DIY projects I decided to turn this little fish-feeding adventure into a tutorial for anyone to enjoy.

In this tutorial I’m going to assume that you are familiar with the Arduino development environment. If this is not the case check out this link on how to get started with Arduino: or this cool video:

What you will need:

  1. Small Container for fish food (I used a little plastic dressing cup)
  2. Your standard fish food (I used flakes but pellets would work too)
  3. AC to 12 V DC Adapter (9V would work too)*
  4. Standard Servo Motor
  5. 3 wires
  6. Arduino Uno Board
  7. Container for your electronics (min size: 2″ X 2 1/2″ X 3 1/2″)

*For more adapter specs click here


  1. Double-Sided Tape (or super glue)
  2. X-acto knife
  3. USB to B Cable
  4. Optional: Drill or Dremel

Step 1:


Prepare your fish food dispenser by cutting a small hole into the side of the cup. The size of the hole will depend on what type of food you are using. If you’re using flakes cut a small slot and if you’re using pellets cut a small round hole. Start with a small hole first!

Step 2:


Put a little food in the container and test that enough food comes out when you rotate it, if not cut the hole a little bigger. One thing to keep in mind is that you don’t want to feed your fish too much while you’re gone or you’ll come home to a very dirty fish tank.

Step 3:


Attach the servo horn to the bottom of your food dispenser. My cup was really light so I was able to used double-sided tape. If you’re using a heavier or bigger cup you might want to use something stronger like super glue.

Step 4:


Now that your fish food dispenser is ready you can move on to wiring your servo motor.

Yellow = Data input
Orange = Power
Brown/Black = Ground

 Step 5:


Connect the yellow lead to pin 7

Step 6:


Connect the orange lead to the 5V output and the black/brown lead to ground (GND)

Step 7:


You can now connect your Arduino to your computer via USB to program. Copy and paste the code below into the Arduino development environment and upload it to your Arduino.* The code is set so that the feeder will run every 24 hours. You can control how many hours between feedings by changing the number after “hoursBetweenMeals = ” in the code.


#include <Servo.h>
Servo MyServo;

int degreesOfRotation = 8;
int servoPinNumber = 7;
float hoursBetweenMeals = 24;
float mealDelayTime = 0;

void setup() 
    mealDelayTime = hoursBetweenMeals * 3600000;
void loop() 
    while(degreesOfRotation < 152) {
        degreesOfRotation += 1;
    while(degreesOfRotation > 8) {
        degreesOfRotation -= 1;

*A big thank you to my amazing husband for creating this code from scratch

Step 8:


Now you want to prepare the container for the components. Cut a hole in the side for the power adapter to fit through. The plastic of my container was pretty thick so I first had use a Dremel to cut the hole then an X-acto to clean it up. If you’re using a thin plastic container just the X-acto will do.

Step 9:


Place the Arduino and your servo into the container.

Step 10:


Mark and cut a hole in the lid of your container for the servo to stick out of.

Step 11:


Attach your food dispenser to the servo, and you’re ready to go. Check out the video below to see the fish feeder in action.

There are no comments published yet.

Leave a Comment