Sentry Robot Turns Bad Cat To Good

The household of [James Watts] has cats, and those cats have decided that various spots of carpet are just great for digging up with their claws. After some efforts at training the cats, [James] enlisted a robotic cat trainer with remote wireless sensors. The automated trainer does only one job, but it does that one job reliably and tirelessly, which is just what is needed in this case. A task like “automate training the cats to stop clawing the carpet” is really made up of many smaller problems, and [James] implemented a number of clever ideas in his solution.

First of all, the need for an automated solution has a lot to do with how pets form associations, and the need to have the negative reinforcement be in the right place at the right time to be effective. A harmless spritz of water in this case is used for correction and needed to be applied immediately, consistently, and “from out of nowhere” (instead of coming from a person.) Otherwise, as [James] discovered, spraying water when the cats clawed the carpet simply meant that they stopped doing it when he was around.

There were a number of tricky problems to solve in the process. One was how to reliably detect cats actually clawing the carpet. Another was how to direct the harmless spray of water to only the spot in question, and how to rig and manage a water supply without creating another mess in the process. Finally, the whole thing needed to be clean and tidy; a hackjob with a mess of wires strung everywhere just wouldn’t do.

base_frontTo achieve all this, [James] created a main sprayer unit that is wirelessly connected to remote sensor units using NRF24L01+ serial packet radios. When a remote senses that a trouble spot is being clawed, the main unit uses an RC servo to swivel a spray nozzle in the correct direction and give the offending feline a watery reminder.

The self-contained remote sensors use an accelerometer to detect the slight lifting of the carpet when it’s being clawed. [James] programmed the MMA8452Q three axis accelerometer to trigger an external pin when motion is sensed above a certain threshold, and this event is sent over the wireless link.

For the main sprayer unit itself, [James] cleverly based it around an off-the-shelf replacement windshield washer tank. With an integrated pump, tubing, and assortment of nozzles there was no need to design any of those elements from scratch. If you want to give the project a shot, check out the github repository — probably worth it it since one night is all it took to change the cat behavior which explains the lack of any action video.

Pet projects usually center around automating the feeding process, but it’s nice to see other applications. For something on the positive-reinforcement end of training, check out this cat exercise wheel that integrates a treat dispenser to encourage an exercise regimen.

48 thoughts on “Sentry Robot Turns Bad Cat To Good

      1. In a word. “FEEL” – I have 2 cats and discovered each have their “preferences”
        For instance – Toys: I have one that hates toys with bells and metallic items, however the soft balls like mice are great. The other, things that make a “skitter” sound or rattle around on the floor. Legos, beads and the like seem to work good :)

        The other day out of the blue one decided the child’s homework that was rolled up like a poster was the best. Literally the cat ate her homework. Still giggling about that!

      2. In my experience, the sofa might be a lost cause. We had a nice loveseat but the boys tore it up. When we bought a new one, I kept all the fabric from the old one and made a scratching post from it, knowing they like the fabric.

        They leave the new sofa alone now, and I have tons of replacement upholstery for when they go through the post I have up now

        1. Exactly this. My annoying-stuff-scratching cat has a priority queue. Luckily on-edge cardboard is her favorite so if we keep that stocked she doesn’t go after wood (her second favorite). But she doesn’t give a crap about sisal so the rope wrapped trees are useless to her.

      3. I haven’t done much testing on it yet (my subject pool for experimentation is luckily only 2) but the sensor module is designed to allow placement on vertical textiles like couches and the like as well as carpets. The accelerometers may require a bit of tuning depending on how tightly the fabric is attached to the couch to reliably detect the cat pulling the fabric but to ignore other noise (and the placement of the base unit may have to be a bit different or higher), but it should work pretty well.

    1. I do agree with you on this one! Cats are not inherently mischievous. (Well, most of them, anyway.) If a cat is clawing something they shouldn’t, it’s because they need to indulge some instinctual behavior and in typical cat fashion, they see no good reason why they shouldn’t.

      Of course, this doesn’t mean cats don’t misbehave! But it does mean that they are not doing it because they get a charge or kick out of being bad, which is an important distinction. Their need isn’t to be “bad”; so it’s possible to get them to do something else to fill that need instead (like maybe a daily play at sunset, like you say.)

      As with most things, sometimes easier said than done. I have a cat who prefers the corner of the couch and frankly in our household I think we’ve all just sort of agreed we’re looking the other way on that one.

  1. I have laser pointer cat toy attached to cheap rc servos controlled by arduino clone… Nice toys and keeps cats occupied some time when correctly placed and programmed several paths for beam to move…

    1. The amount of water sprayed by the unit is fairly small for each activation (probably less than a tablespoon, though I haven’t measured exactly), but is probably better used on textiles / carpets that are not particularly sensitive to water (so not so good for leather). That said, the length of the pump activation (and thus how much water is delivered) is easy to tune in the code if needed.

      Thanks for checking it out!

  2. Sigh. This is literally the opposite of negative reinforcement. This is positive punishment.

    Positive is giving something.
    Negative is taking away something.

    Reinforcement is applied to encourage a behavior.
    Punishment is applied to discourage a behavior.

    In this case, water is being given (positive) to discourage scratching (punishment).

    1. > In this case, water is being given […]

      In the end, it’s just heat that’s being taken.
      Or… it’s electrons’n holes all the way down :-)
      (All tongue-in-cheek)

    2. I was about to point out the same mistake.

      As Ian said, the term negative reinforcement is used incorrectly in the summary. Reinforcement is a procedure in which a consequence is presented following behavior that produces _increases_ in the behavior. So, if you provided negative reinforcement following carpet scratching, technically speaking, you would be increasing carpet scratching. Conversely, punishment is a procedure in which a consequence is presented following behavior that produces _decreases_ in behavior.

      In this context, the words positive and negative do not mean good or bad. There are a variety of reasons why “positive” and “negative” are not and should not be interchangeable with “good” and “bad”, but the most straightforward is just for the sake of precision. They mean “presentation” and “removal”, respectively. In addition, things that serve as positive reinforcers are often “good”, but there are cases when they are not, or when their effect depends on other contextual variables.

      1. on a different note, watch how you “teach” your dog.

        BE REALLY CAREFUL HOW YOU SCOLD/YELL AT THEM!!!

        I swear my dog Ralph though his name was “fucken”, most of the time he was kinda, sorta “ok”, when things got serious, he would ignore me unless I was yelling “FUCKEN RALPH!!!”, “FUCKEN HERE!!!”, “FUCKEN SIT!!!”

        Which is ok at home, but can get awkward in a public place…

      2. That’s very interesting, thanks for sharing. I genuinely did not know that. I, like many people, had thought that negative reinforcement = ‘no, bad, stop!’ type training, and positive reinforcement = ‘yes, good, again, have a treat!’ type training. Thanks for sharing!

    1. I lived in a house that had siding with voids in the inner layers of the plies. The woodpeckers would peck a straight line of holes through the outside. Birds doing something in a straight line! Was it bugs or just the voids? The house also had clerestory windows which set up a light show for “the Kamikaze Cardinal”, fly at it -repeat.

  3. technically unlawful in South Australia!!

    by the letter of the law, “Any device that causes discomfort or harm to any animal”.

    This is a good idea, my furniture took a hammering from the problem cat, Columbia!

    She was the only feline that we all feared!

    Not just my really big dogs, but the police sniffer dog as well!

      1. excellent point!!!

        we do, but “blow guns” are a huge fine, so curtain rods and 15mm conduit need to be banned!!!

        I live in a sad “nanny state”, where the fun police fuck up all fun and big mining rule….

    1. I’m certainly no expert on law in general or in Australia in particular, but my guess is that while most cats find being sprayed with water to be unpleasant I’m not sure that it would cause discomfort to the extent that a law like this would require to be applicable, but it is possible I guess. One of the primary design goals was to ensure no lasting discomfort or harm would be done to the animal (I love my cats and don’t want to harm them in any way).

      Thanks for checking it out!

  4. A non-water solution that could also work in this situation is to use a compressed air can (the kind used for blowing dust off electronics); the air leaving the can makes a “hiss” sound that (in the case of my cats) does a great job of scaring the cats away and does not need to be directional. A commercial automated version can be seen at http://www.drsfostersmith.com/product/prod_display.cfm?c=3261+1894+10802&pcatid=10802. The main disadvantage of this version is that it does not distinguish between cat & human, so it’ll scare the crap out of me on occasion too!

  5. Another sprayer option is the WLtoys Water Cannon. Costs about $8, powered by 5V. WLtoys also makes other interesting gadgets designed to be attached to a quadcopter: bubble maker, plastic missile launcher, grappling hook winch, and the typical camera.

    1. All of the code and other related material in the repository has been released with a BSD license (see LICENSE.txt) in the root of the repository, and I fully encourage / would love to see someone else build one of their own. Please correct me if I’m wrong here (and it may also depend on your particular locality) but typically functional patents such as the provisional patent filed for this device only protect against unlicensed uses of the covered claims for commercial gain, and would not have any bearing on you should you choose to build one of these for personal use or make use of the information in the repository, only if you decided to publicly offer them for sale. That all said, I can also offer (for what it’s worth) my personal assurance that the provisional patent has only been filed in case the device turns out to have widespread commercial potential (probably a long shot) and because of my desire to try / learn about the process of filing for patents, and would not ever (even if possible) be used in any way against any other hobbyists who desire to build or modify this device for their own use.

      1. Personal use being non-infringing is a characteristic of European patents but not USA ones, it would be infringement to build patented devices for our own use, and if you discovered one of us had done so, you would need to either grant a license specifically to an individual or else prosecute (or risk losing defensibility of your patent).

        1. Thanks for the information! While it’s still not clear to me to what extent this is actually applicable in practice to this specific situation, I appreciate the heads up, and have updated the README and project page with some more information about this.

  6. For cats get a hunk of bark covered firewood. Heavy, cut in half on the floor or attached to wall or something that doesn’t move at all.
    Would you want to hammer on something on an anvil or on the end of a diving board?

  7. I would really suggest a behavioral solution before trying something like this. Scratchposts should be tried first, in different locations.

    I also recommend watching “my cat from hell” to get a better appreciation of how counterintuitive “cat logic” is and how to deal with that.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

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