Sad Cat Fixer - Automatic Cat Feeder

by prabhjot213 in Circuits > Arduino

386 Views, 1 Favorites, 0 Comments

Sad Cat Fixer - Automatic Cat Feeder

Happy-Cats__880.jpg

Hello, my name is Pavi Dhaliwal and I will show you how to make your sad cat happy. There are many ways to make your sad cat happy like lazer toys, but I decided to make an automatic cat feeder. There are two things I will be showing you in these instructions, first, I will show a simpler version of the code which will show the food coming out every few seconds, second, I will show a more complex version of the code which will show the food coming out at a certain time of day. In these instructions, I will be showing you the circuit diagrams, build diagrams, photos, videos, and the code. My initial idea for this project was to make the food come out at a certain time of day, however, since it will be very hard to record a video of that, I decided to make a simpler version which is sort of like an idea of how it will work when that certain time comes.

Supplies

71Ysmj-EBEL._SL1500_.jpg
sori-yanagi-stainless-steel-mixing-bowl-27cm-mixing-bowls-13226462576723.jpg
box-lid-tray__ResizedImageWzYwMCw0Mzld.jpg
9g-micro-servo-motor-4-8v.png
piezo-buzzer-01-800x800.jpg
FSB5Q9PIBL628Y3.jpg
s-l1000_AlADzyfEcW.jpg

Some of the supplies depends on what you can find you can find in your area, but to make the actual design, you will need:

  • 2 Pringles Cans
  • A bowl
  • A shoebox lid

Some of the Arduino components you will need, include:

  • Servo Motor
  • Buzzer
  • Button
  • Real-Time Clock

Other than that, you will only need to have a breadboard and some Arduino wires.

Circuit Diagram

Sad Cat Feeder.png

Before actually making it, you will need to make a circuit diagram on how your components will be placed and a diagram of your actual design. Tinkercad can also help you with your circuit diagrams. First, you would need to log in, then start building your circuit. Tinkercad basically shows you how your circuit will look and if your circuits will actually work. Here's the Tinkercad I made for this project. To build this particular circuit, first:

  1. Place your Breadboard and Arduino Uno
  2. Place the Servo Motor and connect the power to 5V, the ground to GND, and the signal to pin 9
  3. Place the buzzer on the breadboard and connect the positive to 5V and the ground to GND
  4. Finally, place the button and connect the right side to the 1k resistor and pin 2, connect the other side to the positive side on your breadboard

Code

1c54f7b06d7723c21afc5035bf88a5ef.png

The next step is to make the code for the circuit diagram we built above.

  1. The first thing to write is to include <Servo.h>, which will basically make the servo actually work when we run tests.
  2. The next thing to do is to add Global Objects. Global Objects basically make your inputs and output work. In this case, that is the button, buzzer, and servo. It also allows you to set nicknames and pins for your inputs and outputs to make it easier for the rest of the code. In this case, the button is shortened to bttn and the buzzer is the same.
  3. The next thing to do is the setup function, which runs once. The setup function sets the button and buzzer as input or output. It also attaches the servo to pin 9 and sets the default servo degree to 0.
  4. The next to do for the code is the void function, which loops forever. The void function basically makes everything you want the code to do happen. For example, if you code the servo to go 90 degrees and then back to 0, it will do it. In the void function, I will set it so that if the button is pressed, the tune plays from the buzzer, and then the servo goes 90 degrees, and if the button isn't pressed, it continues doing the same thing.
  5. Now for the final thing for the code, comments. Comments are really important for the code since it shows the viewer what each line of code does. It is not necessary, but it is nice to have comments and be organized. I have bolded all the comments in the code so it is easier to read.

The code that I made for this project is below, and as you can see, I included the servo library, the global objects, the setup function, and the void function:

//***********************************************/

// Sad Cat Fixer - Servo, Buzzer, and Button

// When the buzzer plays the alarm and finishes,

// the servo will rotate 90 degrees

// The button is there for the cat to get food at

// any time

// Email: support@sunfounder.com

// Website: www.sunfounder.com

// include the servo code

#include <Servo.h>

//***********************************************/


//***********************************************/

// Global Objects - these objects can be

// used by any function

//***********************************************/

Servo myservo; // create servo object to control a servo

const int bttn = 2; // the button is connected to pin 2

int buzzer = 12; // the buzzer is connected to pin 12


//***********************************************/

// Setup Function - this code runs once

//***********************************************/

void setup()

{

 Serial.begin(9600);

 pinMode(bttn, INPUT); // sets the button as an input

 pinMode(buzzer, OUTPUT); // sets the buzzer as an output

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

 myservo.write(0); // back to 0 degrees 

 delay(1000); // wait for a second

}


//***********************************************/

// Void Function - this code loops forever

//***********************************************/

void loop()

{

 if (digitalRead(bttn) ==HIGH) // if the button is

                 // then do this

 {

  tone(buzzer,400,200); // plays the tune 400,200

  delay(500); // wait for 500 miliseconds

  tone(buzzer,350,200); // plays the tune 350, 200

  delay(500); // wait for 500 miliseconds

  tone(buzzer,300,225); // plays the tune 300, 225

  delay(300); // wait for 300 miliseconds

  tone(buzzer,250,225); // plays the tune 250, 225

  delay(500); // wait for 500 miliseconds

  tone(buzzer,300,200); // plays the tune 300, 200

  delay(500); // wait for 500 miliseconds

  tone(buzzer,350,200); // plays the tune 350, 200

  delay(300); // wait for 300 miliseconds

  tone(buzzer,400,300); // plays the tune 400,300

  delay(500); // wait for 500 miliseconds

  myservo.write(90); // starts at 90 degrees

  delay(2000); // wait for 2 seconds

  myservo.write(0); // goes back to 0 degrees 

  delay(2000); // wait for 2 seconds

 }

 else // if the button isn't pressed, then continue

     // doing this

 {

  tone(buzzer,400,200); // plays the tune 400,200

  delay(500); // wait for 500 miliseconds

  tone(buzzer,350,200); // plays the tune 350, 200

  delay(500); // wait for 500 miliseconds

  tone(buzzer,300,225); // plays the tune 300, 225

  delay(300); // wait for 300 miliseconds

  tone(buzzer,250,225); // plays the tune 250, 225

  delay(500); // wait for 500 miliseconds

  tone(buzzer,300,200); // plays the tune 300, 200

  delay(500); // wait for 500 miliseconds

  tone(buzzer,350,200); // plays the tune 350, 200

  delay(300); // wait for 300 miliseconds

  tone(buzzer,400,300); // plays the tune 400,300

  delay(500); // wait for 500 miliseconds

  myservo.write(90); // starts at 0 degrees

  delay(2000); // wait for 2 seconds

  myservo.write(0); // goes to 0 degrees 

  delay(2000); // wait for 2 seconds

 }

}


Build Steps

5-steps-to-becoming-more-efficient-02.jpg

The steps to build the design are:

  1. First, obviously, you have to make sure your circuit actually works in real life by making it in real life using the diagram you made from tinkercad
  2. Then, you have to cut 1 pringle can in half and use the first half for the storage. With the second can, cut out the tin area at the bottom and use that to keep the food from falling out of the storage.
  3. Then cut out a piece of the tin piece that you cut out and attach it to the tip of the servo motor. This will open and close the storage and let the food out.
  4. Next, you have to cut out a small hole at the back of the can that leads the servo wires outside. Take the second half of the 1st pringle can and make a semi-circle. This is where the pipe will go.
  5. To make the pipe, you can cut out a piece of the 2nd pringle can and insert it into the pipe section.
  6. Next, glue the storage container and the pipe can together. Make sure the servo wires are outside the pipe.
  7. Next, get a shoebox lid and cut out a hole for the pringles can and the bowl.
  8. After that, connect the servo to the rest of the circuit that you built in step 1
  9. Finally, now you can run tests and see if it works.

Personally, it worked for me just fine but I did have a bit of difficulty at first such as how I could add the bottom of the storage can.

Photos

IMG-2610.jpg
IMG-2611.jpg
IMG-2612.jpg
IMG-2613.jpg

Now that we are done with the building steps, here are some pictures of what mine looks like. The design is not perfect and I wish that I covered up the Pringles can with paper so it looks more professional. The third picture shows where the servo motor will go. The tip of the servo motor will be attached to the circular piece which will open and close the can as the servo motor turns. The second picture shows a little hole in the can, which is where the servo wires will go through since you don't want the wires to be stuck inside. The fourth picture shows the pipe for the food which leads to the bowl of cat food (in this case I used cereal since I couldn't get cat food). The first picture is how the whole product looks. Again, there are some parts that look weird, like the hole in the can for the food, and the pringles can since I didn't decorate it, but it does work.

Video

Here is a small little video clip showing that it actually works. As you can see, the hatch opens up every few seconds letting the food out until there is none left. For some reason, the audio for the video wasn't working, however, there is a link to my Tinkercad which will show the alarm that the buzzer makes.

Link to Video:

https://youtu.be/cbPFr086wjw

Link to Tinkercad:

https://www.tinkercad.com/things/5EADh8Xdrnd-sad-cat-feeder/editel

Conclusion

conclusion-stamp-illustration-conclusion-stamp-seal-illustration-design-105706483.jpg

In conclusion, this is how to make an automatic homemade cat feeder and how to make your sad cat happy. You could place this next to where your cat sleeps or in the kitchen and the cat would get alerted by the buzzer.