Keep Pesky Cats At Bay With A Machine-Learning Turret Gun

It doesn’t take long after getting a cat in your life to learn who’s really in charge. Cats do pretty much what they want to do, when they want to do it, and for exactly as long as it suits them. Any correlation with your wants and needs is strictly coincidental, and subject to change without notice, because cats.

[Alvaro Ferrán Cifuentes] almost learned this the hard way, when his cat developed a habit of exploring the countertops in his kitchen and nearly turned on the cooktop while he was away. To modulate this behavior, [Alvaro] built this AI Nerf turret gun. The business end of the system is just a gun mounted on a pan-tilt base made from 3D-printed parts and a pair of hobby servos. A webcam rides atop the gun and feeds into a PC running software that implements the YOLO3 localization algorithm. The program finds the cat, tracks its centroid, and swivels the gun to match it. If the cat stays in the no-go zone above the countertop for three seconds, he gets a dart in his general direction. [Alvaro] found that the noise of the gun tracking him was enough to send the cat scampering, proving that cats are capable of learning as long as it suits them.

We like this build and appreciate any attempt to bring order to the chaos a cat can bring to a household. It also puts us in mind of [Matthias Wandel]’s recent attempt to keep warm in his shop, although his detection algorithm was much simpler.

31 thoughts on “Keep Pesky Cats At Bay With A Machine-Learning Turret Gun

  1. omg. this would be PERFECT for some of the neighborhood rodents that like to come and eat from our bird feeder, have babies, eat some more, rinse and repeat. Perfect timing and wouldnt have to risk shooting the birds! So awesome.

    1. Actually cats aren’t rodents, they’re more closely related to weasels, evolutionarily speaking humans are closer to rodents than cats. (And from some people I’ve met it’s pretty f**king close!)

  2. If you needed to create this, then why did you need to have a cat ??
    Wouldn’t life be easier if you did not NEED to create an animal control device.
    I just don’t get it.

    1. Cats aren’t that hard to train, if you get them young, you can teach them anything. Just takes time, patience, and consistency. The turret idea, just relieves him of spending time training the cat, and a fun way to play with technology… The low tech way would be laying out aluminum foil, where you don’t want the cat to step, most hat the noise. If that fails, sticky paper, which can be super effective. They don’t seem interested in stepping on any kind of paper soon after, plus it’s sort of amusing to watch. Most of the cats I’ve had, don’t like their feet messed with at all. They’ll tolerate it to a point, if they trust you aren’t going to hurt them.

      1. One can use an automated air shooter. They detect movement and shoot cats (and everything else) with burst of high-pressure air stream. Just place it at the path you don’t want your cat to follow, and it will tell the animal “You shall not pass!”. Very safe, very humane and clean…

  3. It looks like it would be shooting a bit below the belt when in “human” (person) mode. It’s actually rather comic, as if robots have not only the “Kill all humans!!” imperitive but also “Neuter all humans!!”

    1. OP does report that the cat learned to skedaddle as soon as he heard the turret slewing onto target. Similar to the deterrent effect the sound of racking a shell into a shotgun should have on a home intruder.

  4. I got the same setup using the Intel NCS for on-board inference, hooked up to a water gun. Thinking to build an upscaled paintball version for our paintball games. Now what could possibly go wrong with giving a paintball gun to an experimental AI?

  5. This was exactly what I was trying to build, but the target was squirrels in my garden. Yolo didn’t work well enough with the noisy background and I never got around to building the turret. This year, I took the low tech approach and built a cage out of PVC pipe and chicken wire around my tomatoes.

    For a cat deterrent, I just built a simple PIR sensor/arduino/servo/squirt bottle system and put it where the cat wasn’t supposed to go. After the first time it squirted, the cat just avoids the area. The arduino doesn’t even need to be powered on.

  6. Oh, the hubris. Let’s all agree not to combine “machine learning” and “gun and/or bomb”, k?

    We apparently haven’t learned through our many “historical documents” and their “machine learning+fatality potential” examples such as The Forbin Project, SkyNet, HAL9000, Johnny Five, The Red Queen, Ash from Alien, Roy Batty, Hector from Saturn 3, Omnius from Dune, The WOPR, D.A.R.Y.L., Gigolo Joe from A.I., JINX from SpaceCamp, and worst of all: f’ing Windows Updates.

    Sure, we’re probably not going to get all Talos’d and be wiped out by your RasPi with a nerf gun… but you know… it’s the principle of the thing. As kewl as it would be to sport an automated defense system on your kids’ sandbox, let’s weigh the risks, eh?

    Not to mention angering our overlords and masters, the Cats, may not be wise. Just look at them. It’s clear they casually tolerate our existence on this world only because we have an opposable thumb to open the can of cat food and possess the necessary dexterity to make the laser-pointer do crazy, unpredictable things. Let’s not dance on the minefield. Speaking of which, let’s keep the machines away from those things also, while we’re at it.

  7. Someone should try a phased array of woofers to “pet” the cat from a distance. Can’t poke ‘yer eye out then.

    Remember those old rubber diaphragm powered pop guns that shot out an air pressure wave? Cats hate it when something they cannot see… TOUCHES THEM!

  8. Cats adapt to new scenarios quickly. A speeding object toward them stimulates their hunt instincts and they will try and catch the object mid flight. They are near-sighted so it will be out of focus for a split second, but is still a snatcahble target. However, the turret motors distract them and they will abandon that scenario. Need to use Teflon or nylon gears to quiet it down. Or put a remote slave loudspeaker 90 degrees out of phase to the target area to distract them sonic target alpha (your rig).You trigger the random sonic device bravo a split second before alpha. The cat looks to bravo, and alpha fires its dart.It the sound is random and abrupt the cat wont adapt to it.

    This kinda’ sort’ reminds me of USN Phalanx CIWS defense system.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.