Smart cat treat dispenser for "one fast cat" wheel

A (mostly) 3d printed cat treat dispenser. Its specifically designed to mount to a wheel, but can be triggered via API
19
19
1
547
updated June 23, 2025

Description

PDF

My cat LOVES running around the house, but he never wants to play with normal cat toys. Over time, he put on weight and started to develop asthma. Besides the normal treatments like a special diet and a maintenance inhaler, I decided to try and help his health problems through engineering.

The idea is to train my cat to run on a cat wheel by automatically giving him treats. Over time, i can increase the distance he needs to run so that he ends up burning more calories than the treats give him!

This has been a long process, but the prusa design challenge pushed me to finishing up the design and polishing it up enough that I felt that i could release it.

 

Video:

 

Features:

  • Almost entirely 3D printed (other than a motor, 4 bearings, some sensors, and the nuts and bolts
  • Detects that the treat level is low before completely running out! no more sad cats that hear the food dispenser going off, only to be left with an empty belly!
  • Self hosted wifi configuration page (connect to the AP, go to 192.168.4.1, enter your wifi settings, and it will join your wifi network
  • Completely self hosted web UI / API - configure all your settings, vend treats remotely from other smart devices, and track your cats stats!
  • MQTT support - connect your treat dispenser to a platform like homeassistant to see graphs of your cats activity and be alerted to when the treat dispenser is almost out of treats.
  • A bunch of cool design features
    • internal wire channels for cleaner design
    • integrated springy labyrinth joint to prevent gear lubricant from leaking out over time
    • easy to adapt base so you can mount it on your own creations
  • Simple electronics
    • All off-the-shelf sensor boards. No analog components other than some 470 ohm resistors for the LED's used in the light break sensors for detecting treats

_____________________

Build instructions:

Check out the included instruction images. They walk you through step-by-step! The few in the model page are to show examples - to see the full guide, make sure to download the zip file containing all the images!

 

Parts needed (contains affiliate links): 

 

CAD and stuff:

I designed the full build in fusion360. Fitting the mount to the cat wheel was accomplished by taking a graphite rubbing of the wheel base, then scanning that in and using known features to scale the images appropriately.

The treat dispenser uses a double chamber design. The upper chamber has a hopper to hold a large amount of treats. An auger moves the treats to the back of the device, where they drop into a bottom chamber. This bottom chamber feeds the treats forward, and out of the dispenser.

This double decker design solves two problems that i discovered in prototyping:

  1. A single auger screw thats fully loaded with treats is too coarse in its dispensing. Over filling it led to jams. If you tried to fill it slightly less, then multiple (5-8) treats would come out at once, which defeats the purpose of this being a way to exercise my cat at a net caloric negative. Filling the hopper to the point where only single treats came out would require refilling daily / multiple times a day.
    • The double decker design solves this by having the top hopper feed treats slower than the bottom hopper dispenses them. This means you have a large treat reservoir while still spacing out the treats in the bottom level so you have more fine control.
  2. The single auger design can only detect when a cat treat hasn't come out within some threshold of time to detect that its empty. My cat quickly learned that the motor sound meant he was getting a treat. Because of this, the “out of treat” events were a negative stimuli that caused him to avoid running.
    • The double decker design places a second light break sensor between the upper hopper and the lower main body. We can detect that a treat hasn't fallen from the hopper and alert the pet owner while theres still a handful of treats left in the device. No more sad and hungry cats!

 

Electronics:

I attempted to do a circuit diagram by hand, but it was probably only legible by me. Thankfully, the electronics on this project are about as easy as it can get. The project uses a series of magnets attached to the cat wheel. A hall effect sensor on the base reads the magnets to detect the distance ran (basically making a massive magnetic encoder!). 

  • Power the board with a 5v power brick
  • hall effect sensor
    • connect the digital out to pin 4
    • gnd and 3.3v or 5v does to the boards power pin
  • Light break sensors
    • hopper photodiode
      • digital out to pin 17
      • gnd and 3.3v or 5v foes to the boards power pin
    • main chamber 
      • digital out to pin 16
      • same as above for power
  • LEDs
    • for the photo diodes, connect to pins 18 and 16, putting a 470 ohm resistor inline with each LED
    • for the error LED, do the same as above, but connect to pin 13.
  • Motor
    • I used a continuous servo since it makes the code easy and it comes pre-geared so i know it would have enough torque for the augers.
    • Connect the signal wire to pin 21
    • connect gnd and +5v directly to the power brick output. 
      • If you have a microcontroller that has a vin pin, you can possibly connect it to that, but make sure theres no voltage regulating happening between the usb input and the vin pin (since you are pulling power from it). My research pointed me to this being OK with the arduino UNO R4, but I didn't test it.

If you like this project, and want to help out, i would LOVE to have some help designing a basic PCB that handles the power and signaling, since right now you need to connect n sensors to less power / gnd pins than most microcontrollers have. I don't have the time to dive into the world of PCB design, but would totally sit in a discord call and learn!

 

Code:

This project was build in platformIO, which is a plugin for vscode that has some nice features like dependency management, so you don't have to worry about installing libraries. Simply install platformIO, open the project, and it will download and configure everything automatically.

The code can be found at the following github link: https://github.com/MethodicalMaker/Cat_Wheel_Treat_dispenser/tree/main

The code is “a few energy drinks, a box of pizza, and a few late nights” kind of quality, but its functional and well documented. Over the following weeks, ill clean up the code base and get things broken out better into their own files :)

 

Usage:

Power up the board after flashing and join the “CAT_WHEEL_SETUP” wifi network. Enter your wifi info and hit save. The dispenser will join your network and self-host a webpage that you can browse to.

To find the ip address once its on your network, check your router, or reboot the board while you are connected to the serial console.

_____________________

Design info:

The original design was based around an Arduino UNO R4 wifi, however by the time it was delivered and the mechanical design was finalized, I ran into a few bugs. One was that the IDE was reporting that my code fit into ram, but when running, it exhausted the small stack space and was overwriting heap memory. While trying to minimize memory usage, I also discovered that web pages were fast to load on the initial call, but would take 30+ seconds to load (and sometimes time out) on subsequent requests. I initially thought this was memory related, but it appears it might also be a bug in the esp32 used on the R4 for wifi (https://forum.arduino.cc/t/the-simple-web-server-example-for-uno-r4-wifi-needs-to-be-fixed/1210353/2)

 

Because of the bugs, and running into a time deadline, i moved over to developing on a spare esp32-wroom I had sitting around. All of the mechanical parts are designed around the Arduino form factor, and if this project gains interest, ill continue working on getting the networking code working on the Arduino UNO. For the sake of the design competition, the logic that runs the treat vending works fine on the arduino, and the R4 wifi does also have an esp32 on board… If i was a better embedded engineer, there is a way to flash directly to that esp32 and bypass the cortex-m4.

Furthermore, in case anyone wants to tinker with the code before I get to it, I avoided any esp32 only libraries like tzapu/wifimanager, and instead opted to implement the logic myself in a way that works cross-platform

 

_____________________

Troubleshooting:

  • Motor turns briefly but no treat comes out
    • Verify that the photodiodes are set correctly. Theres a small potentiometer you can adjust to set the threshold. A good rule of thumb is to turn it until it lights up green while in normal room lighting, then back it off about ½ a turn.
      • do this while connected to just the power brick. when its connected to your laptop, the voltage from the usb port might be slightly different, which confuses the sensor. its just a basic voltage comparator circuit.
    • Make sure your power brick can provide enough current. If its able to put out 1+ amps, you might need a capacitor across the + and gnd to help handle the initial current draw spike from the motor.
    • make sure you are powering the motor from the power brick and not from the 5v pin on your micro controller!

Tags



Model origin

The author marked this model as their own original creation.

License