Introduction: Halloween + Micro:bit
Add some life to your Halloween decorations! Using micro:bit + LEDs, and some spooky music! I did something similar last year using Arduino, but because of the limitations of some of the libraries, I needed to use two separate boards to combine the LEDs and music. Using Micro:bit allowed me to combine them all into one.
Watch video for more details:
What you need:
- Micro:bit - https://amzn.to/2CHCzXl
- Addressable LED Strip - https://amzn.to/2CIBkXF
- Power supply - https://amzn.to/2SmLUt8 (you can use the battery case that comes with micro:bit and some AAAs, but I usually power through the usb connection using a cell phone power bank)
- Speaker - https://amzn.to/2D5Ciyh -can use pretty much any speaker with two terminals or with a standard headphone jack.
- Alligator wires https://amzn.to/2SlR5td
- Led Connectors: https://amzn.to/2CKcN4u
- Wax paper
- Paper clips
- Soldering Iron - Many of the connections in this guide can be made stronger by soldering for those who are interested in that approach.
Disclaimer: All items linked above are through affiliate links.
Step 1: Carve a Pumpkin!!!
Carve a spooky face for the pumpkin! Make sure to leave openings for eyes, and for light from the candle to be visible. You can carve some scars and other openings to let a bit more light leak out.
Step 2: Candle + Eyes (code)
I used Microsoft's Makecode to develop the code for this project, which can be found here: Micro:bit blocks + code
We are going to create a single LED strip to use for both the eyes and the candle. So we initiate it with the blocks, and then split it into two smaller LED strips.
For the candle, it picks a random amount of LEDs to light up (between 2 and 4 LEDS), and a random color (yellow orange or red orange), then turns them on for a short random duration. After the pause, it repeats the process again, simulating the look of a flickering candle.
For the eyes, there is an array that contains a list of colors, and the function cycles through the array, one color at a time. For each color, it gradually fades in and then back out before changing to the next color.
Step 3: Candle + Eyes (wiring - Part 1)
Cut 3 pieces off the LED strip. The one for the candle is four LEDs long, and the each of the eyes has a strip two LEDs long. Connect them together using the LED connectors, or solder if you prefer. Put the four for the candle first, then each of the eyes. The arrows on the LEDs should all point in the same direction.
Make sure there is enough wire between the two sets of LEDs for the eyes so that they can stretch between the eyes carved into the pumpkin, and make sure you have given enough space between the LED for the candle and the first eye, so that it can reach to the floor of the pumpkin.
Add a connector on the side of the candle that will connect to the microbit. Cut off the end, and strip the three wires.
Step 4: Candle + Eyes (wiring - Part 2)
- Connect the + pin from the LED strip to the 3.3v pin on the micro:bit
- Connect the - pin from the LED strip to the gnd pin on the micro:bit
- Connect the middle pin from the LED strip to pin 1 on the micro:bit
Step 5: Song (Code)
The code for the song takes an array, and cycles through it one item at a time, playing the current note for a short period of time, then switching to the next. When the song is over, it repeats again from the beginning.
Step 6: Speaker (Wiring)
Connect one end of the speaker to the gnd pin, and the other end to pin 0. Since there is already a wire connected to the ground pin, you can connect this end of the speaker to either end of the wire that was connected there first. I used a little tiny buzzer, but this can be done with any speaker. The buzzer gets pretty muffled inside the pumpkin. To improve the volume, the speaker could be placed outside the pumpkin, or the micro:bit could be connected to a speaker with its own built in amplifier.
Step 7: Diffusing LEDs
The LEDs produce bright light that is not diffused, making it easy to see individual pixels. To make the LEDs blend together a bit, and so that they glow a bit, I used wax paper to diffuse them. Cut with a width slightly longer than the length of the LED segments, and then wrap with the wax paper, using some tape to hold it in place.
Step 8: Adding Everything to the Pumpkin
To hold the eyes in place, unfold a paper clip and then push it into the walls of the pumpkin where the individual LEDs for the eyes are. The rest just drops into the middle, and you can place it in a plastic bag if you do not want to get pumpkin gunk on it.
If something doesn't work as suspected, try adjusting/changing connections, and make sure the correct pins are hooked up.
Step 9: All Done!
Place it in a good spot, and be careful not to be to startled by the horrifyingly spooky creation sitting in front of your house. The cell phone powerbanks last a long time at such a low current draw, so you can leave it plugged in for a while without the battery dying.
Thank you for reading. If you are interested in seeing future projects, please subscribe to my Youtube channel: More Than The Sum
Participated in the
Halloween Contest 2018