Automatic pet feeder

Hi there, I am fairly new to Arduino and for a school project I need to make an automatic pet feeder.
I have tried to experiment a little bit and this is what I came up with.
Note: none of this is used for Blynk since I didn’t know it existed back then.

#include <RTClib.h>
#include <Wire.h>
#include <Servo.h>

RTC_PCF8523 rtc;

Servo servo;
int pos = 0;

char buf1[20];

void setup() {



   * rtc.adjust(DateTime(F(__DATE__),F(__TIME__)));

void loop() {
  DateTime now =;

  sprintf(buf1, "%02d:%02d:%02d %02d/%02d/%02d",  now.hour(), now.minute(), now.second(),, now.month(), now.year());  
   * now.hour() == 19 &&  && now.second() == 00 
  if (now.minute() == 00 && now.second() == 00 || now.minute() == 10 && now.second() == 00 || now.minute() == 20 && now.second() == 00 || now.minute() == 30 && now.second() == 00 || now.minute() == 40 && now.second() == 00 || now.minute() == 50 && now.second() == 00){
    delay (5000);
    delay (300);
  else {

  Serial.print(F("Date/Time: "));



In this scetch I am using an Arduino Uno, a servo and an RTC (PCF8523).
I have a Arduino Uno Wifi Shield ready here and now I can use any help you guys can give me.

I want to make an app that can be used anywhere.
In this app, you have to be able to make a schedule (a timer) where you have a slider that increases the duration the time that the servo takes to close, for the amount of food.
This schedule needs to be editable and you have to be able to select any day of the week to make it repeat.

I don’t know if possible, but I hope you can connect the RTC to a server to get the real date because there is a few seconds of delay right now.

Also, is there a way to make the user connect the Arduino to their WIFI manually through the app?

I hope that my questions make sense for all of you.
Every help is welcome!

Yes, it’s possible.

Did you start by searching the forum for “pet feeder”?

Use the RTC widget in Blynk instead, your code will be much simpler then.

Yes, using WiFiManager or Blynk Provisioning

So far, you’ve spent just 9 minutes reading time on this forum. Use the search facility and you’ll find most of the answers you need.


pet feeder link

This is exacly what I need, yet the components aren’t the same and I have no idea what the code is and how I can recreate the app.

If you’d taken the time to actually read the thread then you’d know how to download the firmware file and flash it to a device and how to download the app. However, that won’t score you any points in your school project.

If you’re wanting someone to do your homework for you then that’s not going to happen. If you make some progress with your hardware and code, and decide what sort of functionality you’re looking for in the app, then sharing that information here will probably result in you getting some help.

So far you’ve asked some questions about feasibility and have hopefully seen that because other people have made similar devices with the same, or better, functionality then yes, it’s feasible.
Whether it’s do-able for you with your particular mix of mechanical, electrical and coding skills, and whether you have the determination to make it happen, are another thing entirely.


If you haven’t noticed yet, I don’t want to straight up just flash the firmware, because I don’t know the code and it won’t work because my components aren’t the same…

That’s why I came here for help.

I can’t simply recreate everything he has since I don’t have that budget, yet I do already have all the hardware and only need the code, which is why I’m here.

As I’ve said, members of the Blynk community won’t write your code for you, but we will help you if make some progress and come back with some information about what you’ve achieved, what your issues are, and what you’ve tried so far.
I’ve already given you some pointers about using the RTC widget and provisioning solutions. Have you done anything with this information?


Okay, I tried to make the app yet I want to work in steps.
The first step was connecting my Arduino to the internet, which worked using the example of Arduino itself.
Next up was connecting my Arduino to the Blynk server using the Blynk example, yet the problem is that it keeps connecting. “Connecting to 80”.

This is at the moment my biggest problem.
If I can get this to work, I’ll start with testing a button to just activate the servo.

Any tips on the connecting part?


#define BLYNK_PRINT Serial

#include <SPI.h>
#include <WiFi.h>
#include <BlynkSimpleWifi.h>

char auth[] = "###";

char ssid[] = "###";
char pass[] = "###";

void setup()

  Blynk.begin(auth, ssid, pass);

void loop()

What hardware are you using, and how is it connected?

You currently have one serial port defined, and you’ll need two -one for debug and one to connect to your ESP8266.


I am using an Arduino Uno with a WiFi Shield ( A000058 ).
It is connected to my pc via USB and to a power outlet aswell.

Okay, Google says that it uses SPI communication rather than serial, but I’m not familiar with that hardware, so can’t help with debugging the connection issues.
Maybe a search of the forum, or a look through the Sketch Builder examples might help.


Could it be that I need to update the firmware of the shield?
The shield didn’t come with a cable, so I haven’t updated it yet.

In addition of my last answer: I just updated my shield and it works now.