Waving Cat

Introduction: Waving Cat

This instructable was created in fulfillment of the project requirement of the Makecourse at the University of South Florida (www.makecourse.com)

Have you ever wanted a waving cat that moves whenever someone gets within a certain proximity? Now you can!

Supplies:

Styrofoam

Paper

Servo (3)

LCD Display

Proximity Sensor

Arduino Uno

Paper Clips

Breadboard

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Circuit Schematics

The circuits should be attached is with ground and 5V connected to the railing. This is to assure that multiple component that are being used can be attached equally to power and ground.

Next, connect a jumper cable to a port in the breadboard and port 12 on the Arduino. Connect two servos to the chosen breadboard slot. These will be the servos that move the ears.

The next servo will control the waving arm. Connect this servo to port 5 on the Arduino.

The LCD Display will be connected to its corresponding SDA and SCL slots on the Arduino. VCC will go to the 5V railing and ground to ground. The LCD Display will show the proximity in cm that the Proximity Sensor reads.

Lastly is the Proximity Sensor, the echo pin is assigned port 3 and the trig pin is port 4. This component measures how far something is.

Step 2: 3D CAD Model

Above is the 3D CAD model made is Solidworks as well as the STL parts that was printed. The design is 3D printer friendly and needs no excess supports. It was made of ABS plastic and divided into three different parts. However, the ears are made of Styrofoam, paper, and paperclips to better move with the servo. I made this choice so that nothing can weigh down its movement. I secured everything with glue, however, drilling screws into the body will work as well, given how thick the plastic is.

Step 3: Code

#define trigPin 3 // For Proximity Sensor #define echoPin 2 //For Proximity Sensor int distanceCm; // set the distance measured to be in centemeters //*******************************************/ #include //include the I2C library, this one is a standard Arduino package library #include //this is the special I2C LCD display library that came with the display #include //includes the Servo library LiquidCrystal_I2C myDisplay(0x27,16,2); //this instantiates an LCD object named "myDisplay" //We set the LCD address to 0x27 (this is a hexadecimal number, which is equal to 0b100111); this is the I2C //bus address for the PCF8574 port extender chip that controls the display //and define the number of columns (16) and rows (2) of the display //this tells the methods in the library what display we are dealing with Servo earsServo; //create servo object to control a servo int pos=0; //variable to store the servo position Servo pawServo; // creates servo objoct to control a servo int po =0; //variable to store the servo position /************************set-up function*****************************/ void setup() //starts setup { myDisplay.init(); //initialize the lcd - this sets the character canvas to 5x8 pixels and some other hardware specifics //Note: This .init() method also starts the I2C bus, i.e. there does not need to be //a separate "Wire.begin();" statement in the setup. myDisplay.backlight (); //turns on the backlight Serial.begin (9600); pinMode(trigPin, OUTPUT); //sets trig pin as the output pinMode(echoPin, INPUT); //sets echo pin as input earsServo.attach(12); // attaches the servos that moves the ears pawServo.attach(5); // attaches the servo that moves the arm } //********************************************************************************************************************************************** void loop() //begin loop { float duration, distance; // digitalWrite(trigPin, LOW); // sets the trig pin off at start delayMicroseconds(2); //delay .002 microseconds digitalWrite(trigPin, HIGH); delayMicroseconds(10); digitalWrite(trigPin, LOW); duration = pulseIn(echoPin, HIGH); //turns the echo pin on distanceCm = (duration / 2) * 0.0344; //shows a calculation to display the distance in cm myDisplay.backlight(); //this turns the backlight on myDisplay.setCursor(0,0); //shows where to display the message myDisplay.print(distanceCm); //prints the distance from the proximity sensor myDisplay.print("cm "); //prints 'cm' delay(100); //wait 1000msec myDisplay.setCursor(0,1); delay(100); //wait 100msec //******************************************************************************************************************************************* earsServo.write(pos); //set the servo to the position - on the first run it initializes to 0 pawServo.write(po); //set the servo to the position if (distanceCm<30) //which means an object is detected above the Ultrasound Sensor { myDisplay.print("Someone is near!"); //print a message whenever someone is close if (pos <90) //if the Servo is not already upright { delay(100); //delay 0.1 seconds for(pos=0; pos<=35; pos++) //gradually moves through 35 degrees { for (po=0; po<=90; po++) //gradually moves through 90 degrees { pawServo.write(po<=90); //Sets the position earsServo.write(pos); //sets the position } } } else //Servo is already upright { pos=90; //maintain the upright position delay(100); } } else //no object is detected above the Ultrasound Sensor { myDisplay.print(" "); if (pos >0) //paw is up and does not move { delay(100); //delay 1.5 seconds before reacting for(pos=45; pos>=0; pos--) //gradually moves through 90 degrees { for(po=90; po>=0; po--) pawServo.write(po); earsServo.write(pos); } } else //paw is already up { pos=0; //remain up delay(10); } } }

Attachments

Step 4: Assembling

Upload the code into the Arduino and carefully place the breadboard, Arduino and components into the body. Attach the arm servo onto the hole on the side and the two ears servos parallel to each other on the head. Tie the paperclips on the holes on the servo then stick Styrofoam onto it as ears. I glued paper on it so I could paint it gray with the rest of the cat, but the ears are up to your imagination!

Step 5: Final Product

Enjoy!

Be the First to Share

    Recommendations

    • Magnets Challenge

      Magnets Challenge
    • Raspberry Pi Contest 2020

      Raspberry Pi Contest 2020
    • Wearables Contest

      Wearables Contest

    Discussions