Sunday, February 13, 2022

Cat feeder hack attack

Some time ago a family member gifted me an automatic cat feeder. Not because I was forgetting to feed my cat or laziness. The cat was simply too cunning and manipulative. The cat understood that by harassing each person living in my place he could get 2-3X the amount of food he was supposed to be getting. The result was a chiding by my vet for my cat's excess mass. So in a stroke of intelligence my sister bought the cat feeder to solve the issue. 

 

 It's an Arf Pets feeder. She bought the base model and we used it for at least a year, maybe two before it broke down. For some reason it became unreliable, and my poor wolf-crying cat had his tables flipped and lost weight. Just kidding, we figured it out pretty quickly as the thing would make creepy sounds and no food would come out. So I made an attempt to repair it, and then had other priorities pile on. Another year later and an imminent long vacation and I decided it was time to fix it or replace it. Once again examining it I discovered the first problem.

There is a small rubber paddle at the bottom of the hopper that pushes food at the very bottom of the hopper into the dispensing volumes (I think this paddle really only matters when the food is very low). The paddle is attached to a spindle (which is attached to the feeder motor) via a single coaxial screw. The paddle is a single rubber piece that caps the spindle in the main hopper fixed in place by the coaxial screw. Inside the paddle where it caps the spindle, there are flats, but over time the rubber paddle looses its strength and so the flats become useless for keeping the paddle in motion (maybe this is intentional).

I asked Arf Pets support for a new paddle which they graciously provided (beyond warranty). I thought this was the complete fix, so I put the feeder back into operation with a few weeks to spare before vacation. However I noticed the thing still wasn't reliably dispensing, and it looked more like a motor drive issue. With time running out I decided to hack the crap out of the thing.

My requirements:

  1. Reliable dispensing
  2. Wifi connectivity (why? why not?)

 Teardown

Tearing the system all the way down I was pleased to find a relatively simple system for dispensing. I would not hope to do better in the design. I singled out the control board as being the main issue and tossed it just as soon as I realized trying to determine what exactly the motor driver circuitry was, was going to be exceedingly annoying (it appeared the PCB was multilayered with some of the essential traces hidden beneath some obfuscating silkscreens). With the control board tossed I scrounged up some hacking materials.


 At the top left is the spindle base (black) with a keyed interior for driving the feeder spindle. This spindle base design allows for the complete top half of the feeder assembly to be easily removed. The spindle base also has 4 flags which press a limit switch every 1/4 turn. The spindle base is attached to a gearing system with a small 5V motor below. It appears the system derives a fair amount of torque from this gearing as the overall current for the feeder doesn't exceed 1A (at 5V). 

There is also a nice power switch and speaker, and in the upper right of the above picture a small beam-break element in the feeder chute (I ended up not using this... yet).

Benchtesting


Luckily for me I had just what I needed from yet another 10+ year old Sparkfun purchase. A small motor driver with just the right specifications plopped right down on a breadboard. I combined this  with whatever ESP 32 I had lying around. Lucking out again, my recent purchase of breadboarding jumpers were put to use connecting the connector assembly to the benchtest setup. The pins fit tightly but fit well.

Switching gears to programming the controls, I knew ESP Home would be the quickest way to get this thing done, so I set up a project with a button to control the motor, and an indicator for the limit switch. Flashed onto the ESP and a few minutes later I had the motor turning and the limit switch confirming the turns. Boom.

Packaging/ Reassembly

I transferred the benchtest to a more permanent breadboard which fit just inside where the original control board went. I added some strain-relief in the form of a zip tie and sticky pad, checked clearances and reassembled my now WiFi enabled cat feeder.


Now with a simple HA button I can dispense food for the cat. A couple of quick automation rules later and I had everything working as it should.

I finished all of this with roughly a week left to verify it worked. I also had a cat sitter coming by during my vacation of course so the cat wouldn't just starve if my hack failed. I am pleased to record it has worked reliably for the past three weeks. The extra feature of being able to read the limit switch explicitly is very nice as it gives a high degree of confidence that the feeder is working on some level. I might return to this system to integrate the feeder chute beam break, and set the ESP up to work without an HA automation, but for now it's working better than ever.