Software apps and online services
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:
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.
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.
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 micro:bit. Cut off the end, and strip the three wires.
- 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
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.
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.
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.
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.
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