Time Estimate: 3 hours
Materials Estimate: $50-70 (depending on the cost of your Ruxpin)
It was December of 1985 when I watched in horror as my father began ripping apart my favorite toy. Teddy Ruxpin, for those unfamiliar, was an animatronic storytelling teddy bear that was a close friend to many children of my generation. Placing an official Teddy Ruxpin cassette tape into his back would magically spring him to life, blinking his eyes and moving his mouth to speak in a gentle, non threatening voice. Perhaps my dad was certainly sick of hearing him sing songs and regale me with tales of high adventure, so he decided he was going to add a custom headphone jack and spare his sanity.
While I was afraid for my animatronic friend as he went on the operating table, I was fascinated as my dad explained the inner workings of the bear. The audio cassette tape contained two tracks: one reserved for the voices and music, and the other containing audio frequencies that told the circuits how to move the mouth and eyes in perfect synchronization. It was all pre-programmed. There was no magic involved.
More than 30 years later, I found myself at Next Thing Co, brainstorming ideas of entertaining things we could make with C.H.I.P., the world’s first $9 computer. Remembering back to that cold December afternoon, I suggested we hack a Teddy Ruxpin so that we could control him over WiFi and make him say whatever we wanted. Maybe read us tweets, why not.
Thus, the goals of the project were established: C.H.I.P. would log on to your existing WiFi network and present a custom webpage with a text box. Users would type what they want him to say or tell him to read Tweets based on specified search terms. A text-to-speech engine would be utilized to read the results out loud and automatically move the mouth to perfectly match the voice. All of this would be powered by a 3.7v lipo battery, using C.H.I.P.’s built-in charging circuit through a micro USB connection.
The first step was opening up Teddy Ruxpin to see how exactly we could use C.H.I.P. to control the motors. Let’s pull off the back with the screwdriver and get inside. Attached to his original circuit board were three connectors powering three different motors: one for the lower jaw, upper jaw, and eyes. Each connector contained five wires, two of great interest: one which moves the motor forward, another which moves the motor in reverse. Perfect for what we need.
The motors for the upper and lower jaws are wired independently from one another, so in the interest of synchronizing them together, we’ll need to connect them.
An H-Bridge circuit will work perfectly to control the direction of the motors. In this example, we’re using the Sparkfun Motor Driver which has various pins that will need to be connected to C.H.I.P..
The motor driver’s VM pin should connect to the BAT pin on C.H.I.P.. After that, connect the VCC, PWMA, STBY, and PWM B pins to C.H.I.P.’s VCC-5V line to provide power and enable the motors. Then connect all GND connections to GND on C.H.I.P.
Now we need to connect the IO signals to tell the motors what direction to move. Sending a logic signal to one pin will drive the motor forwards, and sending another will reverse it. This controls the eyes moving up and down and the mouth being opened or closed.
Connect the motor driver’s AIN1 pin to C.H.I.P.’s XIO-P0 pin, AIN2 to XIO-P2, BIN1 to XIO-4, and BIN2 to XIO-6. Finally, connect the motor driver’s A01 and A02 pins to Teddy’s upper and lower jaw motors and B01 and B02 to the eye motors.
Teddy Ruxpin already has an internal speaker, so we just spliced the two wires coming from the speaker to our 3.5mm audio cable and connected it directly to the audio/video jack on C.H.I.P.
With the hardware connected and the 3.7v lipo battery plugged into to C.H.I.P., it’s time to move on to the software side of things.
Part of the magic of Chippy Ruxpin is controlling it via WiFi. So let’s get it connected so we can download the software.
We’ll want to log into C.H.I.P.’s operating system to type in some commands. You can either do this by hooking up a screen and keyboard to C.H.I.P., or access it over a network by following our tutorials at 42.nextthing.co
Once logged in, we need to get the WiFi working…
sudo nmcli device wifi connect (your wifi network name/SSID) password (your wifi password) ifname wlan0
(for help and troubleshooting C.H.I.P. visit 42.nextthing.co)
Now it’s time to install the software we need, which you can download by typing this into the terminal:
cd ~/ sudo apt-get install git git clone https://github.com/NextThingCo/ChippyRuxpin.git
This pulls the project’s Python code, which is split into various components: an audio player, a Bottle web framework, a Twitter library, and a class to control the GPIO pins on C.H.I.P. to drive the motors.
Part of the code uses eSpeak, a free text-to-speech engine, to generate a WAV audio file from text. The cool part is our audio code, in addition to playback, also analyzes the WAV file to evaluate its amplitude. If the audio level is loud, the motors in the jaw will activate, opening the bear’s mouth. If it’s quiet, it will close. Mouth synchronization makes it magical.
You can start the application by typing this:
cd chippyRuxpin sudo python chippyRuxpin.py
You should see a message that looks something like this:
CHIPPY RUXPIN IS ONLINE! In your browser, go to http://10.1.2.52:8080
Now on any computer, tablet, or smartphone, you can go to that address in your web browser. You’ll see a page with a simple text input box.
Typing into this box will send the text to C.H.I.P.’s python script to generate the voice audio and play it over Teddy’s internal speaker with a realistic moving mouth.
As mentioned earlier, we also support having Chippy Ruxpin search for tweets and read them out loud. This involves a small bit of setup on your part in order to allow C.H.I.P. to access your Twitter account. Instructions for doing this can be found in the README file.
C.H.I.P.py Ruxpin GitHub
C.H.I.P.py Ruxpin GitHub
Love this project? Think it could be improved? Tell us what you think!