Betta Fish Feeder

25,213

102

22

About: San Diego maker. I look for old or abandoned materials that can be recycled into something new!

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.

  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 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.

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.

  1. Use a small amount of hot glue to attach the Plate to the face of the stepper.
  2. Press the Turn Table onto the shaft of the stepper.
  3. 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.
  4. 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:

Pets Challenge

First Prize in the
Pets Challenge

Share

    Recommendations

    • Growing Beyond Earth Maker Contest

      Growing Beyond Earth Maker Contest
    • Sew Tough Challenge

      Sew Tough Challenge
    • Beauty Tips Contest

      Beauty Tips Contest

    22 Discussions

    0
    None
    provadance

    Question 20 days ago

    So if I wanted to scale this up to feed a dog, can you recommend a controller board and more robust motor?

    4 answers
    0
    None
    Arbormakesprovadance

    Answer 13 days 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).

    0
    None
    provadanceArbormakes

    Reply 12 days 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.

    1
    None
    Trevor_DIYprovadance

    Reply 20 days 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!

    0
    None
    Hendrick Sebastian

    15 days 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.

    2 replies
    1
    None
    Trevor_DIYHendrick Sebastian

    Reply 14 days 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

    3
    None
    esther.p210

    26 days 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.

    5 replies
    1
    None
    Trevor_DIYesther.p210

    Reply 26 days 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!

    0
    None
    MikeC150Trevor_DIY

    Reply 15 days ago

    maybe modifying the feeding mechanism with a lid? preferably from clear plastic so you can check remaining food without opening it?

    0
    None
    Abhijit Borahesther.p210

    Reply 21 days 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.

    0
    None
    esther.p210Abhijit Borah

    Reply 21 days ago

    Sorry for the loss of your three fish. The ones that remain probably ate the ones that are missing. Fish aren't sentimental.

    0
    None
    Trevor_DIYAbhijit Borah

    Reply 21 days ago

    Oh no! Well hopefully this one is more reliable than the purchased ones :P

    0
    None
    snorlaxprime

    21 days ago

    Great idea, my kids just get a few Betta, recently, they are still very excited and feeding them regularly, I suspect when the novelty runs on, this will be a perfect solution.

    1 reply