Introduction: Betta Fish Feeder
I'm setting up a betta fish tank and wanted to make an automatic fish feeder so he never misses a meal. I've seen other DIY fish feeders that just shake a container but I wanted to be able to precisely control how much food he'll get. Hope the new fishy likes it!
Follow my other projects on Instagram @Trevor_DIY
Purchasing through the following affiliate links supports me as a maker :)
Supplies
Step 1: Wire Up the Motor Driver and Stepper Motor
Yes, to run a stepper motor with Arduino, you MUST have a motor driver! There's heaps of info online about this but the quick and dirty reason is because the Arduino output pins are not able to supply the stepper with enough current (amps) to get the coils in the stepper to engage. I chose this stepper and motor driver because it can work off 5V which the Arduino has an output for.
- Plug the stepper into the motor driver with the white connector.
- Connect the Arduino output pins 8, 9, 10, 11 to the motor driver input pins 1N1, 1N2, 1N3, 1N4 respectively.
- Connect the Arduino power pins GND and 5V to the motor driver power pins - and + respectively.
- Connect the Arduino USB port to your computer and start the Arduino software.
Step 2: Feeding Mechanism
I used Autodesk Inventor to design the 2 parts to be 3D printed. The “Turn_Table” has 14 wells for fish pellets which means I can feed my fish twice a day for a week. The motor rotates the “Turn_Table” over the “Plate” which pushes the pellets forward until one well is dumped through the hole in the “Plate”. It's pretty similar to how a gumball machine works!
Step 3: Program the Arduino
This code is really simple since I am using the Arduino stepper.h library. The goal is to have the stepper rotate the turn table by one well so it dumps the next set of food into the tank. I’ve commented out the code so the details are below.
//This adds the preexisting stepper library so you can use commands like "myStepper.setSpeed()" and "myStepper.step()" #include <Stepper.h> //This is the number of steps in one revolution of the motor. The 28BYJ-48 motor has 2048 steps per revolution. Make sure to find the number of steps of your motor. const int stepsPerRevolution = 2048; // initialize the stepper library on pins 8 through 11: Stepper myStepper(stepsPerRevolution, 8, 9, 10, 11); void setup() { // set the speed at 10 rpm: myStepper.setSpeed(10); } void loop() { // 146 steps is 1/14th of a full rotation. Since I have 14 wells, this will index the feeder one space. myStepper.step(146); //This kills the power to the stepper to save energy and to keep it from heating up. digitalWrite(8, LOW); digitalWrite(9, LOW); digitalWrite(10, LOW); digitalWrite(11, LOW); //This is the delay between feeding times. During testing I found it helpful to use 1 second to make sure it was rotating well. //delay(1000); //Pause for 1 seconds delay(28800000); //Pause for 8 Hours //This section is the same as above but allows for a different delay time. After breakfast, it waits 8 hours until dinner time. Then it waits 16 hours until breakfast time. myStepper.step(146); digitalWrite(8, LOW); digitalWrite(9, LOW); digitalWrite(10, LOW); digitalWrite(11, LOW); //delay(1000); //Pause for 1 seconds delay(57600000); //Pause for 16 Hours }
If the stepper is just twitching instead of rotating, check to make sure the wires on 8-11 are going to the right place and pushed in all the way, this is easy to get wrong! It's best to troubleshoot it with the delay of 1 second to see the stepper moving.
Attachments
Step 4: Assembly
You may want to sand down the two faces that will be sliding against each other to make sure they move smoothly.
- Use a small amount of hot glue to attach the Plate to the face of the stepper.
- Press the Turn Table onto the shaft of the stepper.
- Run a full rotation to make sure the parts are sliding smoothly. You may need to raise or lower the Turn Table so you don't have too much friction against the plate while it tries to rotate.
- Load up some food and do a test feed!
Step 5: Attach the Feeder
I just used hot glue to attach my Arduino, motor driver board and feeder to the outside of the tank. Hot glue is super easy to remove with acetone if I change my mind or decide to recycle the project. You can power the board with a USB cord into an outlet (not your computer since it will reset if you shut your computer off) or using a standard Arduino power supply.
Step 6: Run Your Fishy Feeder
Keep and eye on your contraption to make sure it's working so your fish doesn't go hungry! Happy building :D
Thanks for reading and be sure to follow my other projects on Instagram @Trevor_DIY
Check out my other favorite projects:

First Prize in the
Pets Challenge
1 Person Made This Project!
- TK_Chang made it!
28 Comments
Question 1 year ago on Step 2
Hi, I've almost got this working perfectly. Is there any chance you could add an .stl of the plate without the cutout, to be used as a cover on the top?
Question 1 year ago
I made it but it doesn't seem to have enough power to move it, it just struggles, moves just a little or doesn't move at all it will move the exactly rotation sporadically.
2 years ago
Thanks for the project. I'm having the same issue as joeny1980. I can't get my slots to consistently align with the hole. I tried changing the rotation speed, stepper rotation, etc. I tried sanding the surfaces as well. Any suggestions? I mean, it works, but just a little inconsistent.
3 years ago
Thank you for the project. I made this, but haven't used it yet. In my test, the slots arent perfectly aligning with the hole. But its not consistent either, sometimes it doesnt turn all the way. Any tips on calibrating it? Also, with a 5v 1amp power adapater it didnt seem strong enough to move, but when its connected via the usb (like when programming it) it moves fine.
3 years ago
Is there any problem with power loss or does it just soldier on?
3 years ago
I love it, great little project.
The only concern I have is that my Beta tends not to eat unless I get his attention first. Meaning if I throw a couple pellets in they’ll just sink to the bottom and he’ll miss them. I’d like to add some sort of visual cue like a blinking led just prior to the stepper engaging to drop the food in to get his attention. But such an addition is entirely out of my skill set.
Nice work
3 years ago
Agradecería me diga Como quedaría el código. Si tengo rtc. Lcd .
Reply 3 years ago
Lo siento, nunca he usado rtc. El reloj funciona bien para este proyecto.
Question 3 years ago
So if I wanted to scale this up to feed a dog, can you recommend a controller board and more robust motor?
Answer 3 years ago
A dog?
It is better to get someone else to feed the dog if you are going some where,
I would never trust a system like this to feed my dog (not that I have one).
Reply 3 years ago
No, you misunderstand. I would be around. The plan is to wire this up so when my dog Buddy fetches a Doppelbok beer from the cooler, and drops it in the cupholder beside my Lazy-Boy chair, then the device automatically feeds him. No Doppelbok, no dinner. He's smart, Buddy is, but he needs to earn his keep.
Reply 3 years ago
Cool!
sorry for the misunderstanding.
Reply 3 years ago
Hi there,
Happy to recommend some things, but first a word of caution. I wouldn't use a system like the one I've designed for more than 1 or 2 automated consecutive meals for a dog. If the system fails for any reason, a dog is much less able to go without a meal and could potentially hurt itself trying to get into the feeding mechanism for its food. Please keep this in mind and use your best discretion as a pet owner :)
For the stepper, I would recommend this NEMA stepper.
For the driver, I would recommend this shield.
Keep in mind, you will need to supply the shield with more power than the Arduino board is ready to output so the driver would need something like this power source.
Let me know if you have other questions!
3 years ago
First of all, this is a great project!
However, correct me if I'm wrong, but isn't the arduino's delay function a bit inaccurate ?(for example a delay of 1000 milliseconds in the arduino code will produce a delay of slightly more than 1 second in real life)
Based on my experience trying to make an arduino clock without an external real time clock chip, the timings will drift slightly and eventually add up causing a significant difference.
Reply 3 years ago
Hi Hendrick,
Thanks for the input and you are absolutely correct, the internal arduino clock is fairly inaccurate and will drift over time. Over the past 2 weeks of feeding, it has drifted a few seconds but for this application, that's a pretty acceptable error. I wouldn't set my watch to the arduino clock but it seems to be accurate enough for approximate feeding times.
If you are worried about drift, I'd recommend either getting an external clock chip like you said or just unplug and plug it back it at feeding time every few weeks to reset the offset.
Thanks!
Trevor
Reply 3 years ago
Thanks for the tip!
3 years ago on Introduction
Hi
This is quite clever. I have forwarded it to others who I suspect will be keen to see it.
I suggest you not pre-load too much betta food in a high humidity environment. It will be soaking up air moisture as it sits in the dispenser tray. For instance, I wouldn't pre-load a week's worth of betta pellets in August in Rhode Island unless the house had central air conditioning. Any fish food that has desicant packets inside the container can rot if it soaks up moisture too far in advance of being eaten.
Reply 3 years ago
That's a great point! I'm in a pretty desert climate but for anyone in a more humid environment should definitely consider this. Maybe I'll see if I can modify it to be enclosed with a desiccant packet too!
Reply 3 years ago
maybe modifying the feeding mechanism with a lid? preferably from clear plastic so you can check remaining food without opening it?
Reply 3 years ago
In fact, my purchased automatic fish feeder got clogged (the outlet) somewhere in-between my three weeks absence. Some tiny fishes went missing from the aquarium by the time I came back.