Auto Fish Feeder




About: Just an ordinary person who loves #thinking and #tinkering

How often do you ever forget to feed your fish?
Well, for me I don't forget that much. I just couldn't go out town for a couple of days and also be ridiculous if I should bring my tank along.

When I won a Sparkfun RedBoard from Sparkfun Analogy Contest, this was the first project that crossed my mind.

Here we go ...

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Bill of Materials

* Arduino UNO or compatible.
* 9V or 12V adaptor.
* 5V stepper motor from an old floppy drive.
* Tool box partition, I need a smooth one to put on top of the moving lid.
* A phone hang up switch to indicate the lid is properly closed.
* Unused harddisk enclosure as the food container.
* Broken plastic ruler or any smooth surface.
* A CCTV camera stand.
* One 10K resistor.
* Timer AC plug.

Step 2: Construction

Well the construction is all made out of junk stuffs so the main idea is on picture number 1. I cut out a hole at one end of my harddisk enclosure. Maybe it is easier for you to use mineral water bottle, but you need a post to hold the bottle upside down.

I have this CCTV camera stand and I only need to drill a hole on my enclosure and it has a perfect height for my stepper motor to fit under the enclosure (picture number 2 and 3).

Now for the moving lid I use a 5V floppy drive stepper motor with worm rail along with its moving part (the part used to carry floppy lens; picture number 3 and 4). I put a small smooth plastic from tool box partitioner on top of the lens carrier, below the enclosure's hole where the food is supposed to come out from (picture number 2). You can use broken ruler as well. Leave about half or one millimeter from the bottom of the enclosure as long as the pellets can't get through when the lid is closed.

Step 3: Enclosure Tweak

After a few days running, I found a flaw on the enclosure. No food coming out while I still have a lot remained in the container.

Then I realized that the pellets didn't flow as they should be. That was why I need a broken ruler or any smooth surface that can be fit in the container and forming a "V" shape. Now all the pellets will flow to the hole.

Step 4: Electronic Parts

Hook your stepper motor, switch, 10K resistor as picture number 1. Breadboard is for testing and easier to understand the hook up, later on you can save your breadboard for another project (see picture number 5 without breadboard).

Four pins of Stepper motor to digital pin 8, 9, 10, 11.
One leg of switch pin to 5V.
The other leg to Ground through a 10K resistor and also connect to digital pin 2.

Put the switch in front of the moving lid, and bend a metal part as a stopper(orange and red cables on picture number 3). When the switch move forward and pushed on the stopper, arduino reads HIGH on the switch pin and stop the motor.

I taped my RedBoard (arduino UNO) at the back of my enclosure and the timer plug at its side. The timer plug is used to balance the enclosure so that it can stand properly.

Step 5: Coding

Here are the codes :
(Sorry for bad indentation, I am new to instructables and I don't know how to write codes format here.)

// Start of Code //

* Automatic Fish Feeder using separate timer plug;
* Number-of-sweeps is set in the loop;
* Update to v3.1 with different speed and more pellets drop;
* chienline @2014;

#include <Stepper.h>
#define STEPS 100

Stepper stepper(STEPS, 8, 9, 10, 11);
const int switchPin = 2;
const int ledPin = 13;
int val = 80; //how wide the door open;
int fullSweep = 0;
int properlyClosed = 0;
int numberOfSweeps = 0; // this is sweep counter; setting is in the loop;

void setup() {
digitalWrite(ledPin, LOW);

void loop() {
if (numberOfSweeps < 2){ // set how many sweeps here;
if (!fullSweep){
//slower when opening to drop more pellets;
//faster when closing to reduce lid jam;

// checks if the lid is properly closed;
if (digitalRead(switchPin)==HIGH){
properlyClosed = 1;
digitalWrite(ledPin, HIGH);
fullSweep = 1;
// moves backward a little to release stuck food
// then moves forward;
if (digitalRead(switchPin)==HIGH){
properlyClosed = 1;
digitalWrite(ledPin, HIGH);
fullSweep = 1;
fullSweep = 0;
properlyClosed = 0;

// End of Code //

Step 6: Mechanism Part in Action

This is the mechanism part in testing without the food container.

Step 7: Video in Action

First drop is normal. Second drop is showing if the pellets get stuck and the lid is not closing properly, then it will move backward and forward until it is properly closed.

Now you don't have to bring your tank on vacation with you just like what I almost did.
Just remember to fill up the container before you leave ^_^

Tech Contest

Participated in the
Tech Contest

Microcontroller Contest

Participated in the
Microcontroller Contest

Be the First to Share


    • Instrument Contest

      Instrument Contest
    • Make it Glow Contest

      Make it Glow Contest
    • STEM Contest

      STEM Contest

    14 Discussions


    3 years ago

    The video for my tank would waste food. How do i adjust the code to allow less food out?

    1 reply

    Reply 3 years ago

    int val = 80; //how wide the door open;

    Find this line in the code. "val" is controlling how wide the lid opens. 80 means 80 steps of the stepper motor. Remember that too narrow opening will cause clogging or too narrow for the food to fall so you might give it a try or you can play with the other parameter such as the stepper speed.


    3 years ago

    how can i contact you

    i want to have this can you help me?

    1 reply

    Reply 3 years ago

    sorry pambihira, I just saw your 8-months-ago message. You can contact here in the comment section where instructables will send me an email about this (sorry I can't remember why I missed this one, maybe I am super busy at that time or Robot just forgot to send me an email :D )

    Or you can email me directly to

    I will try my best to help for all that I know ^_^


    5 years ago

    It's not recommended to use direct IO pin with motors , they draw lots of currents .. Steppers draw LOTS of current .

    4 replies

    Reply 5 years ago on Introduction

    Well you are so true about current drawing. The stepper motor I used is from an old 5.25" floppy drive with rating 5 VDC and peak current around 300mA.

    Arduino Uno I/O safe current is 40mA each pin with total around 500mA. Someone please correct me if I am wrong about this. I read it somewhere on the net. So, since I only use pin 2 for switch which has little to no current and pin 13 (onboard led) is on when the stepper stop. So it is safe to directly plug the stepper into I/O pins. The current draw is in a very short period also. It only takes 2 seconds or less for one cycle (open and close the lid). And also I have used it for a year without any current problem to my board, I still use it for testing other projects sometimes :)


    Reply 5 years ago on Introduction

    Hi , this is good . I actually thought connecting a motor directly to arduino pins would result in an immediate burn , but I'm glad I was wrong . In fact , steppers use lots of current .

    And , there is no need for a special IC as many ICs can be used .

    I'm not sure about the motor but I guess It's 4 wired (bipolar) which can be driven with transistors or many different ICs . The most common ICs would be L298N , L293D .

    If it's a 5-6-8 wired , it's possible to drive it both with the 4 wired methods (with little modification) and ULN ICs . (ULN can be made DIY as it's some transistor + some diodes)


    Reply 5 years ago on Introduction

    you should use some kind of motor controller (even some transistors will work) directly connect to the 5v powersupply. In addition the recoil from the stepper might kill your arduino. Controllers have safety diodes to prevent that :)


    Reply 5 years ago on Introduction

    Yes, you guys are absolutely correct about that. It just hard to find some special ICs for that purpose in my country, moreover in a small town I'm living in. Motor driver shields on the net are just too expensive for my junk materials Auto Fish Feeder.

    I just got one Keyes L298 driver from for about $7, but you know .. sometimes a stressful DIYer like me need a toy to play and I keep that motor driver for my bluetooth Panzer :P

    You can check it out on

    I made it based on ASCAS tutorial on iBles

    As I said before, motor driver on the net are too expensive until I found this Keyes L298, so I decided to make my own driver using popular 555 ICs based on tutorial on Make Magazine. Not so stable, but it moves and I am happy with that (^_^) All credit goes to ASCAS for his great tutorial.


    5 years ago on Step 5

    your code has fallen victim to the website having trouble interpreting fish-hooks (Greater than and smaller than signs) as text or html code.
    That is why the library in your 'include' statement has disappeared

    2 replies

    Reply 5 years ago on Step 5

    Sorry, I was trying text formating for the code and I don't realize if it changed. I have corrected the missing less than and greater than symbols. Maybe I will attach the code as text file either later on. Thanks for reminding me ;)

    Very clever gadget, and important to fish owners who travel! I also love that it fixes itself when it gets stuck, definitely will help with having peace of mind.

    1 reply

    Reply 5 years ago

    Thank you MsSweetSatisfaction. I'm glad you love it. I have used it for about a year and this is version 3.1.
    My first built had no container tweak and no stopper switch. I keep improving and fixing any problem I encounter ^_^