Betta Fish Feeder Using Arduino

Betta Fish Feeder

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

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.

  1. Plug the stepper into the motor driver with the white connector.
  2. Connect the Arduino output pins 8, 9, 10, 11 to the motor driver input pins 1N1, 1N2, 1N3, 1N4 respectively.
  3. Connect the Arduino power pins GND and 5V to the motor driver power pins – and + respectively.
  4. Connect the Arduino USB port to your computer and start the Arduino software.

Step 2: Feeding MechanismFeeding 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 ArduinoProgram 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.

Read more: Betta Fish Feeder

Leave a Comment

Your email address will not be published. Required fields are marked *