Close
0%
0%

Double feed cat food

Automatically dispose of cat food. With the ability to handle two different dispensations for different needs

Similar projects worth following
Double feed cat food

Halllo,

this is a easy solution for feed two lovely cat's, in early morning. (04:00am)
At the moment I have only one difficult to find the right way on Arduino programming (becasue i'm a novell of this system and C/C++ language). I need support to generate connection between RTC DC3231i2c, with0 real time clock already on display 20*4 i2c, and generate a comand for move two different servo in same time but in different way (the 1th from 0° to 180° the 2th from 180° to 0°).
In the future i'll implemented one botton for manual dispensing mode.
This is not solution for long time feed fod cats alone!!
I'll use two little bottles for the dry food and with spiral cap on the to of bottles on 30/45° of longitudinal inclination, with use of two servo I'll rotate the bottles and dispensing the food (I don't know if on a tubing for the bowl or directly to the bowl).
Best regards, and thanks a lot for your programming support.

JPEG Image - 105.16 kB - 10/30/2017 at 15:08

Preview
Download

ino - 2.01 kB - 10/30/2017 at 00:07

Download

  • 1 × Arduino NANO V3
  • 1 × RTC DS3231 I2C
  • 2 × Servo acmos IC AS-11 I hope the force is havy a lot for this application under 0.2 kg
  • 1 × LCD 20*4 I2C blue

  • Code work fine (thx Frank Buss!)

    Nestore 7810/31/2017 at 00:13 0 comments

    #include <Wire.h>
    #include <LiquidCrystal_PCF8574.h>
    #include <DS3231.h>
    #include <Servo.h>
    #include <TimeAlarms.h>
    #include <TimeLib.h>

    DS3231  rtc(SDA, SCL);

    LiquidCrystal_PCF8574 lcd(0x3F);

    Servo myservo1;   // create servo object to control a servo
    Servo myservo2;
    int pos = 0;

    //Serial.println(time);

    void setup(){
      Serial.begin(115200);
      Serial.println("Trial LCD + DS3231");
        rtc.begin();
        lcd.begin(20, 4); // initialize the lcd
      lcd.setBacklight(255);
      lcd.setCursor(0,0);
      lcd.print(" 1th. Arduino Paolo ");
      lcd.setCursor(0,2);
      lcd.print("    LCD + DS3231  ");
      delay(5000);
      lcd.clear();
      } 

    void loop()
      {
      Serial.print(rtc.getDOWStr(1));
      Serial.print(" ");
      Serial.print(rtc.getDateStr());
      Serial.print(" -- ");
      Serial.println(rtc.getTimeStr());
      //Serial.println(time);
      String time = rtc.getTimeStr();
      Serial.print(" -- ");
      Serial.print(rtc.getTemp());
      lcd.setCursor(0,0);
      lcd.print(rtc.getDOWStr(1));
      lcd.setCursor(3,0);
      lcd.print(",");
      lcd.setCursor(4,0);
      lcd.print(rtc.getDateStr());
      lcd.setCursor(0,1);
      lcd.print(rtc.getTimeStr());
      lcd.setCursor(10,1);
      lcd.print("t:");
      lcd.setCursor(12,1);
      lcd.print(rtc.getTemp());
      lcd.setCursor(0, 2);
      lcd.print("Mangiatoia");
      lcd.setCursor(0, 3);
      lcd.print("Automatica");
      lcd.scrollDisplayRight();
      delay (1000);
      if (time == "02:09:00") {
      openCatFeeder();}
      //delay(70000);}
      }

    void openCatFeeder()  
      {
        Servo myservo1;   // create servo object to control a servo
        Servo myservo2;
        myservo1.attach(9);  // attaches the servo on pin 9 to the servo object
        myservo2.attach(10);
       String time = rtc.getTimeStr();
       for (pos = 0; pos <= 90; pos += 1) { // goes from 0 degrees to 180 degrees in steps of 1 degree
       myservo1.write(pos);                // tell servo to go to position in variable 'pos'
       delay(15);                          // waits 10ms for the servo to reach the position
       myservo2.write(pos);                // tell servo to go to position in variable 'pos'
       delay(15);}
       for (pos = 90; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees
       delay(50);
       myservo1.write(pos);                // tell servo to go to position in variable 'pos'
       delay(10);                          // waits 10ms for the servo to reach the position
       myservo2.write(pos);                // tell servo to go to position in variable 'pos'
       delay(10);
       myservo1.detach ();
       myservo2.detach ();}
      }

  • ops again some errors...

    Nestore 7810/30/2017 at 15:04 0 comments

    #include <Wire.h>
    #include <LiquidCrystal_PCF8574.h>
    #include <DS3231.h>
    #include <Servo.h>
    #include <TimeAlarms.h>
    #include <TimeLib.h>

    DS3231  rtc(SDA, SCL);

    LiquidCrystal_PCF8574 lcd(0x3F);

    Servo servo1;   // create servo object to control a servo
    Servo servo2;

    int pos = 0;

    void setup(){
      Serial.begin(115200);
      Serial.println("Trial LCD + DS3231");
      rtc.begin();
      //Alarm.alarmRepeat(8,30,0, MorningAlarm);

      lcd.begin(20, 4); // initialize the lcd
      lcd.setBacklight(255);
      lcd.setCursor(0,0);
      lcd.print(" 1th. Arduino Paolo ");
      lcd.setCursor(0,2);
      lcd.print("    LCD + DS3231  ");
      delay(5000);
      lcd.clear();
      } 

    void loop()
            //{  digitalClockDisplay();
            //Alarm.delay(1000); // wait one second between clock display
            //}
     {
      Serial.print(rtc.getDOWStr(1));
      Serial.print(" ");
      Serial.print(rtc.getDateStr());
      Serial.print(" -- ");
      Serial.println(rtc.getTimeStr());
      Serial.print(" -- ");
      Serial.print(rtc.getTemp());
      lcd.setCursor(0,0);
      lcd.print(rtc.getDOWStr(1));
      lcd.setCursor(3,0);
      lcd.print(",");
      lcd.setCursor(4,0);
      lcd.print(rtc.getDateStr());
      lcd.setCursor(0,1);
      lcd.print(rtc.getTimeStr());
      lcd.setCursor(10,1);
      lcd.print("t:");
      lcd.setCursor(12,1);
      lcd.print(rtc.getTemp());
      lcd.setCursor(0, 2);
      lcd.print("Mangiatoia");
      lcd.setCursor(0, 3);
      lcd.print("Automatica");
      lcd.scrollDisplayRight();
      delay (1000);
      }
    void openCatFeeder();
      
      servo1.attach(7);  // attaches the servo on pin 9 to the servo object
      servo2.attach(8);
      
      String time = rtc.getTimeStr();

      Serial.println(time);

      if (time == "04:00:00") {

      openCatFeeder();

      delay(70000);}
      
      for (pos = 0; pos <= 180; pos += 1) { // goes from 0 degrees to 180 degrees
                                            // in steps of 1 degree
      servo1.write(pos);                // tell servo to go to position in variable 'pos'
      delay(10);                          // waits 15ms for the servo to reach the position
      servo2.write(pos);                // tell servo to go to position in variable 'pos'
      delay(10);}
      for (pos = 180; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees
      servo1.write(pos);                // tell servo to go to position in variable 'pos'
      delay(10);                          // waits 15ms for the servo to reach the position
      servo2.write(pos);                // tell servo to go to position in variable 'pos'
      delay(10);}

  • Log test

    Nestore 7810/30/2017 at 10:46 0 comments

View all 3 project logs

Enjoy this project?

Share

Discussions

Nestore 78 wrote 10/30/2017 at 15:15 point

This is a error messages:

Primo_test_RCT_LCD_SERVO2:67: error: 'servo1' does not name a type

   servo1.attach(7);  // attaches the servo on pin 9 to the servo object

   ^

Primo_test_RCT_LCD_SERVO2:68: error: 'servo2' does not name a type

   servo2.attach(8);

   ^

Primo_test_RCT_LCD_SERVO2:72: error: 'Serial' does not name a type

   Serial.println(time);

   ^

Primo_test_RCT_LCD_SERVO2:74: error: expected unqualified-id before 'if'

   if (time == "04:00:00") {

   ^

Primo_test_RCT_LCD_SERVO2:80: error: expected unqualified-id before 'for'

   for (pos = 0; pos <= 180; pos += 1) { // goes from 0 degrees to 180 degrees

   ^

Primo_test_RCT_LCD_SERVO2:80: error: 'pos' does not name a type

   for (pos = 0; pos <= 180; pos += 1) { // goes from 0 degrees to 180 degrees

                 ^

Primo_test_RCT_LCD_SERVO2:80: error: 'pos' does not name a type

   for (pos = 0; pos <= 180; pos += 1) { // goes from 0 degrees to 180 degrees

                             ^

Primo_test_RCT_LCD_SERVO2:86: error: expected unqualified-id before 'for'

   for (pos = 180; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees

   ^

Primo_test_RCT_LCD_SERVO2:86: error: 'pos' does not name a type

   for (pos = 180; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees

                   ^

Primo_test_RCT_LCD_SERVO2:86: error: 'pos' does not name a type

   for (pos = 180; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees

                             ^

exit status 1
'servo1' does not name a type

  Are you sure? yes | no

Nestore 78 wrote 10/30/2017 at 15:03 point

I Frank hummm I think I have something wrong

  Are you sure? yes | no

Nestore 78 wrote 10/30/2017 at 14:36 point

Hi Frank I try it immediatly

  Are you sure? yes | no

Frank Buss wrote 10/30/2017 at 11:23 point

Looks like your second loop function opens and closes the cat feeder. To do this at a specific time, you could do something like this:

String time = rtc.getTimeStr();

Serial.println(time);

if (time == "04:00") {

  openCatFeeder();

  delay(70000);

}

Then rename your second "loop" function to "openCatFeeder".

You might need to change the string "04:00", depending on what string the method getTimeStr returns. The 70 second delay is in the code to wait at least 1 minute, so that the door doesn't open and close all the time while it is still 4:00 AM.

  Are you sure? yes | no

Nestore 78 wrote 10/30/2017 at 14:37 point

Hi Frank I try it immediatly

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates