Inspired by my cats going after my plants, I created a water-spraying cat deterrent using the STHS34PF80 to create a cat presence and motion detector.Favorited Favorite 2
Inspired by my cats going after my plants, I created a water-spraying cat deterrent using the STHS34PF80 to create a cat presence and motion detector.
To see the Cat Presence Detector in action, check out the video walkthrough:
Keep reading to get a more in depth look at the process of developing the cat presence detector (and some cute cat pictures)!
If you’ve ever been an indoor cat owner, you might understand my struggles with cats attacking various plants around the house. I have been a cat owner for over 3 years now, and over the past year I have given up on trying to keep my precious house plants alive. I now have two wonderful cats that are full of way too much energy. I can never even let them outside because they only eat the grass in our yard and get themselves sick. Around my birthday this year, I received a few bouquets of beautiful and expensive flowers. The following week was filled with cleaning up water from a knocked over vase, flower petals and pollen all over my countertops, and cleaning up some, uh, cat “sickness”.
Mixie and Pickles inspecting the flowers that I got for my birthday.
When I go into work and my partner is in meetings all day, it's impossible to keep and eye on them at all times. To help keep my cats away from the flowers, I had a pretty good, non-harmful idea.
Knowing my cats hatred of water, I knew it had to be something to involve our water spray bottles autonomously spraying them when they're spending time in places they should not. I know that there are devices out there that exist for this, but why would I pay money when I have all the components for doing so right here with me! I recently worked on the STHS34PF80 Human Presence Sensor, and I figured since the device reads a persons IR value, it could do the same for a cat.
As mentioned, I recently worked on creating the Human Presence Sensor, so this was a PERFECT use for my project. To use this, I needed to gather some cat IR data. I set out my human presence sensor, a Pocket Dev ESP32 C6, a tape measure, and some treats about 2 feet away from the sensor. I wrote the code using the SparkFun Arduino Library and I2C communication.
That data showed that between both cats, the IR presence value was between 500-570 cm-1 at 2 feet away. As they got closer, the value rose to about 5000 cm-1 when they were standing directly in front of it. I was thinking of choosing the further distance, but throughout my testing when the device was sitting out on the counter, I would walk by the sensor in the room and end up getting sprayed by accident! Because of this, I ended up choosing 3000 cm-1 as my value for the IR sensor to trigger at. Even with the close distance, the cats were luckily still scared away quick enough before any real damage to my flowers were done.
I was not sure on how to use the water bottle initially. So, I was thinking of a few different ideas but ultimately decided on a generic high torque servo motor to hit the trigger. I needed the extra power to help hit the bottle, no matter if the trigger gets a little sticky, or if it is low on water. Although, during the testing of the motors I did have to use two of them. One for the project, and one for my lovely cat, Pickles, to steal away when I was not looking to use as a chew toy. Definitely more evidence that I need this in my house ASAP!
Servo wire that served as a snack for Pickles.
To control the servo and the cat presence sensor, I needed a little more power to do so. I ended up using the RedBoard Plus since there is a 5V output, Qwiic connector, and a USB-C cable output.
For the enclosure, I used various SparkFun boxes and lots of red electrical tape. I measured the cutout sizes then used a box cutter to make the holes. The structural integrity of the project might not be the best, but it has been working well enough for my needs! As for the water bottle, I just ran to the dollar store and picked up a few for testing.
Final enclosure with detection system installed.
Not only were my cats scared, but so were my partner and I when we walked around the corner and forgot about it! I bought a bouquet of flowers to really put this to the test, and it was successful! It has now been 3 days there have been no issues with my cats attacking the flowers. I would say this project has been a great success! I would especially recommend this for orange cat owners 😆
Final project placed in location to protect the flowers.
For a full wishlist of products for this project, check it out here:
You've seen our dogs in the office at SparkFun, but we've got cats causing mischief at home too! Scroll through the pictures below to check out some of our employees' kitties: