Maker.io main logo

Unicorn Christmas Stocking with Rainbow Lights & Sound

14

2025-12-19 | By Adafruit Industries

License: See Original Project Circuit Playground

Courtesy of ‎Adafruit

Guide by Erin St Blaine

Overview

stocking_1

Give the gift of curiosity this year with a Circuit Playground Express. The young imagineer in your home will be delighted to wake up on Christmas morning and find a brand new Christmas stocking that sings her favorite Christmas songs and lights up in her favorite colors.

This is a great project to do with kids, or to make on your own to surprise them Christmas morning. There is no sewing or soldering required, and the code is easy to create and customize using the MakeCode drag-and-drop code editor.

Add some batteries, and watch their eyes light up when they see what Santa brought.

Parts

Additional Materials Needed

  • A Christmas stocking

  • Craft Foam in white, black and sparkly

  • Ziploc sandwich bag

  • Sticky-back Velcro square

  • Scissors

  • Hot glue gun

  • Glitter glue, ribbons, jewels, and embellishments

Program with MakeCode

The Circuit Playground Express can be programmed a number of ways: it will run Arduino code, CircuitPython, or you can program it with MakeCode.

Microsoft MakeCode for Adafruit is a web-based code editor for physical computing. It provides a block editor, similar to Scratch or Code.org, and also a JavaScript editor for more advanced users.

This means you can drag and drop light animations and functionality using the Circuit Playground Express' onboard sensors without ever writing a single line of code. Just snap the blocks together and watch your lights dance.

Check out out MakeCode intro guide here.

For this project, I used the Circuit Playground's onboard lights to run a pretty rainbow color animation and the onboard speaker to play Jingle Bells every time a button is pressed. The colors and sounds are easy to customize to play your favorite Holiday song.

Go to https://makecode.adafruit.com/ and select "New Project".

Give it a name. I called mine "Unicorn Stocking".

First, we'll add the light animation. Click the LIGHT tab and drag an instance of show animation for 500 ms into your workspace and drop it inside the forever loop that's already on the desktop. (If it's not there, you can find it under the LOOPS tab.)

Anything placed inside this block will run over and over, forever.

makecode_2

Check out the simulator on the left side of the screen. Are the lights animating rainbow? That means you've done it right. This is easy.

Now we'll add music that plays when the button on the face of the Circuit Playground is pressed. The buttons or sensors are accessed under the INPUT tab.

Drag an instance of on button A click from the INPUT tab into the workspace. Anything inside this block will run whenever the A button (or whatever input you choose) is clicked.

While you're here, take a look under the dropdowns to see all the different input options you've got. I kept it simple using button A, but you can trigger your code with any of these inputs just by selecting them.

makecode_3

Choose the MUSIC tab and drag an instance of play melody at tempo into your on-button A loop.

makecode_4

Click the music note and the editor window will appear. Choose your first melody note from the first column, the second from the second column, etc. For a rest note, leave the column blank.

Jingle Bells starts on the third of its key, so it will work out best if you voice it as shown. Each play melody block will play up to 8 notes, but you can copy and paste the block inside the on-button A loop until you have as many lines as you'd like.

makecode_5

makecode_6

makecode_7

Click the A button in the simulator to hear your melody played back. I found 120 bpm to be a bit slow and dirge-like, so I sped up my tempo to 200 bpm, which is a bit more cheerful.

There are more tools available under the MUSIC tab that will allow you more control -- play around with them until you're happy with your composition.

Download the Code

  1. Plug your Circuit Playground Express into your computer with a USB cable.

  2. Click the reset button.

  3. Green lights will appear on the Circuit Playground's face, and it will appear in your list of devices, called CPLAYBOOT.

If you don't see this or get a drive called CIRCUITPY, try double-clicking the reset button instead of single-clicking to get to a drive named CPLAYBOOT. Putting code on a CIRCUITPY drive will not program it.

Click the pink Download button on your MakeCode screen and the code you just made will download to your computer. Drag it onto the CPLAYBOOT device.

If all goes well, you will see a pretty rainbow animation. Click the A button and the Circuit Playground's tiny onboard speaker will play Jingle Bells. Hooray!

Here's the completed project that you can play with directly.

makecode_8

Microsoft MakeCode | Terms of Use | Privacy | Download

Make the Unicorn

Stick the Circuit Playground to the front of the battery case (the side with the on/off switch) using sticky back Velcro. This way it's easy to remove and use again later on in a different project.

stick_9

We'll use a Ziploc bag to make a clear pocket for the Circuit Playground and battery case. I didn't have one of the right sizes, so I cut one down and glued the left side closed with hot glue. Leave the top open. You want it to fit fairly snugly so it doesn't wiggle around too much.

bag_10

Use a couple safety pins to pin your Ziploc pocket to the front of the stocking. Make sure not to pin all the way through both sides of the stocking or you won't be able to fit the presents inside.

pins_11

Layout

I want the Circuit Playground Express to land right behind the unicorn's eye. It's a good idea to cut your shapes out of paper first to make sure you've got your sizes right and that you're happy with placement. Here is the basic shape of the unicorn's head, with a large eye centered right on the middle of the stocking.

head_12

Cut the head shape from white craft foam and the horn shape from sparkly craft foam in the color of your choice. Cut a small pupil and some fluttery eyelashes from black craft foam.

Feel free to download and trace my head shape -- the grid in the photo is 1" squares, for size reference. Or draw your own unicorn shape! Your inner unicorn is beautiful and perfect.

It may also be fun to use your child's drawing as a template - she'll be delighted to see her very own imaginary unicorn come to life.

shape_13

shape_14

shape_15

Use low temperature hot glue to glue the head shape to the Ziploc bag pocket, lining up the lights right where you want the eye to be. Glue the horn and eye pieces on in the same manner. I also glued the tip of the horn down to the stocking itself.

glue_16

glue_17

For the mane, I am using tubular crin ribbon since it's just so very very sparkly. You can find this at most craft stores. Yarn or ribbons or doll hair would work well here too. I added a zip tie around the strands and looped that over the unicorn's ear, adding judicious dabs of hot glue to hold it in place. If the mane is getting in the unicorn's eyes, you can braid in some ribbons to keep it managed.

mane_18

mane_19

unicorn_20

Decorate

Add jewels, glitter glue, or other embellishments to make your unicorn unique and special. Draw on a smile, hang your stocking by the fireplace and fill to overflowing with fun gifts for your young maker.

Mfr Part # 3333
CIRCUIT PLAYGROUND EXPRESS
Adafruit Industries LLC
250,77 kr
View More Details
Mfr Part # 727
BATTERY HOLDER AAA 3 CELL LEADS
Adafruit Industries LLC
19,60 kr
View More Details
Mfr Part # EN92
BATTERY ALKALINE 1.5V AAA
Energizer Battery Company
5,78 kr
View More Details
Mfr Part # 4111
CABLE A PLUG TO MCR B PLUG 3.28'
Adafruit Industries LLC
39,70 kr
View More Details
Add all DigiKey Parts to Cart
Have questions or comments? Continue the conversation on TechForum, DigiKey's online community and technical resource.