Auto Dog Feeder

Introduction: Auto Dog Feeder

This is my project of a Auto Pet Feeder. My name is Parker i'm in Grade 11 and I made this project on November 11 2020 as a CCA (Course Culminating Activity) in this project I will be showing you how to make a Automatic Pet Feeder with Arduino UNO. You can pick a time which you can change. The food will dispense through a auger and feed your pets!

Supplies

Electronics:

  • Arduino UNO
  • L298N - 10$ - Controls the Nema 17
  • NEMA 17 - 10$ - Turns the auger so the food dispenses
  • RTC (DS1307) - 10$ - Gives the time
  • 12V Power Supply - 5$ - Powers everything
  • Mini Breadboard - For extra wiring space
  • Jumper Wires - Connects everything
  • Female to Male wires - Connects everything

Hardware:

  • 3D print filament - for 3d printer
  • 2 M4 Bolts - Hold the base plate in place
  • 4 Nema 17 bolts - Hold nema down
  • PVC T 48mm inside dimension 66mm outside dimension - 3$

Tools:

  • 3D printer
  • Drill
  • Soldering gun

Step 1: Overview of Design

The design of the pet feeder is very simple. A hopper goes onto the top of the PVC T. Then a cover goes on the back of the PVC T (as shown in the picture) with the Nema 17 attached to it. Then the Nema 17 will be pushed into the back of the Auger which can be seen above and a bolt will go into the side to hold it in place so it doesn't deform the hole which can be seen above!

Then the auger will simply push the food out of the pipe and into a bowl!

Step 2: Overview of Code

The RTC & The stepper have a libary called RTClib.h and Stepper.h which adds simplified code for the RTC & Stepper. The if statements are very simple its saying if the hour & minutes equals the said time it will rotate the nema which will dispense the food. The rest of the code is very easy to understand even for someone with a day of experience.

Step 3: Attaching Nema 17 to Base Plate & Auger

First you want to take your base plate and attach it to your Nema 17 using the premade holes on the base plate. Once done that you want to attach the auger to the Nema using the back hole on it. Then connect the Base plate with the auger and Nema attached then screw the M2 bolts into each side.

Step 4: Wiring L298N & RTC

This step will tell you how to wire the L298N & RTC

We will be starting with the pins 8, 9, 10, 11 to the L298N

  • Pin 8 (White) to IN1
  • Pin 9 (Purple) to IN2
  • Pin 10 (Pink) to IN3
  • PIN 11 (Yellow) to IN4

Next we will be connecting the Nema 17 to the L298N

  • OUT1 to 1 on NEMA
  • OUT2 to 2 on NEMA
  • OUT3 to 3 on NEMA
  • OUT4 to 4 on NEMA

Connecting 12v and Arduino to L298N (Couldn't find 12V so imagine 9V battery as power)

  • Volts to 12V
  • Ground to GND
  • 5V to 5V on Breadboard

Connecting RTC to Arduino

  • GND to GND
  • 5V to 5V on Breadboard
  • SDA to A5
  • SCL to A4

Jumper Pins

  • All jumper pins are supposed to be on the L298N

Step 5: Coding With Comments

The code clearer in images above!

// Name: Parker Frederick

// Project Name: Auto Pet Feeder // Date: Tuesday, November 10th 2020 // Teacher: M. Bonisteel // Desc: Feed your pets at a said time!

// Libaries for the things I used #include #include #include "RTClib.h"

RTC_DS1307 rtc; //Says what RTC im using

// This is where you set the time for the food

// Hours int mornFeedTime = 12; int nightFeedTime = 7; //Minutes int mornFeedTimeM = 29; int nightFeedTimeM = 00; //Seconds int mornFeedTimeS = 20; int nightFeedTimeS = 00;

char daysOfTheWeek [7][12] = {"Sunday", "Monday", "Tuesday", "Wedsneday", "Thursday", "Friday", "Saturday"}; // Makes normal days turn into the days of the week

const int feed = 200; // This is your steps so how many times you want it to spin

Stepper myStepper(feed, 8, 9, 10, 11); // Your pins for the the Nema 17 and most other steppers

void setup() { Serial.begin(9600);

while (!Serial); // If the RTC is not working it will display it in the serial screen if (! rtc.begin()) { Serial.println("Couldn't find RTC"); while (1); }

// This will tell you whether or not the Real Time Clock is running and it will display it on the serial screen if (! rtc.isrunning()) { Serial.println("RTC is running!");

rtc.adjust(DateTime(F(__DATE__), F(__TIME__))); // This will take your computer time and use it on the RTC

// If you want to have a set time instead of the computer time you can do it here //rtc.adjust(DateTime(2020, 10, 29, 8, 28, 0)); // Year/Month/Day/Hour/Minute/Second } myStepper.setSpeed(200); // Speed you want it to turn at }

void loop() { DateTime now = rtc.now();

// This will make these variable the hour it is right now etc int hr = now.hour(); int mi = now.minute(); int se = now.second();

// Code so at the set time it will dispense the food and it will spin 5 times, this if for the morning feed

if (hr == mornFeedTime && mi == mornFeedTimeM && mornFeedTimeS == se) { Serial.println("Breakfast!"); myStepper.step(-feed); delay(700);

myStepper.step(-feed); delay(700);

myStepper.step(-feed); delay(700);

myStepper.step(-feed); delay(700);

myStepper.step(-feed); delay(700);

myStepper.step(-feed); delay(700);

myStepper.step(-feed); delay(700);

}

// Code so at the set time it will dispense the food and it will spin 5 times, this is for night time feed

if (hr == nightFeedTime && mi == nightFeedTimeM && nightFeedTimeS == se) { Serial.println("Dinner!"); myStepper.step(-feed); delay(700);

myStepper.step(-feed); delay(700);

myStepper.step(-feed); delay(700);

myStepper.step(-feed); delay(700);

myStepper.step(-feed); delay(700);

myStepper.step(-feed); delay(700);

myStepper.step(-feed); delay(700); }

// This will display the YEAR, MONTH, DAY, HOUR, MINUTE, SECOND in the serial

Serial.print(now.year(), DEC); Serial.print('/'); Serial.print(now.month(), DEC); Serial.print('/'); Serial.print(now.day(), DEC); Serial.print(" ("); Serial.print(daysOfTheWeek[now.dayOfTheWeek()]); Serial.print(") "); Serial.print(now.hour(), DEC); Serial.print(':'); Serial.print(now.minute(), DEC); Serial.print(':'); Serial.print(now.second(), DEC); Serial.println(); }

Website I used for RTC I deleted most things other than the if statements that say whether or not the RTC is on or off. I mainly used this website to learn how to program the RTC.

Website I used for Stepper motor this helped me understand how to program the stepper to run I didn't really keep anything from it. It just helped me understand how to code it.

Step 6: Problems and How I Fixed Them!

A few problems I had

  • I needed 12v power supply, I only had 9v battery I found one and it was solved quick.
  • When hooking up L298N with NEMA 17 I had the wires wrong on A and A- which made it jitter a little bit. I simply fixed it by changing the wires the other way.
  • Tried to make code more simple because in the if statement myStepper.step(-feed); over and over looked messy. So I had to change it back.
  • I had the wrong size base plate as seen in the picture so I had to 3D print a new one a little bit and it fit perfect!
  • Problem I have is it jams since the auger is to small so it jams simple way I can fix is by enlarging the auger a small amount!

Be the First to Share

    Recommendations

    • Unusual Uses Contest

      Unusual Uses Contest
    • 3D Printed Student Design Challenge

      3D Printed Student Design Challenge
    • Paint Challenge

      Paint Challenge

    Comments

    0
    seamster
    seamster

    1 year ago

    Great looking project, very impressive work. Thanks for sharing the details! : )