Introduction: Anti-cat Countermeasures (kind Of)

About: I'm Mario Caicedo Langer (M.C. for short), a Colombian STEAM educator living in Azerbaijan, BSc in Naval Sciences, Master in Toy Design, and former Navy officer. I am a CAD and 3D Printing enthusiast and an ar…

Welcome to the first Arduino related Instructable of my whole life, courtesy of Instructables and Mediatek Linkit One.

I have to be honest: I am not a very Arduino person but more a simple-bots maker. Even I still see persons who are skillful in Arduino as some kind of techno wizards. But after some weeks, when I finally completed and debugged my first sketch, I thought "Mmmm... interesting!", and when it finally worked in the Linkit One, I shouted "YEAH!" like I have created the atomic bomb.

But I have a big problem: our cat Cringer loves to turn my workshop into a mess. I stand up one single moment, and he jumps over the table, play with the electronic components and spread them all over the home. So I thought my first project had to be some kind of electronic guardian with non-lethal weaponry that keeps my cat out of the area.

Cringer hates four things: vacuum cleaner, sprays, hairdryers and a broken bubble gun I got from one nephew. My cat hates when I aim the bubble gun to him, not because the bubbles (that function doesn't work anymore), but because the sound of the blower and maybe the air coming from it.

So I got this awesome battle plan:

  1. Hack the gearbox of the bubble gun to have to actions: blower and small catapult (modifying the water pump).
  2. Create a "gun turret" to install the bubble gun.
  3. Install the Linkit One with an ultrasonic sensor, to detect proximity of the cat.
  4. When the sensor detects movement, the turret will deploy two countermeasures: defensive (the blower will work, annoying the cat) and offensive (the catapult will launch a plastic ball, so the cat gets a more interesting target to chase out of the workshop).
  5. Workshop protected.
  6. Mario is happy.

Did it work? Well, not in the way I was expecting...

Step 1: Materials


  • 1 Broken bubble gun
  • 1 Circle cap from a coffee machine
  • 3 chairs from a big toy car (legs for the turret)
  • 1 Ferrero Rocher chocolates' box.
  • 1 big plastic angle (the red piece)
  • 1 Plastic coat hanger
  • 1 Iron angle
  • 1 plastic cylinder from toilet odorizer applicator
  • Assorted plastic pieces, nuts, screws and washers.
  • 1 plastic ball


  • 1 Linkit One with battery
  • 1 Ultra Sonic HCSR-04 Range Finder
  • 1 small breadboard
  • 1 relay module
  • Wires (except for the LinkitOne, I got the other components from a Chinesse bootleg Arduino kit from eBay)


  • 1 cat


  • Dremel rotary tool
  • Screwdrivers
  • Pliers
  • Hobby knife
  • Soldering iron

Step 2: Disassembling the Bubble Gun

I removed the screws and the broken case, leaving only the gearbox (blower and pump, both powered by the same the motor.)

Step 3: Transforming the Water Pump Into a Better Gearbox

I opened the gearbox carefully, checking where every piece have to be when I have to assemble it again. Then I removed the water hose.

I removed the shaft from the big gear, replacing it for a long screw. I opened holes in the plastic case, where the previous shaft was, to give space for the new longer shaft.

I introduced the new shaft and screw the gear on it, then I closed the case.

I installed a hard plastic cylinder in the free end of the shaft, so I could install the pieces for the catapult.

Step 4: Mounting for the Gearbox

I cut the plastic cylinder from the odorizer applicator and installed it to the gearbox. Then I attached the iron angle and installed a screw on it, where the catapult will stop for a moment to accumulate energy and give more impulse to the ball.

Step 5: Catapult

I cut a plastic strip from the coathanger, and then fixed a circular piece from the bubble gun, to keep the ball. Then I attached the catapult to the plastic cylinder of the gearbox, using screws. I cut the remaining parts of the coathanger strip.

Step 6: Turret Feet

I attached the toy car chairs to the coffee machine cap, using screws.

Step 7: LinkIt One Case and Gun Stand

I took the chocolates box (without chocolates) and opened two holes for the "eyes" of the ultrasonic sensor.

Then I opened a hole in the center of the box, the center of the turret base and one of the sides of the plastic angle, and I attached them using a screw.

Step 8: Electronics and Arduino Code

I connected the components to the LinkIt One ports in this way:

LinkIt 3V3: to one of the terminals of the gearbox motor.

LinkIt 5V: to the Vcc terminal of the ultrasonic sensor and the 5V terminal of the relay

LinkIt GND: to the GND terminal of the ultrasonic sensor, the GND terminal of the relay and one of the switch terminals to the relay. The other switch terminal will be connected to the other terminal of the gearbox motor in order to activate it.

LinkIt D13: to the Echo terminal of the ultrasonic sensor.

LinkIt D12: to the Trig terminal of the ultrasonic sensor.

LinkIt D8: to the SIG terminal of the relay.

For the sketch, I checked a lot of Arduino instructables to get some inspiration, but the one I analized the most was the Simple Walker Robot from Randofo. Then I try to find the common points to make an ultrasonic sensor works.

The sketch is the following:

/*Code written by M.C. Langer. Be gentle, it´s my first Arduino sketch

#define trigPin 12 // define the pins of your sensor

#define echoPin 13 // define the pins of your sensor too

int rate = 1000; // I saw everybody uses this constant for ultrasonic sensor, so I will do the same for the moment. this constant won't change. It's the pin number

void setup() { Serial.begin(9600);// initialize serial communication at 9600 bits per second

pinMode(8,OUTPUT); pinMode(trigPin, OUTPUT);// set the trig pin to output to send sound waves

pinMode(echoPin, INPUT);// set the echo pin to input to receive sound waves



void loop() {

long duration, distance; // start the scan

pinMode(trigPin, OUTPUT);

digitalWrite(trigPin, LOW);

delayMicroseconds(2); // delay

digitalWrite(trigPin, HIGH);

delayMicroseconds(5); // another delay (I don't get it. It's easier with Lego Mindstorms)

digitalWrite(trigPin, LOW);

duration = pulseIn(echoPin, HIGH);

distance = (duration/2) / 29.1;// convert the distance to centimeters.

if (distance < 50) /*if there's an obstacle in a distance less than 50 centimeters, then... Wait, this is more like Lego Mindstorms. I get it! */


digitalWrite(8,HIGH); delay(7000);





Step 9: Completing the Turret

I placed the electronic part inside the case, and then I attached the gun to the turret. I needed and extra iron strip. Then I placed a plastic ball in the catapult. The turret is ready for test!

Step 10: So... Did It Work?

The first problem was to bring the cat to my desk. Of course, that cat climbs everytime to my table. But just when you need he to do that on purpose, that cat decides it's funnier to pee my bed. Even I tried throwing some sausage pieces to the desk. Nothing.

Finally, after hours of surveillance, Cringer decided it was a good time to mess with my tools.

The results:

  1. The system was activated as it was intended.
  2. The bubble gun was designed to work with 4.5 volts. My system only gives it 3 volts or less, so that explains why the blower doesn't have its cat annoying effect, and why the ball doesn't fly that high.
  3. When the cat saw the ball falling to the ground, he couldn't be less interested.
  4. The blower didn't annoy and scare the cat. In change, the spinning catapult had a mesmerizing effect over the cat. This two minutes video is just a segment of like ten minutes of footage where the cat is frozen over my chair, just watching how the catapult spins and spins...


It worked, but not the way it was intended. The cat loves it, but the repetitive noise is really annoying for the human...

So I decided to dismantle the project. This new knowledge in Arduino and ultrasonic sensors gave me a new idea, and the bubble gun gearbox will be great for another experiment.

And meanwhile, I will have to keep picking electronic components that my cat leaves around the flat.

Spectacular Failures Contest

Participated in the
Spectacular Failures Contest

Animal Innovations Contest

Participated in the
Animal Innovations Contest