Arduino – Automatic Fish Feeder

What we do
What we need
How we do (Hardware)
How we do (Software)
Still shots Outcome
What we do

From the previous Arduino - Servo post, we've already learned how to run Servo motor with Arduino.

if not, just click the following button and take a look at the post to see what you can do. 🙂

 

Arduino Servo

 

Once you're ready to go further with Servo motor, now we can start. 🙂

From this post, we're going to make 'Automatic Fish Feeder' using Arduino and Servo.

 

Are you already excited? Let's dive in!

 

How we do (Hardware)

Please see the following diagram carefully and make your own system just like it!

 

How we do (Software)

Let's take a look at Software side.


If anyone does not know 'How to upload our sketch to Arduino', then please click the following article before you go.


HowTo Upload Sketch


 

Once your Arduino is ready, just type the following codes into your Arduino IDE.

 

#include <Servo.h>

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

// 1 second : 1000;
// 1 min : 60000;
// 1 hour : 3600000;
// 6 hours : 21600000;
// 8 hours : 28800000;
// 10 hours : 36000000;
long FISHFEEDER = 28800000;
long endtime;
long now;

void setup()
{
myservo.attach(9); // attaches the servo on pin 9 to the servo object
}

void loop()
{
now = millis();
endtime = now + FISHFEEDER;

while(now < endtime) {
now = millis();
}

//myservo.attach(9);
//delay(15);

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
}

myservo.write(90);
// myservo.detach();
// delay(15);
// myservo.detach();
// delay(15);
}

 

So now you'll be able to see Servo motor only rotates with the factor your time-interval(FISHFEEDER) configured.

If you're not sure it's working or want to check it's working quickly, just change 'FISHFEEDER' to shorter time such as 5000 (5 seconds).

How was it? Have you had lots of fun or already got some better idea to extend this to your own project?

then go for it. 🙂

Still shots Outcome

Please find the attached Still shots and compare with yours!

 

2 replies
  1. orkney
    orkney says:

    Excellent bl᧐ɡ you һave got here.. It’s hard to find excelⅼent writing
    like yours nowadayѕ. I really appreciate peopⅼe like you!
    Тake care!!

    Reply
    • futurecrafts
      futurecrafts says:

      NP! orkney. I’m a little bit lazy these days, but there are lots of posts under progress yet.
      I’ll keep updates. Thanks!

      Reply

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *