Overview

You have probably seen one of the adorable cats in the video above or in the picture below while out on the town: Lucky Cats. What is a Lucky Cat? Via Wikipedia:

The maneki-neko (Japanese: 招き猫, literally "beckoning cat") is a common Japanese figurine (lucky charm, talisman) which is often believed to bring good luck to the owner. In modern times, they are usually made of ceramic or plastic. The figurine depicts a cat (traditionally a calico Japanese Bobtail) beckoning with an upright paw, and is usually displayed in—often at the entrance of—shops, restaurants, pachinko parlors, and other businesses. Some of the sculptures are electric or battery-powered and have a slow-moving paw beckoning.

Maneki-neko comes in different colors, styles and degrees of ornateness. Common colors are white, black, gold and sometimes red. In addition to ceramic figurines, maneki-neko can be found as keychains, piggy banks, air fresheners, house-plant pots, and miscellaneous ornaments, as well as large statues. It is also sometimes incorrectly called the "Chinese lucky cat" because of its popularity among Chinese merchants.

makecode_cat-small.png
Lucky Cat art, design by freepik - www.freepik.com, free to use credited to freepik

This project will replicate a waving Lucky Cat with papercraft, an Adafruit Circuit Playground Express microcontroller, and a servo motor to wave the cat's paw.

PROJECT UPDATE: An additional variation with a "Lucky Pig" for lunar New Year.

The Circuit Playground Express may be coded in Microsoft MakeCode, CircuitPython, or the Arduino IDE. This guide will show you the code for MakeCode and CircuitPython.

Parts

The project uses only a few parts and runs on standard AA batteries for extended use.

Circuit Playground Express

PRODUCT ID: 3333
Circuit Playground Express is the next step towards a perfect introduction to electronics and programming. We've taken the original Circuit Playground Classic and...
$24.95
IN STOCK

Micro servo

PRODUCT ID: 169
Tiny little servo can rotate approximately 180 degrees (90 in each direction), and works just like the standard kinds you're used to but smaller. You can use any servo code,...
$5.95
IN STOCK

3 x AA Battery Holder with On/Off Switch, JST, and Belt Clip

PRODUCT ID: 3287
This battery holder connects 3 AA batteries together in series for powering all kinds of projects. We spec'd these out because the box is compact, and 3 AA's add up to about...
$2.95
IN STOCK

Small Alligator Clip to Male Jumper Wire Bundle - 12 Pieces

PRODUCT ID: 3255
For bread-boarding with unusual non-header-friendly surfaces, these cables will be your best friends! No longer will you have long strands of alligator clips that are grabbing little...
$7.95
IN STOCK

USB cable - USB A to Micro-B

PRODUCT ID: 592
This here is your standard A to micro-B USB cable, for USB 1.1 or 2.0. Perfect for connecting a PC to your Metro, Feather, Raspberry Pi or other dev-board or...
$2.95
IN STOCK

Materials

Besides the parts above, you will want to have the following:

  • Piece of cardboard, approximately 10" x 10 " (25 cm x 25 cm)
  • Print of cat (template downloadable in this guide)
  • A half a straw, popsicle stick, or small piece of wood to brace the cat arm
  • Scissors or craft knife
  • Tape and/or glue

Alkaline AA batteries (LR6) - 3 pack

PRODUCT ID: 3521
Battery power for your portable project! These batteries are good quality at a good price, and work fantastic with any of the kits or projects in the shop that use AAs. This is a pack...
$2.25
IN STOCK

Construction

Art

Decide on what type of animal or artwork you wish to animate. Two choices are below but you are free to choose nearly anything that can be animated with waving.

Be sure that when the chosen image is printed out, it is a good size, eight to ten inches (20-25 cm) tall.

Lucky Cat Art

Click the button below to download the lucky cat art shown in the overview page. You'll need to ensure you credit the art to freepik. If you would like to draw your own image or find another picture, no problem. Do pick a cat that the arm, when cut out separately, will look natural when moving (waving / beckoning).

Lucky Pig Art

Click the button below to download the lucky pig art shown in the overview page. You'll need to sign up for free to download. If you would like to draw your own image or find another picture, no problem. Do pick a pig that the arm, when cut out separately, will look natural when moving (waving).

Build

If you need to do any image editing to your picture, do it now. For the pig I flipped it vertical so have the moving hand on the viewer's right like the cat.

 

Get a piece of cardboard at least as big as the drawing. I used a larger white Adafruit shipping box but any cardboard or similar material will do. Trace the outline of the animal and arm on the cardboard.

 

Using scissors or a craft/x-acto knife, carefully cut the cardboard outline of the animal. If the arm is not separate at this point, carefully cut to separate the arm from the rest of the body.

 

With the remaining cardboard, cut an approximately 8.5" (22 cm) by 1.25" (3 cm) strip of cardboard for a stand.

Using glue stick or a thin coat of craft/white glue, place a thin layer of glue on the cardboard pieces.

Attach the paper parts to the cardboard to make a rigid animal and arm. 

Attaching the Stand

 

Take the strip of cardboard cut earlier and tape one end to the bottom of the cat. Using the battery pack as a guide, bend the cardboard so the width of the stand touching a flat surface os the same as the battery pack width.

Bend the cardboard up, making a triangular shape towards the head. Tape the end of the stand strip to the head such that the car overall tilts slightly back but still fairly straight.

Mounting the Servo to the Arm

 

Using a straw, popsicle stick or similar, attach to the servo single arm horn (attachment) with a provided screw. Attach that to the cat awm securely via shallow screws or glue.

 

The servo should be able to move the arm so that the servo body is on the cat, the place where the horn attaches is at the joint and the servo horn arm with straw is on the arm. This makes the servo like a shoulder joint.

 

Test fit the arm with the cat body and adjust if necessary.

Attach the Servo and Larger Parts

 

Align the arm with the servo attached to the cat body such that there is about 1/8" (2 mm) gap between the arm and body such that when the arm waves, it will not rub against the body. Using glue, glue the servo to the cat body, being sure the alignment is good. Let dry.

 

 

That's it. Next we'll choose which method to program the project. You can chose the super easy to use Microsoft MakeCode or the versatile CircuitPython.

Code with MakeCode

The code for this project is shown above and may be downloaded from the link below.

If you are new to Microsoft MakeCode on the Circuit Playground Express, we have a guide on getting you familiar with this great combination of hardware and software:

What is the Code Doing?

The code loops forever, first moving the servo motor from 0 degrees to 50 degrees (with a .9 millisecond pause between angle changes). Then the code waits 150 milliseconds and reverses the angle of the servo from 50 degrees back to 0 degrees. The movement is timed to be fairly fluid without being too fast or too slow.

If you find the movement too fast or slow, adjust the times of the pause statements directly below the servo write block. A small addition or subtraction will do, you do not want the wave to be super fast or so slow.

The switch on the battery pack is used to turn the project on and off.

Code with CircuitPython

If you like, you can code this project using CircuitPython!

Getting Familiar

CircuitPython is a programming language based on Python, one of the fastest growing programming languages in the world. It is specifically designed to simplify experimenting and learning to code on low-cost microcontroller boards. Here are some guides which cover the basics:

Be sure you have the latest CircuitPython loaded onto your board per the second guide.

CircuitPython is easiest to use within the Mu Editor. If you haven't previously used Mu, this guide will get you started.

Download Library Files

Plug your Circuit Playground Express board into your computer via a USB cable. Please be sure the cable is a good power+data cable so the computer can talk to the Circuit Playground Express board.

A new disk should appear in your computer's file explorer/finder called CIRCUITPY. This is the place we'll copy the code and code library. If you can only get a drive named CPLAYBOOT, load CircuitPython per the guide above.

Create a new directory on the CIRCUITPY drive named lib.

Download the latest CircuitPython motor driver to your computer using the green button below. Match the library you get to the version of CircuitPython you are using. Save to your computer's hard drive where you can find it.

With your file explorer/finder, browse to the bundle and open it up. Copy the following folder from the library bundle to your CIRCUITPY lib directory you made earlier:

  • adafruit_motor

All of the other necessary code is baked into CircuitPython!

Download Code

Below is the code for this project. Select download code.py below and save it to your computer's hard drive where you can find it.

# Lucky Cat Maneki-neko with Circuit Playground Express
# Mike Barela for Adafruit Industries, MIT License

import time
import board
import pulseio
from adafruit_motor import servo

# create a PWMOut object on Pin A1
pwm = pulseio.PWMOut(board.A1, frequency=50)

# Create a servo object, my_servo
my_servo = servo.Servo(pwm)

while True:
    for angle in range(50):         # 0 to 49 degrees in 1 deg steps
        my_servo.angle = angle
        time.sleep(0.005)           # Tiny delay each steps
    time.sleep(0.25)                # More time at end of arm down
    for angle in range(50, 0, -1):  # 50 to 0 degrees in 1 deg steps
        my_servo.angle = angle
        time.sleep(0.005)
    time.sleep(0.25)                # More time when arm up

Load the code.py file into Mu. Double click the tab code.py (save as) and select your Circuit Playground Express CIRCUITPY flash drive. When the file copies over, it will start immediately, as you have the USB powered so be careful of a moving paw. If it did not start, check you saved code.py onto the CIRCUITPY flash drive.

Adjusting the timing of the servo

You will notice the timing of the time.sleep functions is different from the MakeCode values. MakeCode and CircuitPython code run at different speeds when converted to machine code.

You can change the values for the time.sleep but make small changes, lower = faster, higher = slower.

Final Wiring

Connections

The servo wires end in a black block with three wires. We'll use jumper wires that have a pin that goes into the jumper and has an alligator clip on the end to make the connection to the round Circuit Playground Express. Using three of these jumpers, make the following connections:

  • Sevo red to Circuit Playground Express pad Vout
  • Servo black to Circuit Playground Express pad GND
  • Servo yellow to Circuit Playground Express pad A1.
makecode_20190129_163455.jpg
Connections to the Circuit Playground Express

Coil any extra wire and use tape, a twist tie, tape, or a semi-rigid piece of wire to bundle the excess up out of the way.

Install fresh AA batteries into the battery holder. Turn the switch on the case to OFF for now. Plug the battery holder white connector into the black plastic connector on the Circuit Playground Express.

Check all connections with the diagram to be sure everything is connected. Ensure the Circuit Playground Express and Battery holder are adhered to the back of the cat via double-sided tape or similar.

Be sure you have a weighted base, either the batteries or something else with some weight. You might tilt the animal back slightly for viewing and stability. 

Turn the switch on the battery pack from OFF to ON. And enjoy your luck!

Going Further

You can use the Lucky Cat as a template for many projects. Add LED / LCD / OLED eyes, sound, whatever suits your fancy.

Check out Maneki Neko Defcon (Twitter @ManekiNekoDC)  for the design below with multi-segment eyes in the style of #BadgeLife, an A+ Lucky Cat.

makecode_ff66RinC.jpg
Photo courtesy of @ManekiNekoDC

This work is by creators Sean McCabe and Daniel Samarin. The art is by Jeff Chang. There is an article on Engadget and the project, info, and code are on GitHub.

This guide was first published on Feb 05, 2019. It was last updated on Feb 05, 2019.