Naughty Robo-Cat

by LamaAlhajHusein in Circuits > Arduino

66 Views, 0 Favorites, 0 Comments

Naughty Robo-Cat

Full Video
IMG_1102(1).jpeg

Do you prefer a clean table... even if it means a messy floor? Introducing our Naughty Robo-Cat, the playful Arduino-powered robot that mimics a mischievous cat’s favorite hobby; knocking things off tables!

Naughty Robo-Cat uses sensors to detect nearby objects on top of a table. Once an object is found, it moves forward with precision distance, then swings its paw to knock the item off the edge. After confirming the object is gone, it moves backwards, rotates, and resumes scanning for the next target; just like a real Naughty Cat!

This project was done by Lama Alhaj Husein, Kimia Jafarlavasani, and Yang Luo, as part of the Computational Design and Digital Fabrication Seminar in the Integrative Technologies & Architectural Design Research (ITECH)M.Sc. Program

Supplies

Useless Machine Presention(1).jpg

As Components you will need:

  1. 1 x Arduino UNO board
  2. 1 x Mini breadboard
  3. 1 x L298N 2A Motor Driver Module
  4. 2 x DC gear motors & wheels
  5. 1 x Micro servo motors
  6. 1 x Ultrasonic sensor
  7. 2 x Infrared sensors
  8. 2 x LEDs
  9. 1 x 330 ohm Resistors
  10. Multiple of M-M & F-M Jumper wires
  11. 1 x Castor wheel
  12. 2 x Power source (9V Battery, and 4x1.5V AA Batteries)

As tools you will need:

  1. 3D Printer set-up
  2. Soldering set-up
  3. Scissor
  4. Double-face tape
  5. Black tape

DC motor with gear and wheels could be purchased as a kit (Acrylic base is found too) in the following link! https://amzn.eu/d/8eGjFTB

Attached are the 3D printed files for the files: Cat body, head and Tail, Ears and eyes, Paws.

Logic

Logic.PNG

The logic behind the Naughty Robo-Cat's behavior begins by reading the infrared (IR) sensor to determine if the surface is safe. If the IR sensor detects an edge (value = 0), the robot immediately moves backward and rotates to avoid falling off. If the IR sensor confirms a safe surface (value = 1), the robot then reads data from the ultrasonic sensor to detect nearby objects. If an object is detected within a moderate distance (between 6 and 60 cm), the robot moves forward. If the object is very close (less than 6 cm), it stops moving, turns on an LED (to simulate blinking eyes), activates the servo motor to strike the object, turns off the LED, moves backward, and then rotates to search for a new object. If no object is detected within range (distance > 60 cm), it simply rotates to continue scanning. This loop ensures continuous playful behavior while avoiding edges and targeting objects on the tabletop.


Logic Overview:

  1. Detection: Detect if there is an object is on the table within range D.
  2. Movement: Move forward until the distance is 6 cm.
  3. Response: move hand and hit the object.
  4. Rotate: find another object.

Circuit

Fritzing.PNG
Circuit

Setting up the hardware for Naughty Robo-Cat is straightforward. Here is it!

  1. Arduino Board: Connect the Arduino UNO board to your computer via USB cable.
  2. IR Sensors: Attach the Output of the front sensor to pin A5 and the back to pin A4
  3. Ultrasonic Sensor: Attach the ultrasonic sensor to pins A2 (Echo) and A3 (Trig).
  4. Motor Driver to control two DC Motors:
  5. Connect the Motor Driver to 9V Battery.
  6. Connect one motor to pins (enA: 5, IN1: 6, IN2: 7).
  7. Connect the other motor to pins (enB: 8, IN3:9, IN4: 10)
  8. Servo Motor:
  9. Connect the first servo to pin 11.
  10. LEDs:
  11. Attach two LED to pin 12.
  12. Breadboard: Arrange the components on a breadboard for convenient connections and adjustments.

Naughty Robo-Cat's movement behavior entails scanning (rotating) to find an object, moving forward until encountering a certain distance from an obstacle, and accompanied by its paw (servo motor) exhibiting knocking behavior. Calibration tasks involve ensuring the proper rotation angle of the servo motor motions, and adjusting the robot's speed to align with its object detection and knocking capabilities.

Assembly

Useless Machine Presention.jpg
WhatsApp Image 2025-06-05 at 21.46.04_f7667ab8.jpg

Naughty Robo-Cat’s is built on a 3D-printed base that holds the Arduino UNO, motor driver, battery packs, and wheel castor. IR sensors are mounted at the bottom (front and back) to detect table edges, while an ultrasonic sensor at the front identifies nearby objects. The upper structure includes a cat-shaped body attached to the base, housing the wiring connection. A servo motor drives the cat paw to knock objects, while LEDs in the head simulate blinking eyes. The design is completed with a cat tail at the back, making the assembly both functional and fun.

Code

The code begins with including the Servo library to enable control of servo motors and setting up and initializes the pins for input and output operations.


Core Functions are defined for specific tasks:

  1. handleObstacle() manages obstacle-avoidance behavior and servo motion.
  2. Ultrasonic_Read() measures distance to objects using the ultrasonic sensor.
  3. Blink()turns on the LED to simulate blinking eyes and logs the action.
  4. sweepServo() moves the servo (cat paw) through a sweeping motion to hit an object.


Motor Control Functions:

  1. forward() moves the robot forward using both motors.
  2. backward() moves the robot backward.
  3. turnLeft() rotates the robot to the left in place.
  4. turnRight() rotates the robot to the right in place.
  5. rotate() scans the environment by rotating in steps and choosing the direction with the nearest object.
  6. rotateAngle() rotates the robot a specific angle either clockwise or counter-clockwise.
  7. stopMotors() stops all DC motors.


The main loop function continuously monitors the environment and controls the Robo-Cat’s behavior using sensor data and actuator functions. It runs at fixed intervals using millis() to avoid overwhelming the system, and begins by checking if the robot is currently in avoidance mode (avoiding == true); if so, it calls handleObstacle() to manage edge or object interactions using timed stages. If not avoiding, the robot reads the distance to nearby objects using Ultrasonic_Read() and checks for edge detection using the infrared sensors (digitalRead(IR_0) and digitalRead(IR_1)). If the front IR sensor detects an edge (res_IR == 0), it stops using (stopMotors() function), moves backward (using backward() function), and sets the system into obstacle-handling mode. Similarly, if the back sensor detects an edge, it moves forward (forward()), stops, and enters avoidance. If an object is detected very close (less than the 6 cm threshold), it stops and prepares to knock it using sweepServo(), which controls the servo paw and LED blinking (Blink()). If no object is in range (distance > 60 cm or invalid), it rotates in place using rotateAngle() to search for new targets. If an object is within 6–60 cm, the robot approaches it using forward().. This loop ties together all major functions to simulate the responsive cat-like behavior.


Find attached the Arduino Code!

Downloads

Your Naughty Robo-Cat Is Ready to Function!

IMG_1103.jpeg
IMG_1096.jpeg
IMG_1101.jpeg

By following these instructions, you should be able to successfully assemble your robot and ensure that it is functioning properly. If you have any further questions or concerns, don't hesitate to reach out for assistance.