Introduction: Sad Cat Fixer: the Jerry 2000

Picture of Sad Cat Fixer: the Jerry 2000

Is your cat sad? Are the hundred's of toys you buying not satisfying your cat needs? Well look no further, the Jerry 2000 will solve your issues and this is how to build it!

The Jerry 2000 is a simple idea, it is a small box where a mouse will be sticking out, as our cat will be approach it two sensors will sense the cat within 20 cm and pull back the mouse will a pulley system made with a servo. The mouse will stay inside until the cat moves away and when it does it will pop back out again.

Step 1: Materials Needed

Picture of Materials Needed

1. 2 Proximity Sensors

2. 1 Standard Servos

3. 2 Popsicle Sticks, wire

4. Arduino with Battery

5. 2 Breadboards

6. Plastic Bin

7. Small drill bit

8. Masking Tape

9. Small Mouse

10. Various Tools (Hacksaw, screwdriver)

Step 2: Building the Mouse Puller With the Sevro

Picture of Building the Mouse Puller With the Sevro

The servo has three connection points, power, ground and a pin connection, code is set up for pin 2. Hook those up to the Arduino and set it to go to 90 degrees. The mouse will stay out and come back in when the cat approaches .

Connect one Popsicle stick with tape so half one side and half on the other. Cut left side down to save space when building and fitting it into a box. Make sure it is secure enough by running the code and making sure it does not wobble at all. Take the small drill bit and wrap some tape around it to protect your hands and began to drill a small hole in the end of the longer side. Take another Popsicle stick and drill the same hole into that, after that, strip a wire and run it through both holes. If the wire is too long, cut it down on both sides, then align the wire on the top and hot glue it down so it does not move. Then, take the wire underneath and wrap it back to itself because hot gluing on the bottom limits it's range of motion.

To attach the mouse to the Popsicle stick, take a screwdriver a create a hole in the mouse. Use a metal hanger and cut a small piece off and insert it into the mouse, use hot glue to secure it in position. Once that is done, attach the mouse via the metal rod to the Popsicle stick, you can either hot glue it or tape it. The reason for taping it is that if the metal rod is too small or long you can adjust it.

That is all for the Servo, now moving onto the sensors!

Step 3: Setting Up the Sensors

Picture of Setting Up the Sensors

The sensors have 4 connections,

ECHO= Pin 10, A2

TRIG= Pin 9, A1

GROUND and POWER

Have the sensors connected the breadboard via jumper wires and use some more jumper wires to then connect it to the Arduino. Setup the second sensor as so and then connect wires to the 5v and GND pins and breadboard. Remember to connected both sensors to the breadboards power and ground and the reason for this is the Arudino only has 1 5v pin.

As you can notice from the pictures, have the sensors set up on both sides with the servo in the middle.

Step 4: Putting It Into a Box

Picture of Putting It Into a Box

Take a plastic container and measure the sensors and using a marker, outline holes for them. Depending on your mouses size, measure a hole according to that. Best/safe way to cut is to down into the box so your hands are not in the way. As well, measure a hole on the back for a battery pack or USB.

Place the breadboard slowly into the bin and place the sensors through the holes, if your measurement was too big, use tape to keep it in place. Place the servo on the left side (if you are looking at the front) as soon in the first picture. A tip if your wires are too messy, tape them together or to the walls of the bin so the pulley system is not obstructed. If the mouse won't line up with the hole, move the servo till it lines up and then tape it down to the breadboard.

Use some cardboard to create a square for the mouse to go out on and to use black construction paper to cover the whole bin.

Step 5: Conclusion

Picture of Conclusion

The Jerry 2000 will keep your cat occupied for hours! If stronger resources are available, such as wood, we recommend that you us it because it will make it stronger and more durable.

CODE

FINAL CODE EXPLANATION
In essence, variables are declared and servo objects are created. A sensor code is run to check if the distance constraint (20cm) has been met.

“ if ( distance > 20) ”

The mouse comes out and waits until the cat enters the distance constraint causing a subsequent inward motion of the mouse. The code keeps looping, allowing the sensors to check if the cat is still present.

//By Hakeem Abdul-Razak and Karan Grewal<br>//This is a fixer for a sad cat using a sevro and 2 sensors
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Sensors for the cat fixer project
// defines pins numbers
const int trigPin = 9;
const int echoPin = 10;
const int trigPin2 = A1;
const int echoPin2 = A2;
// defines variables
long duration;
int distance;
long duration2;
int distance2;
///////////////////////////////////////////////////////
//Servos
#include 
Servo myservo;    //create servo object to control a servo
///////////////////////////////////////////////////////
//Speaker
#include "pitches.h"
int melody[] = {           
   NOTE_C1, NOTE_GS7, NOTE_E1, NOTE_A3, NOTE_G3, 0, NOTE_GS1, NOTE_C3, NOTE_E2
};      // notes in the melody:
int noteDurations[] = {
  4, 8, 8, 4, 4, 4, 8, 4
};    // note durations: 4 = quarter note, 8 = eighth note, etc.:
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void setup() {
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Sensors
  pinMode(trigPin, OUTPUT); // Sets the trigPin as an Output
  pinMode(echoPin, INPUT); // Sets the echoPin as an Input
  pinMode(trigPin2, OUTPUT); // Sets the trigPin2 as an Output
  pinMode(echoPin2, INPUT); // Sets the echoPin2 as an Input
  Serial.begin(9600); // Starts the serial communication  // Starts the main loop to signal the echolation stuff
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Servos
  myservo.attach(2);//attaches the servo on pin 2 to servo object
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void loop() {
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Sensors
// Clears the trigPin
digitalWrite(trigPin, LOW);
delayMicroseconds(5);
// Sets the trigPin on HIGH state for 10 micro seconds
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
// Reads the echoPin, returns the sound wave travel time in microseconds
duration = pulseIn(echoPin, HIGH, 0.001);
// Calculating the distance
distance= duration*0.034/2;
// Prints the distance on the Serial Monitor
Serial.print("Distance: ");
Serial.println(distance);
///////////////////////////////////////////////////////////////////////////
// Clears the trigPin2
digitalWrite(trigPin2, LOW);
delayMicroseconds(5);
// Sets the trigPin on HIGH state for 10 micro seconds
digitalWrite(trigPin2, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin2, LOW);
// Reads the echoPin2, returns the sound wave travel time in microseconds
duration2 = pulseIn(echoPin2, HIGH);
// Calculating the distance
distance2= duration2*0.034/2;
// Prints the distance on the Serial Monitor
Serial.print("Distance2: ");
Serial.println(distance2);
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////  
     
 if ( distance > 20)    
  {                  
//////////////////////////////////////////////////////////
 //MouseOut
 //Servos   
 myservo.write(0);// This will move the mouse out                    
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    //Sensors
    // Clears the trigPin
    digitalWrite(trigPin, LOW);
    delayMicroseconds(5);
     // Sets the trigPin on HIGH state for 10 micro seconds
     digitalWrite(trigPin, HIGH);
     delayMicroseconds(10);
     digitalWrite(trigPin, LOW);                                                                                                                                                                                                                                         // Reads the echoPin, returns the sound wave travel time in microseconds
     duration = pulseIn(echoPin, HIGH, 0.001);
     // Calculating the distance
     distance= duration*0.034/2;
     // Prints the distance on the Serial Monitor
     Serial.print("Distance: ");
     Serial.println(distance);
///////////////////////////////////////////////////////////////////////////
     // Clears the trigPin2
     digitalWrite(trigPin2, LOW);
     delayMicroseconds(5);
//Sets the trigPin on HIGH state for 10 micro seconds
      digitalWrite(trigPin2, HIGH);
      delayMicroseconds(10);
      digitalWrite(trigPin2, LOW);
// Reads the echoPin2, returns the sound wave travel time in microseconds
      duration2 = pulseIn(echoPin2, HIGH);
// Calculating the distance
      distance2= duration2*0.034/2;
 // Prints the distance on the Serial Monitor
      Serial.print("Distance2: ");
      Serial.println(distance2);  
                                  
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////  
   };              
        
if ( distance < 20)                        
     {      
       //MouseIn
       ////////////////////////////////////////////////////////////////////////////////
       myservo.write(90);// this will keep the mouse in
       ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
       //Sensors
       // Clears the trigPin
       digitalWrite(trigPin, LOW);
       delayMicroseconds(5);
       // Sets the trigPin on HIGH state for 10 micro seconds
       digitalWrite(trigPin, HIGH);
       delayMicroseconds(10);
       digitalWrite(trigPin, LOW);
       // Reads the echoPin, returns the sound wave travel time in microseconds
       duration = pulseIn(echoPin, HIGH, 0.001);
       // Calculating the distance
       distance= duration*0.034/2;
       // Prints the distance on the Serial Monitor
       Serial.print("Distance: ");
       Serial.println(distance);
       ///////////////////////////////////////////////////////////////////////////
       // Clears the trigPin2
       digitalWrite(trigPin2, LOW);
       delayMicroseconds(5);
       // Sets the trigPin on HIGH state for 10 micro seconds
       digitalWrite(trigPin2, HIGH);
       delayMicroseconds(10);
       digitalWrite(trigPin2, LOW);
       // Reads the echoPin2, returns the sound wave travel time in microseconds
       duration2 = pulseIn(echoPin2, HIGH);
       // Calculating the distance
       distance2= duration2*0.034/2;
       // Prints the distance on the Serial Monitor
       Serial.print("Distance2: ");
       Serial.println(distance2);  
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
      }                                         
    }

Comments

eXtremeSomething (author)2017-04-22

Great Project and love the title but don't electronic cat and mouse repellents use ultrasonic transducers?

Swansong (author)2017-04-20

That's cute! Ours would love this :)

About This Instructable

682views

11favorites

License:

More by KaranG35:Sad Cat Fixer: The Jerry 2000
Add instructable to: