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

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() {
pinMode(switchPin,INPUT);
pinMode(ledPin,OUTPUT);
digitalWrite(ledPin, LOW);
delay(5000);
}

void loop() {
if (numberOfSweeps < 2){ // set how many sweeps here;
if (!fullSweep){
//slower when opening to drop more pellets;
stepper.setSpeed(80);
stepper.step(-val);
//faster when closing to reduce lid jam;
stepper.setSpeed(100);
stepper.step(val+1);

// checks if the lid is properly closed;
if (digitalRead(switchPin)==HIGH){
properlyClosed = 1;
digitalWrite(ledPin, HIGH);
fullSweep = 1;
}
else{
while(!properlyClosed){
// moves backward a little to release stuck food
// then moves forward;
stepper.step(-15);
stepper.step(50);
if (digitalRead(switchPin)==HIGH){
properlyClosed = 1;
digitalWrite(ledPin, HIGH);
fullSweep = 1;
}
}
}
numberOfSweeps++;
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