How about getting into the holiday season creating a snowman that dances to holiday music? This snowman does not require any snow and will dance with just the touch of his magic hat. You will also need some parts, Microsoft MakeCode, and instructions from our friends at Adafruit.
Courtesy of Adafruit
Guide by Isaac Wellish
We don't need any snow to build this awesome snowman.
To make this snowman dance, just touch the top of his hat! This triggers a servo in his belly that moves his body around.
This guide will show how to program this groovy guy using Microsoft MakeCode, an easy to use block-based programming system.
Reading or at least skimming through these guides before beginning will help you understand this build. You can always refer back to them if you need help.
Optional but recommended:
Tools and Materials
Attach the CPX (Circuit Playground Express) to the Crickit following this guide.
Programming with MakeCode
What is MakeCode?
MakeCode is a web-based code editor for physical computing made by Microsoft.
More on MakeCode for Adafruit boards here.
Install the MakeCode CRICKIT Extension
Before we start programming, let's make sure you have the CRICKIT extension installed in MakeCode.
Detailed instructions on how to do that can be found in this guide.
Create a New Project with MakeCode
Head over to https://makecode.adafruit.com/ and create a new project.
Click the link below to access the code for this project.
What's going on the code above?
In a forever loop, we set volume level to 140 then play "Deck the Halls" by calling the deckthehalls functions. The "forever" loop means this code block loops forever regardless of other events that happen in the code!
"Deck the Halls" can be separated into 3 parts. The song starts with part 1, then repeats, then goes to parts 2 and 3. Creating functions for these song parts then "calling" the functions later allows us to have much cleaner looking and more organized code. It also allows us to reduce the amount of code needed for the project making the program more efficient!
When capacitive touch input A3 on the CPX is touched, we want to move the servo motor from 0 to 120 degrees, and back, 10 times fast to shake the snowman. Adding the 100ms of pause in between allows the servo to have enough time to move to each position.
Uploading the Code
Now that we have the code for the project, we need to upload it to the CPX.
Let's name our file and download it.
Note MakeCode adds a UF2 extension to the filename.
Follow the directions and connect your CPX to your computer via the USB cable. Click the CPX Reset button once to go into programming mode (all NeoPixels will turn green).
In some cases, you may need to press the reset button twice to get into programming mode.
Next, look for the UF2 file in your downloads folder and drag it onto your CPLAYBOOT drive that should have showed up in your file manager/finder when you plugged in your board and entered programming mode.
You should now see the CPLAYBOOT drive disappear, this means the code is running.
Power up CRICKIT
Connect CRICKIT to power with the 5V DC power cable and be sure the tiny on/off switch next to the black power input jack is on.
The code should now be running so try it out!
If you are having issues getting things to work check out this extended guide here.
Build the Snowman
Carving the foam body:
Cut off about 5 mm from the bottom of the largest ball to give the ball a flat surface to sit up on.
Next cut the medium sized ball in half.
Then carve out the middle of each side of the medium sized ball.
Creating the servo pushing wire mechanism:
Cut about 36 cm of stiff wire with wire cutters.
Push bottom and top of medium sized ball through wire so they lie close to the middle.
Take off the top of the middle ball.
Place servo next to wire such that one of the arms is right up against the wire. Push the servo firmly into the foam to create an imprint.
Remove wire and glue servo in place.
Push wire back in place then use wire cutters or pliers to bend the wire around the servo arm.
Once the wire is shaped accordingly and there are equal parts wire above and below the servo (slightly more above is better), glue wire in place next to the servo.
Stick top of ball onto wire. Make sure servo cables are hanging out before glueing top down.
Forming the wire:
Bend one end of the wire at the top/bottom of the ball at a 90 degree angle towards the servo cables.
Bend the same wire back the other way 90 degrees after about 1-2 cm.
Repeat on other side.
Stick on top and bottom balls. When putting on the large ball, make sure to orient such that the flat part we cut earlier is directly opposite to where the wire is inserted into.
Cut a roughly 18 x 18 cm square of cardboard and white paper.
Glue paper to cardboard.
Glue bottom of snowman in center of base.
Testing out the Snowman so far
Plug the servo into CRICKIT, and power up the board. Test out the snowman by touching A3 on the CPX. Quite a dance! I call it the Snowing Man :)
If you aren't getting much movement out of the snowman when A3 is touched:
If the snowman parts are moving around too much or spinning around:
Bring Him to Life!
Create the top hat parts:
To create the hat top, on a sheet of black foam, draw two perpendicular lines 3 cm long going through the center of each other.
Draw a circle around the plus sign.
Next, to create the brim, draw a line 5 cm long. On this line, mark points at 0, 1, 2.5, 4, and 5 cm.
Create an identical line perpendicular to this one and running through its center.
Draw a circle around the 0 and 5 cm points and 1 and 4 cm points.
To create the hat's base we must know the circumference of the hat top. Circumference = 2πr = 2 * (3.14) * 3 cm = 9.42 cm.
Draw a rectangle 9.4 cm long and 4 cm high.
Cut out all components.
*Hat created based off a 5cm diameter head. May need to modify measurements if head larger or smaller in size.
Assemble the hat:
Bend the base into a cylinder and glue ends together slightly overlapping.
Glue the brim to the base.
Glue on the top.
Cut off excess wire from top of snowman so hat fits just over the wire. The wire should be reaching just barely under the hat top.
Adding the snowman body and facial features:
Mold the model magic into a carrot shape and glue onto snowman.
Place 2 larger rhinestones onto snowman to make eyes.
Place 5 smaller rhinestones onto snowman to make mouth.
Glue 4 buttons onto snowman's chest and torso.
Stick twigs into sides.
Cut about 20 cm of ribbon for scarf and tie around neck.
Capacitive touch cap:
Cut 36 cm of copper tape.
Turn snowman around. Slowly peel off backing and stick onto snowman starting on the top of the hat, creasing down hat's base and brim and ending at the bottom of the snowman.
One a piece of aluminum foil, draw a circle with a 3 cm diameter.
Cut out circle.
Glue on hat top.
Add a shorter piece of copper tape on top of foil down onto the previous piece of copper tape along just the hat's length.
Use two pieces of copper tape to tape one end of the alligator clip to the bottom of the snowman. Be sure to tape the alligator clip on top of the first piece of tape.
Attach other end of alligator clip to A3 on CPX.
Plug servo into CRICKIT.
Power up CRICKIT, touch the top of his hat and watch him groooooooove!