Introduction: Automatic Cat Toy Shooter

Picture of Automatic Cat Toy Shooter

This an instructable on how to make an automatic ping pong ball shooter, for cats.

Materials:

Arduino

Computer

Tape

Hot Glue Gun

Card board

2 cardboard parts of toilet paper rolls

Plastic container at least 4 inches wide, 7 inches long, and 10 inches high

2 dc motors

1 180 degree servo

20 wires

2 pn2222 capacitors

2 1N4001 diodes

2 270 Ω Resistors

An arduino compatible ultrasonic sensor

Popsicle stick

Ping pong balls

2 2.5 inch wheels

Step 1: Top Holes

Picture of Top Holes

Cut 2 1.75 inch holes 2 inches apart on the top of your container. Then, using a glue gun, glue the two motors in the holes. You need to feed them through from the Bottom to the top. Make sure that they are securely inn the wholes when done gluing. The motors should look like the above picture of the prototype.

Step 2: Attaching Wheels

Picture of Attaching Wheels

Attach one wheel to the smaller part of the motor. Make sure that the wheel is centered and level on the motor before gluing. The wheels should look like they do in the picture above when done.

Step 3: Create the Curcuit

Picture of Create the Curcuit

Follow this circuit exactly

Step 4: Sensor Holes

Picture of Sensor Holes

Cut 2 holes to fit your ultrasonic sensor. I had to cut .75 inch holes, that were .5 inches apart

Step 5: Back Hole

Picture of Back Hole

Cut any sized hole in the bottom 3 inches of your container to be able to feed the arduino cable through. I cut mine at 1 inch

Step 6: Top Servo Hole

Picture of Top Servo Hole

My container came with a hole, but you need to cut a 2 inch hold in the top of your container to be able to feed the servo through.

Step 7: Put Arduino and Circuit in the Container

Picture of Put Arduino and Circuit in the Container

Put the arduino and circuit in the container so that the arduino ports are facing the back. Then put your ultra sonic sensor through the holes you cut.

Step 8: Feeder

Picture of Feeder

Cut a 1.5 inch high incision in the toilet paper roll, and cut around it so there is only 15% of the roll left on the back. Then hot glue it right in between the two wheels, so that the open hole part is facing the same way as the sensor.

Step 9: Feeder Step 2

Picture of Feeder Step 2

Cut a 1 inch incision upwards on the second toilet paper roll and cut around it so there is 30% left on the back. Then tape it onto the other roll that is already glued to the container. Make sure that the hole in the roll is facing the back of the container, and its on the bottom part of the roll.

Step 10: Servo Tower

Picture of Servo Tower

Create a 3 inch high, 1 inch wide, and 1 inch long cube tower with a 2 inch squared cover. Then tape the servo on top of it. Then tape a Popsicle stick to the servo so that it is in the hole in the top toilet paper roll. Then glue it to the back left corner of the container

Step 11: Plug Arduino in and Code

Picture of Plug Arduino in and Code

Plug in your arduino and upload this code.

const int trigPin = 9;

const int echoPin = 1;

servoPin = 11;

Servo Servo1;

long duration; int distance;

int motorPinA = 1;

int motorPinB = 2;

int onSpeed = 255;

int offSpeed = 0;

void setup() {

pinMode(trigPin, OUTPUT);

pinMode(echoPin, INPUT);

Serial.begin(9600);

pinMode(motorPinA, OUTPUT);

pinMode(motorPinB, OUTPUT);

Servo1.attach(servoPin); }

void loop() {

trigPin digitalWrite(trigPin, LOW);

delayMicroseconds(2);

digitalWrite(trigPin, HIGH);

delayMicroseconds(10);

digitalWrite(trigPin, LOW);

duration = pulseIn(echoPin, HIGH);

distance= duration*0.034/2;

if (distance < 40) {

analogWrite(motorPinA, onSpeed);

analogWrite(motorPinB, onSpeed);

delay (5000);

Servo1.write(180);

delay (300);

Servo1.write(130);

analogWrite(motorPinA, offSpeed);

analogWrite(motorPinB, offSpeed); } }

Step 12: Enjoy

Picture of Enjoy

Enjoy the new cat toy

Here is a video of it

Comments

tomatoskins (author)2017-11-06

What a cool project! How long did it take you to develop?

534867 (author)tomatoskins2017-11-06

it took me about 1 week, one hour a day! I will add a video of it working tommorow

About This Instructable

980views

17favorites

License:

More by 534867:Automatic Cat Toy Shooter
Add instructable to: