Shopping Cart

PiperCode Project: Christmas Tree Ornament ☃!

Posted by on


Want to decorate your house for the coming Christmas? Learn how to make light-shows? In this tutorial we show you how to make a Christmas tree with a light show!

Making a Xmas Tree with lights

All you need is your

1) Piper

2) Scissors

3) Glue stick

4) Card board 

5) Prints of the pre-filled template or the empty template if you want your own design. Whichever you choose, make sure you make two single-sided copies.


Step 1) Print the templates 

First we need to print off the templates that we will used to build our Christmas tree. If you want to design your own tree you can use the empty template. If not, you can use our pre-filled design. Make sure you print one-sided and make two copies as the tree is going to have four sides! You can also print these ornaments to decorate your tree!  

Step 2) Glue the template

Use the glue-stick to glue the tree design to the cardboard. Make sure you get glue all over the paper so that the edges don't come off.

Step 3) Cut around the design

Using your scissors, cut around the dashed lines so that you are left only with the tree.

Step 4) Prepare the rear side

Cut around the dashed lines on the rear side until you have the tree design cut out . Use the glue stick to glue the cut-out to the backside of the cardboard you that just cut out. 


Step 5) Repeat Step (3) and (4) for the other side

Our tree has four sides so we need to repeat Step (3) and (4) for other side that goes across the previous side. Once that's done, you will have the two following parts.


Step 6) Connect the two parts to make the tree

Push the left tree down through the gap on the right tree to connect the two sides.

Good Job! You've now made your tree ☺

Step 7) Place the LEDs

Now that you have the tree, we want to decorate it with the LEDs for the light-show. Place the LEDs on the tree by poking the cardboard with the leads and then pushing through.

Step 8) Attach the breadboard to the tree

To make the connections from the LEDs to the raspberry pi we use a breadboard. Peel the yellow cover from the bottom of breadboard to expose the sticky tape. 


Then place the breadboard on the tree so that it stays firmly in place. It's best to place it behind the LEDs to both hides the jumper wires and also reduce distance to the LEDs leads.

Step 9) Connect jumper wires to LED positive leads

LEDs are single directional components. In other words, they only work when you connect them to the power source in one direction. If you reverse the polarity, it will not let the electrical current through and will not light up. So, connect the jumper wire that matches the LED color to the longer lead side. This is the positive side of the LED. 

Step 10) Connect LED ground wires

You can now connect the ground jumper wire to the negative side of the LED, which has the shorter lead. It's best to use black jumper wires for this. 

Step 11) Tape the LED leads to the tree

Bend the LEDs to hide them behind and use tape to secure them to the tree. 

Step 12) Wire up the circuit

Follow the diagram below to connect the wires to the raspberry pi. The female side of the jumper wires go into the raspberry pi and LED leads and the male sides go into the breadboard. 


The PiperCode pin number mapping for the raspberry pi is given below.

PiperCode Pin Map

Step 13) Start up your piper

Connect the raspberry pi to the battery and start up your piper.

Step 14) Launch PiperCode

If you don't have PiperCode already, follow the steps here to update your Piper. Then launch PiperCode from the game menu and build the following program. The program below turns pins 22,24 and 26 (yellow, blue, red) on, waits for 1 second, then turns them off and turns on pins 29 and 31 (white and green). It then keeps repeating this process to create the light-show effect. You can experiment with the code by changing what combination of pins to turn on and off. 

Step 15) Show off your tree and SHARE!!

Run the code and enjoy your Christmas light-show!


Great Job!! Send us your creation and we will feature it on our website!! You can do this by tagging us on Facebook or Twitter ☺


Extra Activity: Add a switch to change the lighting mode!

Step 16) Add a switch to the circuit

Using the following diagram, add a switch to the circuit. 

Step 17) Design the second lighting mode

Design the second lighting mode in PiperCode.


Step 18) Add function blocks

Create two functions and name them mode1 and mode2. 

Step 19) Program the switch

In a forever loop put in an if-do-else block. When the switch (Pin 37) is closed, run the mode1 function and when open run mode2. 


Step 20) Place the modes in function blocks

Place the two modes you've designed in the the mode1 and mode2 function blocks. Then run your program and the mode should switch when you flip the switch!

Congratulations and well done for making your Christmas tree decoration!! ☺

Send us your creation and we will feature it on our website!! You can do this by tagging us on Facebook or Twitter ☺ 

Older Post Newer Post


Leave a comment