Introduction: Arduino Uno Fish Feeder in 6 Cheap and Easy Steps!

So a little bit of backstory may be needed for this project. People with pet fish were probably presented with the same problem as me: vacations and forgetfulness. I constantly forgot to feed my fish and always scrambled to do so before it went to sleep. Vacations were a whole different issue, having to buy those "feeder" pyramids that never really ended up working. So this is where I began thinking of what I could do, and I realized I could make an automatic fish feeder!

PLEASE PLEASE PLEASE vote for this in the Arduino Contest, I think it has the potential to win at least a small prize!


Difficulty: 2/5

Cost: 1/5

Supplies

Arduino Uno / Generic version

Servo motor (Micro Servo SG90 9g should work perfectly fine)

-And the double sided wide servo arm that comes with it

Power cable (dc or usb)

Jumper wires (male to male)

Small travel/hotel shampoo bottle

Plastic container

Fish food (any kind works, the pellets work better for me)

Electric drill

Hot glue gun

Step 1: Housing

Seal the lid on the container and drill a hole large enough (in the middle of the lid) for the wires to fit through it. Finally, cut a small flap on the side of the container big enough to fit your power cable.

Step 2: Fish Food

Drill a hole through the SEALED shampoo bottle so that it has two holes on opposite sides that are parallel to each other like the image above. Put the fish food in to about 1/4th of the way to 1/3. Then, get your hot glue gun and glue the base of the bottle onto the servo arm.

Step 3: The Code

Here it is with some annotations: just a warning that it turns on right as you plug it in and every 24 hours it happens. The time you plug it in is the time it will run on until you unplug it.

#include ;

Servo myservo; //creates servo as an object

int pos = 0; //integer variable to store Servo position

long FISHFEEDER = 86400000; //Sets time for every 24 hours (86400000 milliseconds)

long endtime; //Long variables create 32 bits of storage, which is extended amounts

long now; //Same thing here as above

void rotate() {

for(pos = 0; pos < 180; pos += 1) //This code below will make the Servo turn, feeding fish.

{

myservo.write(pos);

delay(15);

}

for(pos = 180; pos>=1; pos-=1)

{

myservo.write(pos);

delay(15);

}

}

void setup() //Void setup makes the code run once and only once

{

myservo.attach(9); //This is going to tell the Arduino that the Servo is at pin 9

myservo.write(0); //Write sends binary data to a serial port.

//In this case, the 0 means that it should send data to digital pin 0. (RX)

delay(15); //This delays 15 milliseconds before the loop below starts running.

rotate(); //Runs our function that turns the servo

}

void loop(){ //This will run on the Arduino over and over again if it has power.

now = millis(); //Now is current time in milliseconds

endtime = now + FISHFEEDER;

while(now < endtime){

myservo.write(0);

delay(20000);

now = millis();

}

rotate();

}

Step 4: Setting Up the Hardware

Put your arduino in the plastic container and put the power cable through the flap and connect it. The wiring is pretty simple, as shown in the diagram above. Just connect positive to the 5v, ground to ground, and data cable to pin 9, as shown in the Tinkercad Circuits diagram above. *wink* *wink* JUST REMEMBER TO FEED THE WIRES THROUGH THE HOLE ON THE TOP OF THE CONTAINER FROM THE ARDUINO TO THE SERVO.

Step 5: Mounting to the Tank/aquarium

Put the plastic housing with the arduino at the side of the fish tank, and put your servo at the lip on the top edge of the tank. Then, you can mount it using tape so that you can take it off later. Just remember to test if it is a tight fit that can hold. Finally, get your servo arm attached to the bottle and mount it to the servo so the holes are on the sides rather than on the top/bottom. It should almost exactly as it looks like in the picture.

Step 6: Rejoice!

Now you are completely done! Feeding your fish will be a breeze, only having to refill the easily accessible container every so often. If you go on a long vacation, you can fill it up a little more to make sure your fish gets all the food it needs. Because the servo is taped on, cleaning up the tank will be no issue as you can just remove the tape very easily and mount it again. I hope this quick, cheap, and easy arduino project helps YOU!

Once again, please do vote for me on the Arduino Contest! I believe this project is worthy of at least a small prize!