Overview

Time to build a holiday diorama! This isn't any old stagnant diorama. This one moves. That's right Rudolf and his crew hop up and down through the night sky thanks to our friend CRICKIT! Along with CRICKIT and a Circuit Playground Express, we'll use some cardboard, leds, pipe cleaners and a DC motor to bring this festive diorama to life.

makecode_diorama.jpg
Diorama. Image: https://pixabay.com/en/diorama-model-train-model-railway-2840721/

Prerequisite Guides

Reading or at least skimming through these guides before beginning will save you a lot of headache in the future. You can always refer back to them if you need help!

Adafruit Parts

1 x Circuit Playground Express
Circuit Playground Express is a great introduction to electronics and programming
1 x Adafruit CRICKIT for Circuit Playground Express
Crickit: Creative Robotics and Interactive Construction Kit is an add-on to Circuit Playground Express
1 x TT Motor DC Gearbox
200 RPM 3 to 6VDC
1 x USB cable
USB A to Micro-B
1 x Small Alligator Clip Test Lead (set of 12)
For powering LEDs and capacitive touch moon
1 x Snap-on Hub for TT Motor
For attaching turning mechanism to motor
2 x M3 Screws - 25mm long
For mounting the motor to the box
2 x M3 Hex Nuts
For mounting motor to box
1 x Silicone Cover Stranded-Core Ribbon Cable
For wiring red LED nose discretely
1 x Diffused Red 3mm LED
For Rudolph's nose!

Tools and Materials

  • Medium to large width corrugated cardboard - need at least 1 sheet sized 10 cm X 24 cm with the same thickness
  • Adafruit shipping box
  • Scrap pieces of cardboard (to make character cutouts and various smaller parts)
  • Pencil
  • Ruler
  • Hobby knife
  • Scissors
  • Hot glue gun + 2-3 sticks of glue
  • Aluminum foil
  • Assorted colored construction paper
  • Glue stick
  • Mini bamboo skewers
  • Fake spider web (for Adabot's hat and beard)
  • White paint
  • String or twine
  • Black pipe cleaners

Optional but recommended: 

  • Cutting mat (for cutting cardboard)
  • Wire cutter (for cutting pipe cleaners)
  • Black plastic straws (instead of pipe cleaners for holding up characters)

Wiring Electronics

Attach the Circuit Playground Express to the Crickit following this guide.

Wiring up the main electronic components

  • Plug in the DC motor to motor input 1 on CRICKIT with the red 5V lead going in the outer input of the motor terminal block. Use a small screwdriver to screw in the leads into the terminal blocks.
  • Attach an alligator clip to a 3.3V output from the CPX to one leg of the 470 ohm resistor. Then attach the other leg of the resistor to a new alligator clip. Connect the new alligator clip to the positive (the longer) lead of the white LED. Lastly attach one more alligator clip from the negative lead of the LED to GND on the CPX.*
  • Attach an alligator clip to capacitive touch input A3 on the CPX (Circuit Playground Express). Attach the other end to some tin foil.
  • For power use a 5V 2A (2000mA) switching power supply plugged into the 5V DC jack.

*To learn more about why we'd need a resistor and LEDs in general check out the guide, All About LEDs.

This is the main circuit we will be using. We'll add the rest of the LEDs later.

Programming with MakeCode

What is MakeCode?

MakeCode is a web-based code editor for physical computing made by Microsoft.

What does that mean for you? It means you can program your Circuit Playground Express to do almost anything you can dream up right from a website! You can code with blocks similar to the language Scratch, or you can do more advanced coding with Javascript. We'll be sticking to the block-based programming for this project.

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 button below to access the code for this project.

What's going on the code above?

  • In a forever loop, we call play the "Jingle Bells" tune by calling the jingle functions. As it's a forever loop, this code block loops forever regardless of other events that happen in the code!
  • When capacitive touch input A3 on the CPX is touched, we want to move the DC motor at 25% speed for 5 seconds, then stop.
  • The "Jingle Bells" tune can be separated into 3 parts. The song starts with part 1, then goes to part 2, then back to part 1 then ends with part 3 before repeating again. 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!

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.

  • Choose a name at the bottom of the page.
  • Then click the pink Download button.

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 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.

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!

  • When the board is powered up, the LED should turn and and "Jingle Bells" should start playing.
  • When the tin foil is touched, the DC motor should move for five seconds.

If you are having issues getting things to work check out this extended guide here.

Build the Rotation Rig

First we'll build the structure for for the rotating wheels which will push Adabot and the reindeer up and down.

  • On both sides of the box, use a pencil and a ruler to mark a point 4.3 cm from the back of the box and 3.3 cm from the bottom of the box.
     
  • Use a hobby knife to poke holes at the points.

  • Take a skewer and push through holes.

Making the Wheels

  • Tie some twine around a push pin. Then tie the other side of the twine around a pencil tip with the length between the twine and the pencil tip being 3 cm. 
     
  • Stick the push pin into thick width cardboard.*
     
  • Use the pin and twine to guide the pencil around a circle.
     
  • Repeat 3 more times.
     
  • Make sure circles are close to 3 cm.
     
  • Cut out circles with hobby knife.
     

*You may need to add a layer of cardboard underneath for the push pin to be stable.

Prepping the box to mount the motor

  • Take out the skewer and use a hobby knife to enlarge the hole on the left side of the box until the motor extension fits inside.*
     
  • Holding the motor parallel to the bottom of the box, use a pencil to trace the outside of the motor.
     
  • Repeat on the outside of the box.
     
  • Unfold the left side of the box pulling out the middle piece of cardboard.
     
  • Cut out the motor tracing from the inner and outer walls of the box.
     
  • Fold the middle piece back in place.
     

*Orient the motor such that the black and red (GND and 5V) wires are coming out away from the box wall. Also the zip tie holding the wires has a piece that may be sticking up so make sure that is not touching the wall.

Mounting the motor

  • Place the motor inside it's mounting spot and firmly press onto wall to create an imprint with the small circular plastic piece.
     
  • Create a hole with a hobby knife where the imprint is. (This is to make the motor mounted more parallel and sturdy)
     
  • Put the motor in place and screw in an M3 screw until the screw end comes out the other side of the box.
     
  • Twist on a M3 nut.
     
  • Repeat with the other screw and nut.

Placing the circles and skewer

  • Draw a point in between the center and the edge of each cardboard circle.
     
  • Poke a skewer through all the drawn points.
     
  • Stick skewer through the pre-made hole on the right side of the box. Once the skewer is through the right side hole, place the circles onto the skewer.
     
  • Attach the TT-motor hub to the motor.
     
  • Drop some hot glue inside of the motor hub and stick skewer end inside holding until dry.
     
  • Orient each circle to be 90 degrees of rotation from each other. One way to do this: starting with the right most circle, orient such that the skewer is going through at 12 o'clock. Then the next one over at 3 o'clock etc.
     
  • Make sure each circle has an equidistant space from the next and hot glue circles in place.
     
  • Cut the excess skewer on the right side of the box if desired.

Making Attachments

Next we'll add some pipe cleaners which will be moved up and down by the circles on the skewer as the motor turns. In order for the reindeer and Adabot to stay upright and facing forward, they need some guides which we'll make next.

The pipe cleaner guide

  • With some thick width cardboard, cut out rectangle that is 4cm by 24cm.
     
  • Draw a line through the center at 2 cm.
     
  • Place the cardboard over the wheels and mark an x directly above each circle. 
     
  • Use a hobby knife to poke holes where each x is.
     
  • Cut (4) 14 cm long black pipe cleaners. *
     
  • Make sure holes in cardboard are large enough for pipe cleaners to fit easily through.
     

*If you have clear or black straws feel free to use those instead of the pipe cleaners. They have less friction and move through the cardboard easier.

Creating the wheel guiders

  • Measure (4) 3cm x 5cm rectangles. Draw lines inside the rectangles on the heights and widths at 0.5cm from the outside.
     
  • Cut out the 3 cm x 5 cm rectangles.
     
  • Score the inside lines and cut out the corner boxes.
     
  • Fold the sides in.
     
  • Draw a point in the center of each guider.
     
  • Poke a small hole through each point.
  • Stick a pipe cleaner through a guider with roughly 2cm coming out. Bend the end in.
     
  • Glue the top of the pipe cleaner onto the guider and hold the pipe cleaner perpendicular to the guider as it dries.
     
  • Cut off the excess pipe cleaner on the bottom of the guider.
     
  • Repeat with other 3 pipe cleaners and guiders.
     
  • To reduce the amount of friction from the pipe cleaners moving through the cardboard, add some hot glue to the inside of the hole made in the long rectangular cardboard piece.
     
  • Reduce the friction even more by shaving away the pipe cleaner hair on the bottom with scissors or a wire cutter.
     
  • Place the pipe cleaners through the long rectangular cardboard piece. Rest each guider over it's corresponding wheel. 
     
  • Push the long rectangular piece towards the back of the back of the box such that the pipe cleaners slightly lean back. (This will help Adabot and the reindeer stay facing forward later).
     
  • Glue the long rectangular piece in place.

Adabot and the Reindeer

Making the reindeer!

  • Take a piece of brown construction paper and fold it in half.
     
  • Draw the 3 reindeer bodies and heads. Each body should be about 3 cm long.
     
  • Cut out the bodies and heads.
     
  • Glue the heads onto the bodies.
     
  • Cut (3) 5 cm long black or brown pieces of pipe cleaner.
     
  • Bend the ends of the pipe cleaners to form antlers.
     
  • Glue onto heads.

Making Adabot and his sleigh!

  • On some red and blue (or whatever colors you want!) construction paper, draw the sleigh top, the sleigh bottom, Adabot and his hat.
     
  • Cut out the pieces and glue them onto each other accordingly.
     
  • With some fake spider web or cotton balls, roll a small piece into a ball for the hat. Take another piece and form into a beard shape. Glue pieces onto Adabot.
     
  • Cut a small piece of skewer and glue to back of Adabot's arm for stability. (Those reindeer can really pull!)

Attaching to pipe cleaners

  • Cut the top folded section of the box off.
     
  • Glue on reindeer and Adabot to the pipe cleaners so they have enough room between each other. It helps to glue the reindeer on their front legs to counterbalance the weight of their antlers.
     
  • Cut a piece of twine that is roughly 20 cm long.
     
  • Glue to Adabot's hand and reindeer.

Adding LEDs

To create the LED stars and Rudolph's nose, we will use copper tape and make a parallel circuit. A parallel circuit allows all leds to have the same voltage applied across but current will be different. A series circuit would work too, but a parallel circuit works better for the layout of the LEDs and the copper tape.

If you're curious about the science behind circuits and want to explore further, check out the guide: Circuits from Scratch.

Mapping out the circuit and adding copper tape

  • Cut out a 17 cm x 24 cm sized piece of black construction paper.
     
  • Glue it to front of diorama.
     
  • Draw with pencil where stars and moon should be placed.
     
  • Make the marks in the same locations on the back of the diorama. (I glued a piece of white paper to the back to make it easier to see the circuit).
     
  • Draw a line for POWER (3.3V) from the bottom right to the top left. Mark space for the resistor shortly after line begins.
     
  • Draw a line for GND from the bottom right to under the bottom side of the LED marks.
     
  • With copper tape, place down along lines leaving space for the resistor. The less you cut the tape, the more conductive it will be. When reaching a corner, instead of cutting then starting the tape again, try folding.
     
  • Cut out the moon.

Add the LEDs!

  • Stick the white LEDs through the holes from the front of the diorama.
     
  • Orient the LEDs such that the longer leg (the positive lead) is facing up.
     
  • Use more copper tape to tape down the LEDs with legs that reach the tape.
     
  • Bend the legs of the LEDs that are sticking over the tape such that they align with the tape. Tape LEDs down.
     
  • For the legs that don't reach tape, add some tape to an existing line of tape, tape down the LEDs.
     
  • Tape down the resistor.

*The LED legs need to be sandwiched in between copper tape in order to access power from the CPX.

Rudolph's red nose

  • Poke a hole for Rudolph's nose.
     
  • Stick a red LED through hole.
     
  • Add copper tape to back of the front leg and the upper back.
     
  • Bend LED legs so the longer (positive lead) is aligned with upper back tape and negative lead aligned with front leg tape.
     
  • Using two black jumper wires or black ribbon cables, tape down one end of one wire to each LED leg.
     
  • Pull the other ends of the cables through the moon hole and tape the positive lead to positive line of tape and negative to negative line.

Adding power and ground

  • With black and red alligator clips, attach to GND and 3.3v on CPX then tape down the other ends to back of diorama in designated areas.
     
  • Plug in power to CRICKIT and, hopefully, watch the lights turn on!

Troubleshooting the LEDs

If some lights are on and others are not:

  • Double check the orientation of the LED legs. The longer legs should be connected to power.

If the white LEDs turn on but the red one doesn't (or vice versa):

  • Try removing the resistor and putting copper tape down in its place. Not all LEDs may be getting enough current.

If all else fails, the more copper tape you add to meager looking areas, the more conductivity you will have.

Capacitive touch moon

  • Take some aluminum foil and the moon we cut out earlier.
     
  • Wrap the moon in the foil.
     
  • Glue the moon in place with the extra foil coming out of the back.
     
  • Attach an alligator clip to the foil and the other end to A3 on the CPX.
     
  • Screw in the DC motor to the CPX.
  • Glue a skewer to the back to hold the diorama upright.

Power up CRICKIT, touch the moon, and watch them ride!

Crafting the Scene

The houses

  • Fold a piece of black construction paper so it fits in the front of an Adafruit (or other) box.
     
  • Mark where the box ends.
     
  • Cut out the folds and trim the top.
     
  • Draw and cut out snowy hills with white paper.
     
  • Draw and cut out houses with two different colored construction paper. Glue pieces together with glue stick.
     
  • Add some cotton ball or fake spider web to chimneys.

Finish up the decorations and let it snow!

  • Glue snowy hill and houses in place.
     
  • Use a skewer and white pain to dot some snow on both backgrounds.
     
  • Glue front drop in place.

Happy Holidays!

This guide was first published on Dec 03, 2018. It was last updated on 2018-12-03 19:34:27 -0500.