Introduction: Arduino Fish Feeder
Do you have a fish at home? Are you like me, and you occasionally forget to feed your water loving pet? If so, this project is perfect for you. Its Simple, Cheap, and fun to make!
This project is great for students who leave ealy and may not have time to feed fish in the morning
Please vote for this project in the DIY University contest and the Age of aquariums contest
This is an really cool arduino project, that uses just two electronic parts. The arduino sketch is set up to feed the fish every 12 hours, but you can change it to whatever number you like. After building, all you need to do, is to clip your device onto your aquarium and forget about it! Thats all you do!
Lets start building!
Note: I started a YouTube channel to document my projects better, subscribe for more projects!
Difficulty: easy..
Cost (Not counting Arduino): easy..
Step 1: You Will Need...
For this project you will need
SUPPLIES
- Arduino
- Servo (any kind)
- Binder Clips
- An empty shampoo bottle
- Fish Food
- Jumper Wires
- Empty food takeout container (Clean or unused)
TOOLS
- Drill
- Hot Glue Gun
- Computer (to code)
Step 2: Shampoo Bottle
Using a empty shampoo bottle and your drill, drill a small hole on both sides of the shampoo bottle.
This is where the food will fall out, so you should test if food falls out by filling it up, and rotating it while holding it horizontally
DONT DRILL TOO BIG OF A HOLE!
Your fish will end up fat!
Drill a hole small enough so only 1-5 pellets fall out, depending on the size or number of fish you have
Step 3: Wiring and Programing!
Wire the ardunio according to the above picture.
Using jumper wires, follow this pattern
Connect Yellow or data to PIN 9
Connect Black to GND
Connect Red to +5V
Next use the code I have provided to upload to your arduino
Note: I'm not the best Programmer........ I'm still learning, If you see anything I can improve Please Tell Me!
// CONSTRUCTED'S Fish Feeder // https://www.instructables.com/member/Constructed/ // Donate for more projects! #include Servo myservo; // create servo object to control a servo // a maximum of eight servo objects can be created int pos = 0; // variable to store the servo position long FISHFEEDER = 43200000; // 12 hours between feeding long endtime; long now; void setup() { myservo.attach(9); // attaches the servo on pin 9 to the servo object myservo.write(0); delay(15); } void loop() { now = millis(); endtime = now + FISHFEEDER; while(now < endtime) { myservo.write(0); delay(20000); now = millis(); } for(pos = 0; pos < 180; pos += 1) // goes from 0 degrees to 180 degrees { // in steps of 1 degree myservo.write(pos); // tell servo to go to position in variable 'pos' delay(15); // waits 15ms for the servo to reach the position } for(pos = 180; pos>=1; pos-=1) // goes from 180 degrees to 0 degrees { myservo.write(pos); // tell servo to go to position in variable 'pos' delay(15); // waits 15ms for the servo to reach the position } }
Attachments
Step 4: Prepare Case
First Cut a square just big enough to squish your servo through, It should be very tight!
next get your hot glue gun and glue both the binder clips to the back of your case.
Try to line them up as best as you can, They will clip to the back of your aquarium
Next take some hot glue and glue a servo horn to the bottom of your shampoo bottle. Put the servo horn back onto the servo and go to the next step
Step 5: Your Done!
Simply fit all the electronics into the case, and wedge the servo in last. Now clip your automatic fish feeder to any aquarium and your done!.
Have fun and now you don't need to worry about feeding your fish!
Please vote and favorite this intructable, I really appreciate it.
Thank you

Second Prize in the
Age of Aquariums Contest

Participated in the
DIY University Contest

Participated in the
Formlabs Contest
44 Comments
2 years ago
Just thinking if you only put 2 small holes in it, after a short while there still will be plenty of food in the bottle, between the two holes, but nothing will fall out
4 years ago
Hi i want to feed every 15 minutes later
please help me
Reply 4 years ago
find this on the code above: long FISHFEEDER = 43200000; // 12 hours between feeding
and change the 43200000 to 900000
this would mean you would be feeding your fish every 15 minutes because 1000=1 second, so 15 minutes is 900000. Based on what i know, this should be right. Keep an eye on it though just to make sure haha XD
Reply 3 years ago
Thanks buddy
3 years ago
HOW TO SET IT ONCE EVERY 6 HOURS TO FEED AUTOMATICALLY USING SERVOMOTOR? AND HOW CAN THE ARDUINO WORKING? ARE YOU USING BATTERY 9V? HMM PLEASE REPLY. URGENT :)
7 years ago
I am using SimpleTimer library for setting up time interval between feedings.
In addition I turn off the Servo Motor between feedings so that it doesn't make any noise and also doesn't drain the battery.
Hope someone can find this code useful.
#include <Servo.h> // create servo object to control a servo
#include <SimpleTimer.h>
Servo myservo; // create servo object to control a servo
// the timer object
SimpleTimer timer;
int pos = 0; // variable to store the servo position
void setup() {
myservo.write(0);
Serial.begin(9600);
timer.setInterval(86400000, feedMyFish); // Feed every 24 Hours
}
void feedMyFish() {
myservo.attach(9);
for (pos = 0; pos <= 180; pos += 1) { // goes from 0 degrees to 180 degrees
// in steps of 1 degree
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(15); // waits 15ms for the servo to reach the position
}
for (pos = 180; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(15); // waits 15ms for the servo to reach the position
if (pos == 0) {
myservo.detach(); // Turn off Servo motor between feedings
}
}
}
void loop() {
timer.run();
}
Reply 3 years ago
I just had to leave for a few days and used your code instead of buying a feeder, big thanks!
Reply 4 years ago
Do i need an RTC for this or can i just code it? Also what library did you use, do you have the zip link?
Reply 6 years ago
Please note that you need to download the simple timer library and put it into your Documents\ArduinoData\staging\libraries folder.
Reply 5 years ago
how do you add a new libaray?
Reply 6 years ago
thanks! this really helped me out
4 years ago
Can i operate two servo motor using this model for 2 tanks, how to step the start time for the first feed as i wanted to first feed at morning 6 followed by 8 hours intervals
Question 5 years ago on Step 2
how do I do it to be able to make the food ciga every 6 hours?
and what voltage is used?
Answer 4 years ago
find this on the code above they listed= long FISHFEEDER = 43200000; // 12 hours between feeding
and change the 43200000 to 21600000, the servo will rotate every 6 hours.
As for the voltage, what do you mean? Voltage for the servo, the arduino?
Also i just realized you posted this a long time ago, did you ever figure it out lmaoo
Question 4 years ago on Step 3
how can i do designated times like 7am and 12 pm? I will be making tnis for school and idk how to code. I have a DS3132 RTC module and i have it programmed but im afraid it will overheat as i read something that said i need to disable the charging circuit or something. anyways it was too complicated so i don't think ill use it. I just need to learn how to adjustt the feeding times, yours is every X amount of hours and I know how to change it, but idk how to adjust it to it feeds at 7am and 12 pm.
7 years ago
Here's the correct code. I fixed it.
#include <Servo.h> // create servo object to control a servo
// a maximum of eight servo objects can be created
Servo myServo; // variable to store the servo position
long FISHFEEDER = 80; // 12 hours between feeding
long endtime;
long now;
void setup()
{
myServo.attach(9); // attaches the servo on pin 9 to the servo object
myServo.write(180);
delay(15);
}
void loop()
{
int position;
now = millis();
endtime = now + FISHFEEDER;
while(now < endtime)
{
myServo.write(0);
delay(20000);
now = millis();
}
for (position = 0; position < 180; position += 1) // goes from 0 degrees to 180 degrees
{ // in steps of 1 degree
myServo.write(position); // tell servo to go to position in variable 'pos'
delay(15); // waits 15ms for the servo to reach the position
}
for (position = 180; position>=1; position-=1 ) // goes from 180 degrees to 0 degrees
{
myServo.write(position); // tell servo to go to position in variable 'pos'
delay(15); // waits 15ms for the servo to reach the position
}
}
Reply 5 years ago
Hello mam, I have done my project using your code. Can you please guide me for how can I implement bluetooth module in this project?
Reply 7 years ago
hi will this code move the servo 0-180 degrees and back again , once in 12 hours ? or the code thats in the instructable ?
5 years ago
Hi,
I have a problem with arduino, when I upload the code to the Arduino, no matter the value of "FISHFEEDER" variable is, when i plugg the arduino with USB, the servo starts to spining without stop!!!!!! it keeps working all the time!!
what is the problem? what did i do wrong?
tools i am using:
Arduino Uno R3
Micro Servo 9g (Tower Pro - SG90)
Question 5 years ago on Step 3
Hi,
I have a problem with arduino, when I upload the code to the Arduino, no matter the value of "FISHFEEDER" variable is, when i plugg the arduino with USB, the servo starts to spining without stop!!!!!! it keeps working all the time!!
what is the problem? what did i do wrong?
tools i am using:
Arduino Uno R3
Micro Servo 9g (Tower Pro - SG90)