CatBot
DATE: 2024-08-21CatBot is a notification system for stray cat sightings. Upon detecting a cat with its camera, CatBot sends a text with the recorded image. CatBot also deters birds, for whom cat food is unhealthy, with an actuator that taps the window upon bird sightings. The project’s code is available here.
Motivation
I lived in Connecticut for a year, next to West Rock state park. There were many stray cats in the area so we started putting food out in our backyard. We’d sometimes catch glimpses of the cats, but I wanted to automate notifications of sightings and record pictures. The resulting system is similar to a homebrewed Bird Buddy.
Implementation
CatBot implementation.
CatBot is built on a Raspberry Pi Zero and uses an embedded camera and computer vision to detect cats. The camera is a standard Raspberry Pi camera with a thin Flask server to serve images. Because the Pi Zero is too underpowered to deploy a computer vision model, a separate Pi 5 requests images from the Zero and performs object detection with a small Faster R-CNN MobileNet model. The Pi 5 also runs a Twillo client to send the cat images to my phone number.
Bare CatBot hardware. Not suspicious at all.
Unfortunately, the exposed cat food also attracted a lot of birds. Cat food is unhealthy and potentially dangerous for birds, so we needed a method to keep them away. We tried a simple shirt-on-a-stick scarecrow, but it scared away both the birds and the cats.
The birds were even more skittish than the cats, so much so that lightly tapping on the window was enough for them to flee. I came up with a solution that shoehorns a servo motor to earn the label of “robot”: a Tower Pro micro servo with a chopstick as the arm taps on the window to scare the birds away. If the Pi 5 detects a bird, it sends a request to the Pi Zero to actuate the motor.
CatBot scaring away a bird.
Results
These are some of the images CatBot collected from 2024/01—05, along with photos from a dedicated Fujifilm X-T3 camera.
Mangy
Mangy definitely looked the most feral of the lot. It had a piercing gaze and a beautiful orange-black-white coat.
Scruffy
Scruffy always looked like it had just been caught in some rain. It had a bit of a droopy face like shy feral cats that live in dark and damp crawl spaces. We’d often find it waiting for food on early weekend mornings.
Mittens
Mittens was named for its perfectly demarcated white paws. I once enticed it to laze on the porch with some leftover deli-sliced chicken.
Creamsicle
Creamsicle was probably the most regular patron of the porch, though so skittish that we never got any closer than the window.
Pinay II
Pinay II had a cookies-and-cream coat that reminded me of my own cat, Pinay.
Chonker
Chonker was overly well fed but approachable. It had a collar but we never figured out its owner.
Panther
Panther was the least frequent visitor and never triggered notifications. Like Chonker, it had a collar but they seemed unfamiliar with each other, suggesting different homes.
Raccoons
We avoided leaving food out overnight lest we attract raccoons.
Timelapse
I created a timelapse with an archive of raw images. The images span from 2024/01—05, with some patches when the system was offline. The image rate also varies as the image request frequency was adjusted during development.
Conclusion
Creamsicle and Mangy sharing the porch.
We’ve since left the neighborhood and the cats, so CatBot is no longer active. We advised the neighbors and new tenants to take care of the cats if they can.
CatBot demonstrates the accessibility of homebrewing open-source alternatives to commercial closed-source products. It’s amazing how simple yet effective this project was, as the work was primarily integrating the subsystems. The code is available for others to use in their own applications.