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: