Fish Feeder for 3 Days With LEGO, Arduino and a 28BYJ-48 Stepper Motor

Introduction: Fish Feeder for 3 Days With LEGO, Arduino and a 28BYJ-48 Stepper Motor

So how long can tropical fish survive without food?

This is arguably the most common question among fish keepers who are planning to travel in the near future. Many tropical fish can go for long time without eating.

As a fish keeper who planned to travel for 4 days I didn't really want to challenge my fish with that, so, I looked for a solution that would be short term (4 days vacation), with a little research I learned that there are many solutions for feeding fish while away including but not limited to quite a few off the shelf automatic fish feeders, or calling your mother-in-law. There is also the DIY option which has a bonus of creating something yourself.

So, I decided to build a crude, yet effective, automatic feeder.

It wasn't too hard and I learned quite a few things along the way.

I left for my vacation and .... success ... the fish were fed each day with the exact portion of food I left for them.

Step 1: Materials

The best thing about this crude fish feeder is that it is a simple assembly with no 3D printing, no soldering and really easy to assemble.

Materials required for this are:

  • 1 * Arduino (doesn't really matter which model)
  • 1 * USB Cable
  • 1 * Step Motor 28BYJ-48
  • 1 * ULN2003 Driver Board
  • Several jumper wires
  • LEGO parts (You don't have to stick with the exact LEGO parts I used, just follow the same structure principle)

Step 2: Assemble the Feeder Wheel

The feeder wheel is pretty straight forward. All you need to do is assemble 3 layers of parts.

The outside layers form the wheel and the inner layer forms the 4 partitions you place the fish food in.

Once the wheel is ready, center it on top of a 4X2 LEGO part which will be used as a connector to our step motor.

Step 3: Connect the Step Motor to the Arduino

The circuit is pretty simple, and since it is a crude and temporary 3 day feeder, we will connect it with jumper wires and not solder anything.

ULN2003 driver board IN1 <---> Arduino UNO Digital pin 8

ULN2003 driver board IN2 <---> Arduino UNO Digital pin 9

ULN2003 driver board IN3 <---> Arduino UNO Digital pin 10

ULN2003 driver board IN4 <---> Arduino UNO Digital pin 11

ULN2003 driver board “+” <---> Arduino UNO Power pin 5V

ULN2003 driver board “-“ <---> Arduino UNO Power pin GND

STEP MOTOR <---> ULN2003 using the 5 wire connector coming out of the STEP MOTOR

Step 4: Connect Your Feeder Wheel to the Stepper Motor and Test

Now that we have our stepper motor connected with the Arduino via ULN2003 driver we can assemble the feeder wheel to the motor and test it.

Connect the 4x2 LEGO part to the stepper motor axle and assemble the feeder wheel centered on top of the 4x2 LEGO part as appears in the pictures.

Once you're done, upload the sketch and test your assemblies.

If everything was assembled correct, after a 1 minute delay from sketch upload or Arduino reset, the feeder wheel will rotate 90 degree counter clockwise.

Our program loop is set as follows:

  • Wait for 1 minute
  • Rotate 90 degree counter clockwise
  • Wait for 24 hours

This repeats so as long as the Arduino wasn't reset, the feeder wheel is expected to rotate 90 degree every 1 day + 1 minute + the rotation time, which is good enough for our crude 3 day feeder.

Step 5: Build a Mounting Frame, Mount to Aquarium and Test Test Test

Now we will need to mount the fish feeder to our aquarium and test it.

You can build the mounting frame in many ways and don't have to use the exact same parts as I did, but, here are some reference photos to my mounting frame.

Once the fish feeder is assembled, we'll need to test it.

First, test that it rotates freely 90 degrees in the desired direction one minute after powering up the Arduino via our USB Cable.

If it doesn't rotate to the correct direction you can alter the 3rd line in our code loop function from:

Step(-512/4);//Stepper motor backwards (counter clockwise) 512/4 steps ---- 90 deg angle


Step(512/4);//Stepper motor forward (clockwise) 512/4 steps ---- 90 deg angle

This will reverse the rotation direction.

Next, test that the feeder can actually feed by placing a portion of fish food in the partition that is expected to face down next and resetting the Arduino. After 1 minute you should see the food falling into the aquarium.

The next step would be to test the feeder for a few days. You could load food to each of the partitions and see that it operates correct for at least three days.

If all went well, you're done.... CONGRATULATIONS, you built yourself a crude 3 day fish feeder.

For Conclusion:

I leaned quite a lot from this project and have a few ideas for improvements like:

- Clock based scheduled feeding

- Making the feeder clock resilient to power outage with an RTC module and checking the time passed since last feeding

- Design and 3D print enough partitions to store food for a longer period of time (e.g., 3 weeks)

Leave a comment below to let me know if you have more ideas for improvements or if you made one yourself, what you liked about this crude fish feeder and what you think you'd like to see done different.

Arduino Contest 2019

Participated in the
Arduino Contest 2019

Be the First to Share


    • Anything Goes Contest

      Anything Goes Contest


    Penolopy Bulnick
    Penolopy Bulnick

    3 years ago

    Looks good! Nice job coming up with a DIY option for your problem :)


    Reply 3 years ago

    Thank you Penolopy