Introduction: Robotic Cat Toy

My family has two cats, and one of them really likes to play with string. Unfortunately, being a cat, she likes to ask for it at inconvenient times, such as during meals, or when I'm doing school. For that reason, I designed a robotic cat toy that pulls string for her. The robot is a simple obstacle avoiding robot, based on an Arduino.

Materials:

Tools:

  • Hacksaw
  • Fine-Tipped Marker
  • Soldering Iron
  • Computer
  • Drill

Step 1: Mounting the Motors

Test fit your motors on the sheet of acrylic, as shown in the main photo. Trace along the side of the motor using a fine-tipped marker. Use a saw to cut along the lines you marked(middle right photo). Once you have cut along the lines, fit the motors on and wrap tape around the motor and the section of acrylic underneath it. Be careful not to let the tape obstruct the movement of the motor shaft. Mount the wheels on the motor shafts(bottom right photo).

Step 2: Mounting the Front Slider

In this step, you will be mounting the slider that is mounted on the front of the robot's chassis to keep it balanced. Cut a soft piece of waste plastic, such as one from a water water, into the shape shown in the picture on the right. Use a marker to mark a short line in the middle of the front of the acrylic sheet that makes up the robot chassis, as shown in the middle photo. Use a hacksaw to cut along this line marked. Slide the piece of plastic you cut into to the groove you made with the hacksaw, as shown in the photo on the left.

Step 3: Mounting the Motor Driver

Solder short hookup wires to the motors. Connect the motors to the screw terminals on the sides of the motor drivers, as shown in the picture on the right. Only the connect the motor driver to the motors, not any of the other connections. Slide the motor driver between the motors.

Step 4: Mounting the Ultrasonic Sensor

Mount the ultrasonic rangefinder on the Arduino. The ultrasonic sensor can be mounted directly onto the pins of the Arduino, as shown in the pictures.

Step 5: Mounting the Arduino

Test-fit the Arduino on the robot frame. Mark where the holes on the Arduino meet the frame with a marker, as shown in the main photo. Drill holes in the places marked. Fit the Arduino on the chassis in the same position as before. Run bolts through both the holes in the Arduino circuit board and the holes in the frame. Screw nuts onto the ends of the bolts. The Arduino should now be firmly mounted on the chassis. Connect the motor driver board to the Arduino, as shown in the diagram. Ignore the red, black, dark blue, and green wires in the diagram.

Step 6: Mounting the Nine-volt Battery Clip

Make the connections according to the diagram, but don't connect the nine-volt battery, only the clip. Connect a jumper wire between the screw block terminal on the motor driver that is marked +5v and the five-volt pin on the Arduino.

Step 7: Programming the Arduino

Open Arduino IDE on your computer. If you don't already have Arduino IDE installed on your computer, you can download it here. Plug the Arduino on the robot into your computer with a USB A to USB B cable. Copy the code included here and paste it into Arduino IDE. Upload the code onto the Arduino.

int trigPin =9;<br>int echoPin = 10;
const int gndPin = 11;
const int plusPin = 8;
int revright = 4;      
int fwdleft = 7;      
int revleft= 6;       
int fwdright= 5;       
int c = 0;
 
void setup() {
  
   pinMode(5, OUTPUT);
   pinMode(gndPin, OUTPUT);
   digitalWrite(gndPin, LOW);
   pinMode(plusPin, OUTPUT);
   digitalWrite(plusPin, HIGH);
   pinMode(6, OUTPUT);
   pinMode(4, OUTPUT);
   pinMode(7, OUTPUT);
   pinMode(trigPin, OUTPUT);
  pinMode(echoPin, INPUT);

}
 
void loop() {
  long duration, distance;
  digitalWrite(trigPin,HIGH);
  delayMicroseconds(1000);
  digitalWrite(trigPin, LOW);
  duration=pulseIn(echoPin, HIGH);
  distance =(duration/2)/29.1;
  //Serial.print(distance);
  //Serial.println("CM");
  delay(10);
 
  
  if((distance>20))
 {
  digitalWrite(5,HIGH);                               
   digitalWrite(4,LOW);                               
   digitalWrite(6,LOW);                               
   digitalWrite(7,HIGH);                              
 }
 
  else if(distance<20)  
 {
   digitalWrite(5,HIGH);
   digitalWrite(4,LOW);
   digitalWrite(6,HIGH);                                 
   digitalWrite(7,LOW);
                                            
 }
 
}

Step 8: Mounting the Cat Toy

Use tape to stick a piece of string to the back of the robot chassis. Make sure that the string is firmly attached, or a cat could pull it off.

Step 9: Conclusion

To use the robot, connect the nine-volt battery to the nine-volt battery clip. The robot will pull the string behind it. If there is an obstacle, the robot will change direction, avoiding the obstacle.

Pets Challenge

Participated in the
Pets Challenge