Introduction: Dead E. Ruxpin: a Cassette Tape-controlled Animatronic Halloween Decoration
The original Teddy Ruxpin, released in 1985, was an interesting bit of technology. It read stories aloud while moving its mouth in sync with the words. And it worked using cassette tapes.
This was possible because a cassette tape stores stereo audio, meaning it separates the left and right speaker channels. Teddy Ruxpin played audio using one of those channels, but the other channel controlled the position of the mouth.
I thought that was very clever, but that I could be more clever with the help of modern technology.
So I built Dead E. Ruxpin. (the E. is for "Evil")
Like Teddy Ruxpin, it uses cassette tapes. Those play the audio and control the movement. But instead of just a moving mouth, Dead E. Ruxpin also has moving arms.
To find out how I controlled three separate motors independently using a single cassette tape audio channel, strap in!
Supplies
- Seeed Studio Xiao RP2040 development board
- Audio amplifier board
- 3W speaker
- (x3) MG996R servo motors
- 16-channel PWM servo controller board
- TOMASHI stereo cassette recorder/player
- 3.5mm to RCA stereo cable
- ElectroCookie prototype PCB
- Blank cassettes
- Hand puppet bear
- (x2) AA battery holder
Requires:
- 3D printer
- PC with audio editing software and Arduino IDE
- Tape recorder that can record stereo
Step 1: Fast Fourier Transforms and Frequency Bands
Music and pitch
Analog audio is weird.
Human hearing extends from around 20 hertz to 20 kilohertz and a cassette can cover most of that (reliably around 30Hz to 16kHz).
A single musical pitch is just one frequency. A perfect middle C, for example, is 256Hz. Double that to move up an octave and you get 512Hz.
But music isn't just a sequence of notes. Most music contains multiple overlapping pitches. Strum a guitar and you get six of them. Add in vocals and other instruments, and you've got a whole bunch of different frequencies harmonizing at once.
I took advantage of that fact to "encode" Dead E. Ruxpin's movement commands into a single audio track.
Movement frequencies
I knew I wanted to move three different servo motors: one for the mouth, one for the right arm, and one for the left arm. I also new that I wanted each to have two positions: the mouth open or closed, and the arms up or down.
That means I needed six different commands. I wanted those to be able to overlap and to work in real-time, so I could sync movement with the audio. That prevented me from simply storing conventional data on the cassette tape, like you might do with a early 8-bit computer.
I also knew that I could only work with one of the two channels, because the other would be taken by the audio.
So I decided on a distinct frequency for each movement command:
- 1000Hz to Open Mouth
- 1351Hz to Close Mouth
- 1825Hz to Lift Left Arm
- 2466Hz to Lower Left Arm
- 3331Hz to Lift Right Arm
- 4500Hz to Lower Right Arm
You may notice that that isn't a linear progression. The intervals between frequencies grows as the frequencies increase. That's to keep them distinct with as little bleed-over as possible, for the same reason that octaves double.
I chose to keep them in a relatively narrow range (1000Hz to 4500Hz) in order to stay well within the capability of cassette tapes and to make the Fast Fourier Transform more efficient.
Fast Fourier Transform
A Fast Fourier Transform (FFT) is a bit of algorithmic voodoo. Using math that is beyond my understanding, an FFT algorithm can tell you the amplitude of the frequencies within an analog audio signal.
But checking every frequency would be needlessly inefficient. To keep things practical, we limit that to an overall range and we check individual frequency ranges within that.
For reasons I'm not smart enough to comprehend, an FFT algorithm needs to cover a range that is twice what you want to actually work with. In my case, I needed at least up to 9000Hz and I settled on 10000Hz to be safe.
The algorithm also needs to know how many samples to take. I chose 2048, which gives plenty of granularity without becoming too slow.
Step 2: Recording Audio "stories"
Creating audio file stories
Knowing the above, I was able to create audio "stories" like those played on Teddy Ruxpin. Each story would contain the audio track on the left stereo channel and the movement command frequencies on the right stereo channel.
Because I have an Adobe Creative Cloud subscription, I used Audition to make the audio files. But this should be possible in an fully featured audio editor.
I started with the audio clip I wanted, like Michael Jackson's "Thriller," and then trimmed it to the length I wanted. I then deleted all of the audio on the right channel. Some music has distinct channels and that would require mixing them down to mono, but that wasn't necessary for any of the audio I worked with (which all had identical left and right channels).
From there, it was as simple as generating a tone on the right channel of the correct frequency at the point I wanted the movement to occur. So when Michael Jackson yells "thriiilllllerrrr," I generated the 1000Hz tone to open the bear's mouth.
Except it isn't quite that simple. You can't generate a tone that overlap overlaps another—it will just overwrite the previous tone. If you want tones to overlap, you have to generate them together as a single operation.
So if, for example, I wanted the mouth to open and the left arm to lift up, I had to generate both tones at the same time. That made syncing the movement challenging, but I simplified it by creating a bunch of presets in Audition.
I think multi-track mixing could have made that easier, but I wasn't sure how to do it.
Recording tapes
With my audio file stories ready to go, I needed a way to actually get them onto cassette tapes. That was more difficult than you might expect.
I purchased a new portable cassette player/recorder that was advertised as stereo (most are mono). I planned to use it both for playing the tapes and for recording the tapes. But that turned out to be impossible, because the model I purchased could only play in stereo and couldn't record in stereo.
So I went on an indignant crusade, searching every thrift store within a 15-mile radius. I found several tape decks, but most of them didn't work. Thankfully, I found one old stereo that did work.
To get the audio from my computer to the tapes, I connected a cable from my PC's headphone jack to the input on the stereo. I then played the audio while recording the tape. It took some experimentation to get the volumes right, but this worked.
Step 3: The Electronics
Electronic components
I knew FFT algorithms take a fair amount of processing power, so I chose a microcontroller with some oomph: the Raspberry Pi RP2040.
And because I'm not a masochist, I used a development board: the Seeed Studio Xiao RP2040. That is a tiny little board with relatively few accessible pins, but it had what I needed.
The simplify the control of the three servo motors, I chose a 16-channel PWM controller module. I only needed three of those channels, but the 16-channel modules are the easiest to find.
The servos I selected were high-torque MG996R knockoffs. Those probably weren't the best choice, because they're slow. But I had already purchased them, so I used them anyway.
Finally, to play the audio, I used generic 3W mini amplifier board based on a Class D amplifier. It pumps out audio through a 3W "full range" speaker. Because it only needs to play the left audio channel, there was no use for a second speaker.
Assembly
I soldered the Xiao and the amplifier board to an ElectroCookie prototype PCB. I highly recommend using those over standard perfboards, because they mimic the layout of a breadboard. The power rails are interconnected, as well as the rows for the components. It makes wiring so much easier.
I kept the servo controller, speaker, and servos all separate.
Power comes from four AA batteries in series to get around 6V max.
The audio cable connects on one side to the cassette player's headphone jack. The other side is split: the left channel goes to the amplifier board and the right channel goes to an analog input pin on the Xiao so it can be analyzed.
Step 4: Programming
Libraries
I'm most comfortable within the Arduino IDE, so that's what I chose for this project. There are libraries now to make the RP2040 work in the Arduino IDE like a normal Arduino dev board, so this is straightforward.
Using the Arduino IDE let me take advantage of the ArduinoFFT library, which is very popular for frequency analysis. I was also able to use the Adafruit_PWMServoDriver library to easily control the servos.
Code
The code is surprisingly simple.
First, it runs the ArduinoFFT library according to the parameters I mentioned back in Step 1. That returns an array with a bin for each of the samples.
My code adds up a set of those bins surrounding my target frequencies. Because analog signals are dirty and sloppy, I wanted to account for a whole frequency range instead of just the target frequency.
The code then checks to see if a set of bins exceeds a set threshold. If it does, it is safe to assume I generated a tone and the corresponding servo moves to the corresponding preset condition.
That process loops as fast as it can run, constantly looking for tones on the right audio channel.
Attachments
Step 5: The Skeleton
Internal structure
Like all good animatronics, Dead E. Ruxpin needed a skeleton.
In Fusion 360, I designed a single part to act as the primary internal structure. The electronic components all mount onto that using screws in heat-set inserts. The two AA battery holders mount in pocket underneath the base and their weight helps keep the whole thing stable.
Simple 3D-printed arms attach to the servo circular servo horns with hot glue. This put shame to my former career as a mechanical designer, but it was the easiest approach.
Step 6: The Skin
Bear skin
Because Teddy Ruxpin was the inspiration, I wanted this to be a bear.
Luckily, I was able to find a hand puppet on Amazon that fit the bill. A hand puppet was ideal, because it had a mouth designed to move and enough space inside to fit the skeleton.
I did, however, need to cut a slit in the back to get the skin onto the skeleton—it was a tight fit. To keep the stuffing from falling out, I sewed up the seams.
Deadizing the bear
The hand puppet was meant for kids. It was cute, but not exactly scary and this was supposed to be a Halloween decoration.
So I went to my local Spirit Halloween store to pick up some things.
First up was some red paint, for obvious reasons. Fake blood tends not to dry well, so I used paint to make the bear bloody.
Next, I found a small toy knife. I hot-glued that to one of the hands.
Finally, I found some fake bulging eye prosthetic things. I thought those were fun, so I hot-glued them over the bear's original eyes and then put a bunch of "blood" around everything.
Step 7: Singing and Talking
So that's the build!
The video on my YouTube channel shows it in action.
The songs I chose should be easy to recognize, but can you identify all of the movie quotes?
In theory, I can create new "stories" whenever I want and then record them to cassette tapes to expand Dead E. Ruxpin's repertoire. The code doesn't need to change, because all of the content comes from the tapes.
I hope you liked this, because it was a really fun project! I know I'm proud of the out-of-the-box thinking that this required and maybe it will inspire your own Halloween decorations.
This is an entry in the
Halloween Contest
6 Comments
1 day ago
j’adore, c’est une idée originale et géniale ,
wonderful, brilliant, brilliant idea
7 days ago
I like this. Do you have a mini?
Reply 6 days ago
I'm not sure what you mean... a mini what?
12 days ago
This is one of the best things I've seen in a while :) Thanks a lot for sharing!
Reply 12 days ago
Aw, thanks! :)
12 days ago
Genius!
Awesome!