Automatic Cat Feeder Using the Raspberry Pi

Authored by storiknow.com and submitted by rhinaldino

After many failed attempts at changing their feeding schedule, our cats are starving by 3:00 AM. What this equates to is many meows until we’re awake. I remembered a post I saw on David Bryan’s blog about his Raspberry Pi controlled automatic cat feeder. Inspired by David, I decided to take a crack at building my own. Here’s what I came up with, and what I’ll be covering in this post.

An automated way to feed the cats both on demand as well as on a schedule.

This cat feeder will be triggered by email. More specifically, Gmail. That’s right, we’re going to set up a Gmail account that our Raspberry Pi will monitor. When an email arrives with the expected subject, the cat feeder will let loose its goods.

I chose this route to avoid overly complicating the project. Feeding the cats on demand is as easy as sending an email, while feeding them on a schedule is as easy as creating an IFTTT applet.

You should have a configured Raspberry Pi ready to go. I used my original Raspberry Pi Model B (26 GPIO pins), an 8gb SD card and the Raspbian distro (highly recommended). This guide was pretty straightforward and got me up and running in no time.

I decided to break this post down into distinct parts for readability:

Here in part one we’re introducing what we’re building and the things you’ll need to get it done

we’re introducing what we’re building and the things you’ll need to get it done Part two will cover writing code to interrogate your Gmail account for an email with the subject feed cats

will cover writing code to interrogate your Gmail account for an email with the subject Meanwhile, part three is going to focus on connecting your servo motor to the Raspberry Pi and writing code to make it spin

is going to focus on connecting your servo motor to the Raspberry Pi and writing code to make it spin And lastly, part four will cover my approach at mounting the Pi and servo motor to the dispenser

Power drill if you plan on attaching the Pi and PVC pipe directly to the dispenser.

Box cutter if you’re using the threaded rods as a fastener, as they’re slightly too large to fit in the servo motor mounting holes.

Hacksaw if you’re going to use the threaded rod from above. It’s a bit too long so we’ll need to shorten it.

[Optional] Building a Custom Stand for the Dispenser

The stand that came with the dispenser didn’t have enough space behind it for the servo motor to be mounted properly. I wasn’t keen on the idea of the servo being up front, especially knowing my cats with wires, so I went the route of building my own.

I chose to build this using copper piping (had to match our boho theme). It didn’t take long to find something on Pinterest that (mostly) fit our needs. This plant holder was re-purposed to be a dry food dispenser stand. The small square in the middle was sized to fit the base of the dispenser firmly, then copper piping was built around it.

I’m not going to go into the specifics of how this was constructed, but here’s a list of additional parts anyway:

So far we talked about what you’ll need to get started. Head over to part two where we cover writing a python script to read your Gmail account using the IMAPClient library.

Ahead of the game? Part three covers rotating the servo motor, and part four is all about connecting the Pi and motor to the dispenser.

dbarrat1 on October 23rd, 2017 at 15:57 UTC »

cached

sinbad_the_genie on October 23rd, 2017 at 15:08 UTC »

Very cool. Why did you want to feed by email? Why not just a set schedule?

edit: These are very good points people are bringing up. My first thought was, "why even use a raspi? An arduino and a RTC could do this for $30 less". But between easily changing feeding times and "manually" feeding, the email solution makes sense.

freewave07 on October 23rd, 2017 at 14:41 UTC »

You should make it delay by 30 seconds every day until it's at a time you want them to be fed