Introduction: Hacking Skelito, a Talking Skeleton
Halloween is often called the 'Maker's Holiday'. It provides a great opportunity to unleash your creativity building props, making costumes, making delicious treats, or decorating your house, and you'll find no shortage of fun Halloween projects here on Instructables. Ever since I started playing with electronics I've done a little Halloween project every year, all involving skulls with scary eyes: one had flashy LED eyes, the next year a weird thing I built with a servo and ping pong balls made it look like the skull was suspiciously scanning back and forth, and the following year I used LED matrices inside a cheap skull for a cool retro-tech effect.
Because you can never start on your Halloween projects too early, the day after Halloween I picked up a prop of a skeleton holding a pumpkin who said hokey things when you reached for some of his candy. It was the day after Halloween, so suddenly he was half price. He sat in a closet until September, and then I went to work hacking him. I saw a couple possible improvements:
- Change it so he would say whatever I wanted him to say, but would still move his mouth in sync(ish) with what was being said.
- Replace the 'singing greeting card' speaker that makes all these props sound pretty rinky-dink with a proper speaker fitting my (pitch shifted down) deep voice.
- Use capacitive touch instead of the IR sensor he came with.
- Give him a name (Skelito).
Step 1: Materials
To build one of these, or something similar, you will need:
- A talking prop from a Halloween Store or even just a drug store
- An Arduino (UNO or other model that works with shields)
- A 'Wave Shield' from Adafruit (there are various shields and ways of adding sound to projects, but I've gotten a lot of mileage out of these shields)
- An SD Card to store your sounds on
- Aluminum foil
- Alligator Clips
- A Bluetooth Speaker or other Speaker that can appropriately deliver a 'Voice of Doom' - wire it up to a powerful amp if you're especially diabolical
- Lots of Wire
- A breadboard
- Wire cutters
- A set of screwdrivers
- Wire strippers
- A laptop
- A multimeter
- Dremel or other tool to cut open the prop
- 3 PNP transistors (if you discover applying 5V causes the mouth to move) - I used the 2N3906
- 2 1K Ohm resistors
- 1 1M Ohm resistor
- NPN Transistor (2N3904)
- 1N4001 Diode
- Audacity Free Sound Editing software, or sound editing software of your choice.
Step 2: Exploring the Circuitry
This project is more art than engineering, so there's a bit of investigating you will have to do. If you're like me, that's the most fun part and there's a chance once you've figured it out you'll just move on to something else without finishing the project, but one of the cool things about Halloween projects is you have to get them done by Halloween.
For this part I used something of a circuit bending approach. I basically took some alligator clips and poked around until I found the leads to the LEDs for the flashy lights, and a point which, if I applied 4.5V to it (via the 3 AA battery pack), the mouth opened. Since I was applying 5V to it, instead of grounding it, that meant I had to use a PNP transistor. Actually in this case, you can pretty much see the leads you need to use without too much poking around, but it's fun to do that anyway.
These props are pretty simple, so you shouldn't have too much trouble figuring out what's driving what. Basically, you're driving a motor and some LEDs.
Step 3: Wiring It Up
Having found the wires and contacts of interest, it's time to build the circuitry to drive this dude. The breadboard diagram image was generated with Fritzing, and hopefully it gives a clear picture of what's involved. The image on the right shows the stripped down circuitry driving the motor. This is a pretty conventional circuit you'll use a lot as you hack on anything with motors.
In my case I had PNPs that were too weak, current wise, to drive the thing, so I connected them in parallel and I was good to go. Sometimes you just work with what you have on hand.
In addition to the contacts mentioned in the previous step, I gave the project some capacitive touch magic via a 1 Mega Ohm resistor and an alligator clip attached to some aluminum foil I put inside the bowl.
The Wave shield has a little output jack you can use to connect your speaker, so that part's easy. One key note on the speaker - it really has to have its own amplification, which is why I used a little (but powerful enough for my needs) Bluetooth speaker. There is a simple amp circuit built into the Wave shield, but in practice it doesn't really amplify the sound very much - definitely not enough to compete with a group of Trick-or-Treaters.
Step 4: Getting Your Sounds
This is another 'art' part. You can try some sounds from a free sound library, but it was a lot more fun to make my own clips. My tool of choice was the free Audacity sound editor and liberal use of pitch shifting (DOWN) and reverb effects. Once you have a nice set of sounds, put them on the Wave shield in WAV format. In an early iteration the skeleton recited parts of the skit that leads into M.E.T.H.O.D. Man from the Wu-Tang Clan's first album. But ultimately, be a good neighbor and keep it family friendly for Halloween.
Step 5: The Code
It's the code that makes this guy come to life. Even here though, there's some experimentation involved - I had to come up with a decent threshold to set off the capacitive touch sensor.
A tricky bit was getting him to talk in a manner that seemed connected to what he was actually saying. Google was my friend, but more specifically Phillip Burgess was my friend, sharing this little trick that'd get you roasted in a code review, but totally worked. Quoting from the article.
Finally, there’s the matter of modulating the mouth LED brightness in response to the audio being played. This uses a really dirty trick, nothing gentlemanly about it, and it would get you an “F” in a Computer Science class: we access one of the WaveHC library’s internal variables: playpos, a pointer to the value currently being output to the speaker.
The samples are presumed 16-bit. We look at just the high byte, it provides enough resolution for the animation, and track the minimum and maximum range over a very brief interval (however long it takes for 256 iterations of this loop to execute…which may actually be much quicker than 256 values from the WAV, that’s okay).
Violating good software development principles - it's a good way to give any of your serious programmer friends a good scare on Halloween. On a more serious note, I think people sometimes get intimidated from doing projects because they worry that they suck at programming or whatever. When you're just doing something for fun, there's no need to be intimidated, and it truly is a case of 'good enough is good enough'.
Step 6: Put Him to Work
Once 'Skelito' was up and running, we turned him loose on the Trick-or-Treaters. We are in a somewhat popular neighborhood for Trick-or-Treating, with parents shipping their kids in from all over town, so my wife and I sat on the porch and enjoyed watching people's reactions. Here it is already July as I write this, but I haven't even started this year's Halloween project - I better get on it!