Cat Presence Detector

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

Cat Presence Detector

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)!

What’s the issue?

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.

What’s my solution?

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.

How did I do it?

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.

Mixie eating treats 2 feet away from the sensor while I gather IR presence data.
Mixie checking out the new presence sensor.
Pickles eating treats 2 feet away from the sensor.

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.

How did it work?

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:

June and Chowder
June and Chowder
aksel and willie
Aksel and Willie
luke and todd
Luke and Todd

Comments 4 comments

  • Wicky / about 6 months ago / 4

    OMG, Mina has that, "the reason we called you here today is to discuss the amount of treats you've been giving out, we're a little disappointed with your performance". And Mothman is the perfect void. Not to mention Juniper who is the ultimate floof. All cute cats. Kali looks just like our family's Momo, complete with mittens.

    In short, we need more cat content.

  • Member #134773 / about 6 months ago / 4

    It's great to know that there ARE cat lovers at SparkFun! I've been without a kitty for about 5 years now (long story), but mine were getting a bit jealous of all the dog coverage at SF. Being one of those folks who has trouble remembering to water even cactii often enough to keep them alive, I didn't have any problems with my kitties getting into the plants because there were no plants indoors! ;-)

    Of course there are many approaches to this: To me, one of the obvious ones would be to combine the SparkFun Human Presence and Motion Sensor - STHS34PF80 (Qwiic) data with data from something like a SparkFun Qwiic Ultrasonic Distance Sensor - HC-SR04 to cut down on the "false positives" -- though the cats might be able to hear the ultrasonic sensors. i also think that the idea of using a servo to trigger a spray bottle is great! I probably would have done something like a Liquid Pump - 350GPH (12v) or something similar from American Science & Surplus and modified the sprayer -- but I like your idea better!

  • Member #1870688 / about 5 months ago / 2

    Oh my God! What an amazing and creative electronics project! I think it can be used in many families with cats today. I hope you can find investment as soon as possible and develop more products. Looking forward to seeing this product in the market.

Related Posts

The LED's Knees

Recent Posts

2 Open 2 Sauce


All Tags