Lucky Cat

This project is a 3D-printed lucky cat model that uses a continuous servo and a CPX (Circuit Playground Express) to move one arm. (3D printer needed).
Supplies
- 3D printer
- Tinkercad
- Mu Editor (downloadable)
- CPX (Circuit Playground Express)
- Adafruit Circuit Playground Express Basekit
- Thingiverse (optional)
- Makerbot Cloudprint (optional)
- Continuous rotation micro servo
- Jumper wire alligator clips
- Battery
- USB-A/USB-C
- PC/Mac
- Small cylinder tube
- Hot glue
Print 3D Model

On the website, Tinkercad, use the lucky cat model that comes with the program found on the shape catalogue on the right of the screen. Click on where it says “Basic Shapes” and change it to “Creatures & Characters”. Scroll down until you find the lucky cat model and drag it onto your workplane. Using a basic box shape, remove an arm and replace it with any 3D arm model of your desire. Arm models can be found on websites such as Thingiverse. Also use a cylinder shape to hollow out the model to make room for the servo. When you are done customizing your model, use a website like Makerbot Cloudprint to 3D print your model. (Printing cat body and arm separately is recommended).
Making Sure Continuous Servo Fits

After you have printed your model, make sure that the servo fits in the hollow you made on your cat model in Tinkercad using the cylinder shape, and make sure you have a hole to connect the servo to your arm.
Making Sure Your Small Tube Properly Connects Your Arm and Servo

Using either hot glue, or making a hole in your printed arm, make sure that your cylindrical tube fits tight on both the servo and arm so that it doesn't fall apart when it begins to move. If using hot glue, wait until the servo goes inside the cat to hot glue the tube to the servo.
Connect Your CPX and Servo/Coding

Connect your CPX to your servo using your jumper wire alligator clips. The ground wire connects to GND, the power wire to VOUT, and the signal wire to A2. Using a USB-A or USB-C, depending on whether you have a PC or Mac, connect your CPX to your computer to get ready to code. Using Mu Editor, a program you can download here, insert the following code to a new page on the editor:
import time
import board
import pwmio
from adafruit_motor import servo
from adafruit_circuitplayground import cp
pwm = pwmio.PMWOut(board.AI, duty_cyle=2 ** 15, frequency=100)
# create a PWMOut object on Pin A2.
# Create a servo object, my_servo.
my_servo = servo.ContinuousServo(pwm)
cp.pixels.brightness = 0.1
while True:
cp.pixels[0] = (3, 32, 252)
cp.pixels[1] = (252, 3, 227)
cp.pixels[3] = (245, 122, 122)
cp.pixels[4] = (12, 232, 67)
cp.pixels[5] = (0, 13, 255)
cp.pixels[6] = (255, 0, 234)
cp.pixels[7] = (61, 252, 3)
cp.pixels[8] = (248, 252, 3)
cp.pixels[9] = (248, 252, 3)
print("Sound level:", cp.sound_level)
print((cp.sound_level,))
time.sleep(0.1)
print("Light:", cp.light)
time.sleep(0.2)
if cp.button_a:
print("Button A pressed!")
cp.red_led = True
print("forward")
my_servo.throttle = 1.0
time.sleep(2.0)
print("stop")
my_servo.throttle = 0.0
time.sleep(30.0)
print("reverse")
my_servo.throttle = -1.0
time.sleep(2.0)
print("stop")
my_servo.throttle = 0.0
time.sleep(30.0)
if cp.loud_sound():
cp.play_tone(100, 1)
cp.play_tone(175, 1)
else:
cp.pixels.fill((0, 0, 0))
- This code was made using resources from Adafruit Circuit Playground Express Basekit.
Finishing Model

After you make sure the code is working, insert the servo inside the cat and connect the arm using your small tube. Using hot glue, go ahead and secure the servo inside the cat. This should finalize the exterior of the lucky cat model.
Connecting Battery

Disconnect your CPX from your computer by ejecting the USB and connect it to a battery if you want your model to be portable. You should now have a functional 3D-printed lucky cat!