Make an Automatic Cat Toy and Keep Your Cat Healthy

Introduction: Make an Automatic Cat Toy and Keep Your Cat Healthy

Are you lazy? Do you have a cat that constantly needs to be entertained? Well, this instructable is for you!

All you need is a little bit of handiwork skills and boom! you will have yourself a cat toy that needs no interaction from you.

Supplies

1) Arduino Uno : Brains of the operation

2) Ultrasonic Sensor HC SR04 : Eyes of the operation

3) LN298 Motor Driver : To drive the motor

4) A DC Motor : The muscles of the operation

5) Wooden Boards

6) Wooden dowels

7) Some string

8) Your Cat's Favourite toy

9) A 12v battery source

10) A motor Coupler

11) Basic tools and glue

Step 1: Making the Housing

First, we need to make the housing that holds everything together. It is made up of 4 different pieces. Top, the backboard, and two side panels.

The backboard is a simple rectangular piece of wood of size 30 by 15 cm with a 45 degree bevel on one edge.

The top board is 30 by 15 , but with a slit twice the diameter of the wooden dowel cut onto one side, with a 45 degree bevel on both edges perpendicular to the slit.

both the side pieces are right angle triangular pieces with perpendular sides being 15 by 15 cm. They both have a hole slightly bigger than the wooden dowel diameter.

One of the side piece also has a small protruding wooden piece slightly lower and offset to the front from the hole. This piece acts as a stopper to prevent the arm mechanism from falling down.

Step 2: Making the Inner Mechanism.

We now want to make the arm that is attached to the motor and also has the toy attached to it.

First, attach a 30 cm piece of dowel to your motor by using an appropriately sized coupler.

tip : if a coupler is not available, drill a hole the size of the motor shaft into the dowel and glue the shaft into it,

then, place the end of the motor along the inner face of the side piece and mark out how much dowel you would need to place it inside the hole in the opposite side panel.

Now, mark out where the slit on the upper panel is, and drill a hole into the side of the dowel, to insert another 35 cm dowel. This will be what the toy attaches to.

Now, similarly, insert a small dowel into the main dowel so that it rests on the suport piece of the main body keeping the toy arm parallel to the ground as shown.

Do not attatch the motor to the frame yet. first, we will configure the electronics and the comes assembly time!!!

Step 3: It's Electronics Time!!!

The image shown is the setup i used, however i will explain a simpler method using the l298n motor driver board, rather than the IC.

We are going to use an arduino uno as the brains, and an ultrasonic sensor as the eyes.

First, we will supply 12 v to the l298n motor driver.

the motor driver will have a 5v output pin, which we will use to power the arduino and the ultrasonic sensor and use a common ground.

Now, connect the motor terminals to the output pins of the driver. Then, connect one of the enable pins of the motor driver to the pin 4 of the Uno, and the other enable pin of the motor driver to ground. So, if we put the pin 4 of arduino high, then the motor will spin in one direction.

Now, the ultrasonic sensor's trigger pin is connected to pin 2, which will be used to send a pulse out. And the echo pin is connected to the pin 3 of arduino and will be used to read the echo to locate an object.

Step 4: Coding Time.

Well, fortunately for you, you dont have to code. you can just copy the given code and paste it into the arduino ide. what this code does it it checks if the cat has jumped to grab the toy or not. if the cat has jumped, then the ultrasonic distance sensor will sense it and it will send a signal to the arduino. then we pulse the motor so that the arm goes up taking the toy with it.

CODE

//Variables

const int trigPin = 2;

const int echoPin = 3;

const int motorPin = 4;

float duration, distance;

void setup()

{

//setting up the pins as output or input

pinMode(trigPin, OUTPUT);

pinMode(echoPin, INPUT);

pinMode(motorPin, OUTPUT);

}

void loop()

{

//we want to make sure that the trigger pin is low before we trigger it as high

digitalWrite(trigPin, LOW);

delayMicroseconds(2);

//we set the trigger pin as high to send a pulse out

digitalWrite(trigPin, HIGH);

delayMicroseconds(10);

// again we set it as low

digitalWrite(trigPin, LOW);

// to detect the time of returned pulse, we use pulseIN to see for how long the echopin is at HIGH

duration = pulseIn(echoPin, HIGH);

// distance will be equal to time x speed of sound divided by 2 as the pulse has to go to the object and comeback

distance = ((duration*.0343)/2);

delay(100);

//condition to triger motor. Fine tume this value to trigger it just below the toy.

if( distance < 45 )

{

//enabling motor for 500 ms

digitalWrite(motorPin ,HIGH);

delay(500);

//disabling motor

digitalWrite(motorPin ,LOW);

//delay the loop for 5 seconds to allow the rod to settle

delay(5000);

}

}

Step 5: Assembly Time!

First, find a space on the wall that is not too high.

Mount the housing onto the wall using some screws.

then, put in the motor and dowel arm assembly carefuly, and making sure it stays parallel to the floor.

now, put the toy on a string and hang it from the arm at an appropriate height so that the cat can see it and jump for it.

now, stick the ulrasonic sensor 5-10 cm below the toy so that it can detect the cat before it reaches the toy.

put the arduino, battery and the motor driver on top of the housing and wire everything up.

Pro Tip : to prevent the arm from banging into the housing, use a piece of sponge or foam on the back board where it might touch it and also on the support to prevent noise.

Step 6: Testing and Tuning!

Now, we need to test and fine tune the system to make sure it performs very well as we do not want the cat to kill us in our sleep ; p

First, make sure that the Ultrasonic senor is below the toy as we dont want it to trigger itself XD

then, manually trigger it to see what happens.

If the arm goes up perfectly, amazing! No tuning required!

if the arm goes up too much, and hits the board or the wall, reduce this value a bit.

digitalWrite(motorPin ,HIGH);
delay(500);

If alternatively, the motor is not going up enough, then increase this value a bit.

make sure to do it in steps of 50 or 100.

Then, It's done! let your cat loose and enjoy some funny cat moments!

Tinkercad Student Design Contest

Participated in the
Tinkercad Student Design Contest

Be the First to Share

    Recommendations

    • Maps Challenge

      Maps Challenge
    • Backyard Contest

      Backyard Contest
    • First Time Author Contest

      First Time Author Contest

    2 Comments

    0
    Penolopy Bulnick
    Penolopy Bulnick

    12 months ago

    Thanks for sharing your design!

    0
    anmol9619102271
    anmol9619102271

    Reply 12 months ago

    You're welcome!