Robotica DIY
Published © LGPL

Automatic Fish Feeder Mechanism with Timer by using Arduino

We are going to make automatic fish feeder mechanism with timer by using Arduino. In every 12 hours it will feed the fish.

IntermediateFull instructions provided1 hour1,495
Automatic Fish Feeder Mechanism with Timer by using Arduino

Story

Read more

Code

Code snippet #1

Plain text
#include <Servo.h>
Servo myservo;

void setup() {
myservo.attach(9); 
}

void loop() {
myservo.write(0);
delay (300);
myservo.write(45);
delay (300);
}

Code snippet #2

Plain text
#include <DS1302.h>
#include <Servo.h>
Time t;
Servo myservo;
int Hour;
int Min;
int Sec;
// Init the DS1302
DS1302 rtc(2, 3, 4);

void setup()
{
myservo.attach(9); 
myservo.write(45); 
// Set the clock to run-mode, and disable the write protection
rtc.halt(false);
rtc.writeProtect(false);
Serial.begin(9200);
// The following lines can be commented out to use the values already stored in the DS1302
rtc.setDOW(SUNDAY); // Set Day-of-Week to SUNDAY
rtc.setTime(8, 59, 50); // Set the time to 12:00:00 (24hr format)
rtc.setDate(8, 25, 2019); // Set the date to August 25th, 2019
}

void loop()
{
t = rtc.getTime();
Hour = t.hour;
Min = t.min;
Sec = t.sec;
// Serial.print(Hour);
// Serial.print(":");
// Serial.print(Min);
// Serial.print(":");
// Serial.println(Sec);

//set the time for fish feeding 
if ((Hour== 10 && Min== 0 && Sec== 2)||(Hour== 21 && Min== 0 && Sec== 2)) {
myservo.write(0);
delay (300);
myservo.write(45);
delay (300);}
}

Code snippet #9

Plain text
if ((Hour== 10 && Min== 0 && Sec== 2)||(Hour== 21 && Min== 0 && Sec== 2)) {
myservo.write(0);
delay (300);
myservo.write(45);
delay (300);}
}

Credits

Robotica DIY

Robotica DIY

16 projects • 11 followers
Robotica DIY is for those who want to learn themselves. You will get projects on Arduino, Raspberry pi & NodeMcu ESP8266.

Comments