Teach your Jack O'Lanterns to sing this Halloween with an Arduino, a Raspberry Pi, some servos, and some LEDs. This project is guaranteed to delight even the grumpiest of Halloween-haters, and there's plenty of room to customize the project and make it your own.
Credit is due to several other singing pumpkin projects including this one and to several Arduino sketch authors, including zparticle here.
Jack O'Lanterns
Light show
Control station
A power supply for your servos. I'm using a 5V 3A supply. The amperage will need to be high, because those servos will be pulling a lot of current. I used a wall wart I had that went to a USB hub. Ideally, this supply should be regulated, but I didn't, and I've had no issues so far. If you want to put some kind of regulator on your supply, it will have to be something beefy, like a step-down regulator, and those can be pricey. A clean, switch-mode power supply should be fine, though.
The jack o'lanterns themselves sing by opening and closing their mouths using servos. Their eyes are also animated. Lights, such as strings of mini-lights, can be made to flash to the music as well.
The lights connect to a solid state relay (SSR) control box. The control wires for the SSRs, the eyes, and the mouths all connect to an Arduino. The Arduino accepts a live serial stream that is passed out to each of the controls. That stream comes from some sort of computer. In my case, I'm using a Raspberry Pi running Falcon Pi Player (FPP) to run an animation sequence and to play the associated music. Amplified speakers must be connected to the Pi to play the music. FPP runs with a web interface, and you will control your playlists from your phone or computer wirelessly.
Finally, the animation sequence is created by specialized animation software that can export the 'fseq' files FPP expects. I'm using Vixen, but you can also use XLights. Both are free, and it's a matter of taste. The animation must be done frame by frame (though there are tools like Papagayo that can help alleviate the tedium). I made mine frame by frame, channel by channel. Be prepared to spend some time doing this.
How you do this really depends on 1) the look you want, and 2) the kind of pumpkins you got. I highly recommend buying hollow foam pumpkins. You can use the solid foam pumpkins, too, but you'll need to carve out a space for your servos and a route for your lights. You won't be able to get away with real pumpkins. They're too wet and too heavy.
This part is slightly trickier than you might think because we are powering the LEDs with the Arduino directly. Each output pin should source no more than 40 mA at 5V. For red and yellow LEDs, all you need is a simple series circuit, because their forward voltage is around 2V at 20 mA. For any other colors (e.g. the Halloween colors) you are looking at 3.4V or so. You'll need to connect the LEDs in parallel in order to power them with 5V. At 20 mA each you can still get away with powering a 2 LED parallel circuit directly from the Arduino. Note that these are typical values. Your LEDs may be different.
For my largest pumpkin, I wanted the eyes to stand out more. Single points of light work fine for the little pumpkins, but they're kind of lost on the big one. For the diffusers I used these parts:
Assembly:
You need to run 4 wires to each jack o'lantern
The LEDs can be powered directly from the Arduino.
I used old cat-3 phone lines to wire my jack o'lanterns. You will need enough wire to reach from your jack o'lantern to the control box. Keep in mind you probably want to conceal the controls for effect, and the control box will need to be in range of your wifi. Multiply this length by the number of jack o'lanterns you have.
Notes:
I built my light show using homemade solid state relays (SSR). You can of course use plain old relays, but they make a lot of noise. That's important for this project because the relay box is going to be right next to your jack o'lanterns.
I've already explained this part of the build in another one of my Instructables here.
As I said there, BE CAREFUL. This part of the project involves household mains, and it can KILL you if you are careless. Don't touch anything inside the SSR box when it's plugged in. Many triacs, including the ones I used here, have metal tabs that are live when the triac is active.
After you've built and tested your SSR, you need to build a wiring harness. A multi-conductor cord like a phone or ethernet cable works well here again. You'll need a conductor for each light you want to control separately and one for ground. This cord does NOT carry mains current. It is safe to touch assuming you've wired things correctly. I soldered single pin male headers to the far end of this harness. As with the jack o'lanterns, this harness must be long enough to reach the control box.
Finally, plug your lights into the SSR box outlets. These can be strands of Halloween lights, or lighted props. Actually, they can be anything that plugs in, so long as you don't overload the SSR box.
This Arduino sketch includes bits and pieces found around the web. Part of it comes from this other singing pumpkin Instructable, and part of it comes from zparticle's more well known sketch. And there are some of my own adjustments and modifications on top of all of those sketches.
Get the sketch from GitHub here.
I've documented the code with lots of comments, but in summary, this is what's going on:
That's it. The stream representing the animation and the audio are both handled by the Pi.
NOTE: This step is OPTIONAL. You can skip ahead to the Vixen animation section and run the entire show directly from Vixen. FPP eliminates the need for a computer, gives you controls on your phone, and does scheduling and playlists. It also makes the entire setup cheaper and smaller.
Installing Falcon Pi Player (FPP)
If you're familiar at all with the Raspberry Pi, you'll know it's a full computer. FPP is an entire linux distribution that you place on your Pi's SD card, just like you would install Raspbian OS.
Follow the installation instructions here: http://falconchristmas.com/forum/index.php?board=8...
FPP will need to connect to your home network, either by ethernet or wifi. Wifi will obviously be more portable. The instructions are at the same link.
Configuring FPP
Everything is controlled through a web interface. If everything has been installed correctly, you should be able to get to the control website running from your Pi by opening a browser on your computer or phone to http://fpp
Setting up the output for our Arduino sketch
FPP knows how to control a lot of different off the shelf light show devices. It also knows how to generate a generic serial stream right out of the box, which is perfect. That's exactly what our Arduino sketch is waiting for. We just need to configure the serial stream so that it matches what the Arduino expects.
Uploading animation and music
Setting up a playlist
Starting and stopping the show
Going Further
This doesn't even scratch the surface of what FPP is capable of. Consult the falcon website for more help, or just click the help button on the FPP control page. Everything is documented reasonably well.
I'm using Vixen 3 here, but xLights is also a viable option. I'm not giving a full tutorial on Vixen, because there are already great tutorials around the web.
If you've ever used Premiere, Final Cut Pro, iMovie, Audacity, FLStudio, or Flash, you probably already know 90% of what to do here. Vixen gives you a timeline that you must add channels to, and in that channel you define frames by assigning a value between 0-255, which will become the distance the jack o'lantern's mouth opens, or the brightness of a PWM light. Synchronize this with the audio, and you've got an animation sequence.
I'm going to warn you ahead of time: this part is tedious. There are a number of sites where people have posted their own sequences, but most of them are for driving large, multichannel light shows, and not animated servos. There is good news, though. Songs are repetitive. Cut and paste is your friend. Even parts of the songs with different words can be cut and pasted if the rhythm is the same, because we're only opening and closing a mouth. We don't have to worry about lip-syncing.
I've created a video tutorial embedded above.
Build a test proxy for your show on a breadboard
Just use an LED to represent each channel. Connect your breadboard ground to the Arduino ground, and plug the cathode of each LED into the ground rail on the breadboard. Plug the anode into a row, add a resistor across the gutter (220 or 330 ohm will work), and the connect a jumper wire from the each resistor to the channels you defined in your sketch. Set testing mode on your Arduino sketch, and you're good to go. You'll have to set up Vixen to send a serial stream to the Arduino, just like we did with FPP.
This is far easier than dealing with the actual servos.
Streaming from Vixen to the Arduino
You can stream directly from Vixen to the Arduino. You do not need the Raspberry Pi or FPP. In fact, you will need to do this for animation, unless you trust the built-in animation display in Vixen.
The central control box contains the Arduino and the power bus for your servos. It can, given room, also contain your Raspberry Pi, but keep in mind the Pi will run warm.
I used a sandwich meat container flipped upside down. The opaque top becomes a floor to attach things to, and the translucent shell becomes a domed cover that you can see test LEDs through.
If you're curious about the odd pin order, we need PWM (analog, essentially) output to control the mouths and eyes, and the Arduino has 6 PWM outputs. The light sets are digital, so they can go in any of the remaining pins.
FPP supports a lot of different options. It can control many commercial controllers. Even more useful, it supports GPIO based events. With a little creative use of FPP, you can have your jack o'lanterns react to the environment. For instance, you might have them react to a button press or a motion sensor. All it takes is some setup in the web interface and some shell scripting at worst. FPP takes care of handling the GPIO and attaching the event to a script.
Although I've shown an Arduino UNO in all my shots, in this year's version, I'm switching to an Arduino Mega 2560. This gives me a lot more I/O pins, and therefore the ability to control a lot of additional lights and motors. There are 14 PWM pins, which gives me 8 additional analog controls, one of which will control a blacklight prop I've described here. I'm also adding a hardware, real world skip button, and a button which will cause the pumpkins to stop whatever they're doing and scream. This is supported by FPP via something called "effect sequences", which are just plain sequences that are designed to play outside of the normal loop. Finally, the ultimate goal in this year's version is to have my other props broadcast via WiFi (using an ESP8266) when they are triggered, and have the pumpkins play the same scream sequence as if the prop scared them, too.
If you'd like to give a little control to your guests, you can create a hardwired remote. Or, if you prefer, you could use this schematic as a stepping stone for controlling the show with any external control. This works because FPP supports GPIO, and supports it well. Any GPIO can be connected to any "event", which is FPP parlance for running either an effect sequence or any shell script. Not only that, FPP comes with a number of scripts in a repository that you can install for your project. Many of these call the command line version of the fpp program, and they're usually just a few easily modified lines.
I created a remote with 3 buttons: Rewind, Fast-Forward, and one that is labeled "Push to see the kids jump", which makes the jack o'lanterns scream loudly.
For this remote, I used the following parts:
We're triggering low, so the 3 10k resistors are pull-up resistors. The 1k is a current limiting resistor. To build:
That's it for the physical part of the remote. Now we need to set up the software side.
#/bin/sh
SLEEP_TIME=3
###########################################################
STATUS=$(fpp -s)
if [ "x${STATUS}" != "xfalse" ]
then
# We received a response from fppd so parse it
PLAYLIST=$(fpp -s | cut -f4 -d,)
ITEM=$(fpp -s | cut -f8 -d,)
ITEM=$(($ITEM-1))
# do not get caught in a loop
if [ "x${PLAYLIST}" != "xScreams" ]
then
fpp -c stop
fpp -P Screams
sleep $SLEEP_TIME
echo "sleep $SLEEP_TIME"
if [ "x${PLAYLIST}" != "xNo playlist scheduled." ]
then
# We were playing a playlist before
fpp -P $PLAYLIST $ITEM
echo "fpp -P $PLAYLIST $ITEM"
fi
fi
fi