Raspberry Pi Cat Feeder

<- Back To Blog

Published: 30/06/2016 UTC

Updated: 30/06/2016 UTC

Recently the cat feeder we brought off TradeMe broke and stopped dishing out the cat food. To be honest it wasn't a very expensive unit, but alas it's always disappointing when something breaks, and you have to buy another one.

So as when most things break, I decided to try to fix it. Opening it up showed that the insides were pretty simple. A master circuit board with integrated display and wires to various components such as a speaker, microphone, the motor driver, and a bump switch when the feeder motor hits 1 of 4 positions. As I went about trying to debug the cat feeder, I found that the issue was most likely in the master circuit board itself. This wasn’t really a bad thing though, as there were a few things about the unit that I did not like. This included it taking three DD batteries and the programming having to be reset every time these were changed. Time to modify it!

Cat Feeder Pulled Apart

Looking around home, I found Raspberry Pi that was not in use. So I decided to see if I could upgrade it with some of the GPIO pins (before someone emails me, I am aware it's overkill). I quite liked the idea of being able to write software for it in a high level language and also being able to have USB devices attached to it.

I started by connecting the Raspberry Pi up to my breadboard, and I added a simple L298 (2A H-Bridge - Dual Motor Driver) to it. After a lot of testing I found that there are four pockets to the food dispenser; when the motor turns it makes contact with switch at one of the four points. There is a trick which stumped me for a while and that is that you have to wait until the switch is pressed and then un-pressed before stopping the motor. The other trick is you can set the number of servings by the number of times the switch position is passed. So algorithmically it needs to do the following to give one serving:

  1. Spin the feeder motor
  2. Wait until the feeder motor switch is pressed
  3. Stop the feeder motor as soon as the switch is un-pressed. To do this, I hastily wrote up a script in Python (this was the first time I had ever written Python, so it's probably not the best) Initial script

Cat Feeder Prototype

I also still had the issue of power, as batteries would only last so long. I have long been a fan of the POE standard (Power over Ethernet - IEEE 802.3af, IEEE 802.3at) This standard allows power to be sent over the network cable. Not to be confused with Ethernet of (mains) Power cables. POE allows me to run network cables anywhere in my house up to 100m and not have to worry about power sockets. Since I can build network cable, this gives me nearly unlimited possibilities for placement of the device (thankfully my wife does not complain about the network cables running around our house). I already had a POE injector (puts power on a Ethernet cable that has data - typically a short loop into from a network switch) from TradeMe in the house and had already started collecting cameras and converting them to POE. There is an awesome device I use from TP-Link that I use for non-POE devices such as cameras to make them POE, it's called a TL-POE10R and I often buy them in bulk because they come in handy for powering things in places where there are no power cords. A good supplier I has found is Mighty Ape - good price and fast delivery.

For live prototyping phase two, I found on TradeMe you can buy these tiny pre-made L298 circuits which have terminal strip connectors built in (I don't trust my cats near a breadboard). I found a nice plastic box at Jaycar to house all the components as they would now no longer fit into the cat feeder without risking jamming the feeder loop. This was a good fit as there was only a single Ethernet cable exposed. I also drilled holes for a manual switch (for later extensions) in parallel with two 6.5mm headphone sockets for any later devices I may wish to attach to it. I installed a simple Debian server on the Raspberry Pi and set-up some cron (scheduled tasks) to feed the cats as normal. Now when people ask who is feeding my cat when I am away, I can say cron is :)

Cat Feeder Prototype 2

The great thing about having a cat feeder so precise (Raspberry Pis do not have a clock themselves, by default they synchronize the time with a ntp server) is that if the cats want the new food they somehow know a few seconds to a minute before the cat feeder goes off, and you can look at your watch and the hands just roll over to the next hour!

Cat Feeder Complete

<- Back To Blog

The opinions expressed on this website are my own and do not necessarily reflect the views of my employer. The posts on this website are provided "as is" with no warranties and confer no rights

Copyright © 2025 Jeremy Sells - See Site Terms/Disclaimer