Arduino Fish Feeder

64,996

87

40

About: Maker from USA. Follow me to stay up to date on my projects and possible kickstarters! Business email: constructed@mail.com

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

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: You Will Need...

For this project you will need

SUPPLIES

  1. Arduino
  2. Servo (any kind)
  3. Binder Clips
  4. An empty shampoo bottle
  5. Fish Food
  6. Jumper Wires
  7. Empty food takeout container (Clean or unused)

TOOLS

  1. Drill
  2. Hot Glue Gun
  3. 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 
  } 
}

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

Age of Aquariums Contest

Second Prize in the
Age of Aquariums Contest

DIY University Contest

Participated in the
DIY University Contest

Formlabs Contest

Participated in the
Formlabs Contest

2 People Made This Project!

Recommendations

  • Indoor Lighting Contest

    Indoor Lighting Contest
  • Make It Fly Challenge

    Make It Fly Challenge
  • Growing Beyond Earth Maker Contest

    Growing Beyond Earth Maker Contest

40 Discussions

0
None
ashockb7

3 months 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

0
None
DenisZ4

2 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();

}

4 replies
0
None
abigailm41DenisZ4

Reply 4 months 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?

0
None
DeanTheCreatorDenisZ4

Reply 1 year ago

Please note that you need to download the simple timer library and put it into your Documents\ArduinoData\staging\libraries folder.

0
None
ErnestoE15

Question 1 year 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?

1 answer
0
None
amlonpvErnestoE15

Answer 4 months 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

0
None
MD. FerajM

4 months ago

Hi i want to feed every 15 minutes later
please help me

1 reply
0
None
amlonpvMD. FerajM

Reply 4 months 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

0
None
amlonpv

Question 4 months 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.

0
None
ElishebaW

3 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

}

}

2 replies
0
None
bhairavis1ElishebaW

Reply 10 months 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?

0
None
RobC81ElishebaW

Reply 3 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 ?

0
None
ArminE6

1 year 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)

0
None
ArminE6

Question 1 year 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)

0
None
DeanTheCreator

1 year ago

When I turned it on the timer went off every 11 hours not 12 (first a 7pm then 6am then 5pm). Do you know why?

0
None
viakaren

3 years ago

Hey.. where did you do the coding? Im sorry i really have no idea in using arduino but now our professor want us to develop a system using arduino. I just dont know how it works, how to connect the code so the goal will be achieve..

2 replies
0
None
Constructedviakaren

Reply 3 years ago

to be honest I never learned arduino. I make it up as I go using bits and pieces of other code I know.