Tag: automatic

Automatic Cat Feeder Using the Raspberry Pi

Automatic Cat Feeder Using the Raspberry Pi

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. So long as the cats don’t figure out the email account and secret subject, this should be a viable solution.


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.

The Parts

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
  • Part two will cover writing code to interrogate your Gmail account for an email with the subject feed cats
  • Meanwhile, part three 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

The Things You’ll Need for the Automatic Cat Feeder

  • Cereal/ Dry Food Dispenser to hold the cat food. The stand this dispenser came with didn’t have sufficient space to mount the motor on the back end. I wanted the motor to be hidden as much as possible, so this drove me to build my own stand for the dispenser.
  • Servo motor to spin the dispenser. I used this continuous rotation servo motor, though the standard non-continuous servo motor will work just the same, as we won’t be doing a full revolution. 
  • 10 Watt 5V USB Power Adapter to power the Pi and motor. The motor draws a good amount of current, so we need to make sure the power supply is capable of supporting it. I ended up using my iPad charger.
  • 3x Male-to Female jumper cables to connect the motor to the Pi’s GPIO pins.
  • WiFi Dongle, unless you’ll be hard wiring or have a later Raspberry Pi model that comes with the WiFi built in (good on you).
  • I have two cats, so I used a PVC fitting that will split the load into two bowls. Ideally, a 2 inch PVC Double 90 Degree Elbow. They don’t sell them in stores around me, so I settled on the double wye and plugged the center hole.
  • Zip ties, or some other cheap and easy fastener.
  • 1x #8-32 Threaded Rod to fasten the base of the servo motor to the dispenser, keeping it from spinning.
  • 4x #8-32 Hex Nut to tighten the rod in place.

The Tools

  • 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:

Conclusion and Next Steps

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. 


Hi, I’m Sam.
I’m a programmer and a DIYer. When I’m not finding things to build I enjoy cooking, hiking, camping and traveling the world with my best friend. Say Hello!