Anti-cat Countermeasures (kind Of)

by M.C. Langer in Circuits > Arduino

6244 Views, 48 Favorites, 0 Comments

Anti-cat Countermeasures (kind Of)

DSCN9200.JPG
DSCN9193.JPG
DSCN9087.JPG
DSCN9085.JPG

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: the cat 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.

The cat hates four things: vacuum cleaner, sprays, hairdryers and a broken bubble gun I got from one nephew. The 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...

Materials

DSCN9080.JPG
DSCN9071.JPG
DSCN9122.JPG
DSCN9075.JPG

MECHANICAL

  • 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


ELECTRONICAL

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

BIOLOGICAL

  • 1 cat

TOOLS

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

Disassembling the Bubble Gun

DSCN9081.JPG
DSCN9083.JPG
DSCN9090.JPG

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

Transforming the Water Pump Into a Better Gearbox

DSCN9091.JPG
DSCN9092.JPG
DSCN9094.JPG
DSCN9095.JPG
DSCN9097.JPG
DSCN9099.JPG
DSCN9100.JPG
DSCN9096.JPG
DSCN9101.JPG
DSCN9103.JPG
DSCN9108.JPG
DSCN9107.JPG
DSCN9110.JPG
DSCN9111.JPG
DSCN9112.JPG
DSCN9114.JPG

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.

Mounting for the Gearbox

DSCN9120.JPG
DSCN9123.JPG
DSCN9124.JPG
DSCN9126.JPG
DSCN9129.JPG
DSCN9137.JPG
DSCN9140.JPG

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.

Catapult

DSCN9130.JPG
DSCN9131.JPG
DSCN9132.JPG
DSCN9133.JPG
DSCN9136.JPG
DSCN9144.JPG
DSCN9146.JPG

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.

Turret Feet

DSCN9115.JPG
DSCN9116.JPG
DSCN9118.JPG
DSCN9119.JPG

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

LinkIt One Case and Gun Stand

DSCN9149.JPG
DSCN9151.JPG
DSCN9155.JPG
DSCN9150.JPG
DSCN9153.JPG
DSCN9157.JPG
DSCN9160.JPG
DSCN9158.JPG
DSCN9161.JPG

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.

Electronics and Arduino Code

DSCN9072.JPG
DSCN9076.JPG

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

delay(5000);

}

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

}

else

digitalWrite(8,LOW);

}

Completing the Turret

DSCN9162.JPG
DSCN9166.JPG
DSCN9164.JPG
DSCN9168.JPG
DSCN9194.JPG
DSCN9195.JPG

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!

So... Did It Work?

Anti-Cat Countermeasures
DSCN9188.JPG

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...

Conclusion:

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.