Make: Projects

Hack a Teddy Ruxpin to Say Everything You Type or Tweet

Give Teddy a C.H.I.P. brain transplant and he’ll speak anything you type or tweet — with synchronized mouth and eye movements

m49_ChippyRuxpin-3

Before Furby, AIBO, or Pleo, 1985’s Teddy Ruxpin storytelling plush bear from Worlds of Wonder was the first animatronic toy that used data on a tape drive to choreograph motor movements, while also using the tape for audio playback. Photo by Hep Svadja

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. When an official Teddy Ruxpin cassette tape was inserted into his back, he would spring magically to life, blinking his eyes and moving his mouth to speak in a gentle, non-threatening voice. My dad was certainly sick of hearing Teddy sing songs and regale me with tales of high adventure, so he had decided to add a custom headphone jack and spare his sanity.

While I feared 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.

GUS_2204

Photo by Richard Reininger

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 we could control him over Wi-Fi 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 Wi-Fi network and present a custom web page with a text box. Users would type what they want the bear to say, or tell him to read Twitter messages 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.

Screen Shot 2015-12-23 at 1.37.52 PM

1. Original servomotors move the toy’s eyes and mouth.
2. Original speaker plays speech and other audio.
3. Remainder of Teddy’s antique guts are removed: circuit board, cassette tape drive, audio/data cassette, and 4 hefty D batteries.
4. C.H.I.P. computer connects to internet via onboard Wi-Fi, then converts incoming text or tweets to speech and sends it to the speaker, while analyzing audio amplitude to create synchronized motor signals.
5. H-bridge motor controller board on a DIY “shield” plugs into C.H.I.P. and drives the original servos.
6. 3.7V LiPo battery plugs directly into C.H.I.P. to power everything.

Illustration by Damien Scogin

 

Steps

Step #1: Surgery

PrevNext
Hack a Teddy Ruxpin to Say Everything You Type or TweetHack a Teddy Ruxpin to Say Everything You Type or TweetHack a Teddy Ruxpin to Say Everything You Type or Tweet

The first step was opening up Teddy Ruxpin to see how exactly we could use C.H.I.P. to control the motors. Attached to his original circuit board were 3 connectors powering 3 different motors: for the lower jaw, upper jaw, and eyes. Each connector contained 5 wires, 2 of great interest: one that moves the motor forward, and one for reverse. Perfect for our needs.

Step #2: Bridging the motor gap

PrevNext
Hack a Teddy Ruxpin to Say Everything You Type or TweetHack a Teddy Ruxpin to Say Everything You Type or TweetHack a Teddy Ruxpin to Say Everything You Type or Tweet
  • The motors for the upper and lower jaws are wired independently from one another, so in the interest of synchronizing them together, you’ll need to connect them. An H-bridge circuit works perfectly to control the direction of the motors. In this example, we’re using the SparkFun Motor Driver which has various pins that need to be connected to C.H.I.P.
  • First, connect the motor driver’s VM pin to the BAT pin on C.H.I.P., and 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 connect the I/O signals to tell the motors what direction to move. Sending a logic signal to one pin will drive the motor forward, 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-P4, and BIN2 to XIO-P6. 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 motor.
  • To organize these connections, we made a DIY “shield” from protoboard to plug into C.H.I.P.’s I/O headers. You could use a mini breadboard and jumper wires.

Step #3: Let the bear speak!

PrevNext
Hack a Teddy Ruxpin to Say Everything You Type or Tweet
  • Teddy Ruxpin already has an internal speaker, so we just spliced the 2 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.
  • Plug the 3.7V LiPo battery into C.H.I.P., and your hardware’s all connected. Go ahead and stuff it into the bear. It’s time to move on to the software side of things.

Step #4: The software side of things

PrevNext
Hack a Teddy Ruxpin to Say Everything You Type or Tweet
  • Part of the magic of Chippy Ruxpin is controlling it via Wi-Fi. So let’s get it connected so you can download the software. You’ll want to log into C.H.I.P.’s operating system to type in some commands. You can either hook 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, you need to get the Wi-Fi working. Type the following, all on one line: nmcli dev wifi connect [YOUR SSID] password [YOUR PASSWORD]
  • Once you're signed in and have a working network connection, take a moment to update C.H.I.P. using the following commands. sudo apt-get update sudo apt-get upgrade
  • Now it’s time to install the software you need, which you can download by typing these commands into the terminal: cd ~/ sudo apt-get install git git clone https://github.com/NextThingCo/ChippyRuxpin.git
  • Now you're nearly there, but before you fire up the python script, you'll need to install a few more software packages used by this project. sudo apt-get install python-setuptools python-dev build-essential espeak alsa-utils sudo apt-get install python-alsaaudio python-numpy python-twitter python-bottle mplayer
  • 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, it 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’ll see a web 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.
  • Chippy Ruxpin can also search for tweets and read them out loud. This involves a bit of setup on your part in order to allow C.H.I.P. to access your Twitter account. Instructions can be found in the README file. Imagine the fun of hearing Chippy speak every tweet from @nextthingco, @colbertlateshow, @NASA, or even (caution: definitely NSFW) @WhatTedSaid!

Step #5: Going further

PrevNext
Hack a Teddy Ruxpin to Say Everything You Type or Tweet

This project only scratches the surface. Perhaps you’d like to take control of Chippy Ruxpin from the other side of the world and have him terrorize your friends. Or have Chippy Ruxpin create his own Wi-Fi hotspot. With C.H.I.P.’s low cost and integrated wireless capabilities, there are endless projects that you can make on your own. ʕ•ᴥ•ʔ

Andrew Langley

Andrew Langley

Andrew Langley is a software and hardware developer at Next Thing Co. who previously worked as a programmer, designer, and writer for Telltale Games on such titles as The Walking Dead and Minecraft: Story Mode. He also had a brief appearance in the movie Problem Child.


Advertisement

  • Nathan Schmidt

    So I would like to make this project…but according to nextthing.co the company that makes and sells this chip, I have to wait until June?

    • John Daniels

      Yeah… I thought about backing the kickstarter a couple of months ago (maybe more?), but the shipping to Japan was $15 for a $9 computer. That’s ridiculous in my mind, so I passed. Luckily, this same project could be done with a raspberry pi, or any of several other microcontrollers if you attach the right shields to them. It doesn’t need to be a CHIP.

      • lolwut

        You get something delivered halfway across the planet for only $15 and that’s “ridiculous”?

        Seems like a fair deal to me, even if it is a $9 product

        • John Daniels

          I’ve shipped things that size for less in the past. Often shipping prices are estimated and the actual cost is below what you pay for shipping. That’s not really a fair deal. The miracle of modern postal systems aside, when shipping costs more than the product, it isn’t worth it, now is it? I could use locally sourced components to build the thing myself. Alternatively, I could wait until they are available in Japan and order through amazon prime for no shipping cost at all. That sounds like a better deal to me.

      • Nathan Schmidt

        I’m new to the micro-controllers…any chance you can offer a bit of knowledge for the raspberry pi, shields, maybe how this would run on an Arduino?

        • John Daniels

          First, let me point out a difference between Arduino and Pi/CHIP. Arduino is a true microcontroller, whereas Pi/CHIP are systems on a chip with some microcontroller-esque capabilities. This means the Arduino runs scripts that get compiled into code the chips can understand, but a Pi/CHIP runs linux and then can access IO through Python or whatever language you want to code in and then run on the Pi/CHIP.

          I’m not experienced with sound on Arduino, but I know it is partially possible. However the sound boards for Arduino mostly seem to trigger the playing of sound files (for example https://www.adafruit.com/products/2133), so I think a Raspberry Pi would be better for this project since you could actually have text to audio software do the audio generation and just output through the Pi’s on-board stereo jack. You’d also have to factor in the costs vs savings of using an add-on sound board vs the built-in sound of a Pi.

          The provided python files should be able to be modified to support a Raspberry Pi with little trouble. Mostly you’d have to just remap the pins to the correct and corresponding pins on the Pi. A Raspberry Pi should also be able to use all of the above breakout boards. Again, just make sure the pins match up. Personally, I wouldn’t run the servos through the CHIP or Pi’s on-board power rails. Often the available amps are too low on the board, and trying to draw too much on them can burn out the board. Make a common 5v directly from the battery and power the CHIP/Pi and servos from that common 5v instead of pulling the power through the Pi/CHIP. Aside from finding the right pins and updating the code, I believe it would work identically to what is described above.

          If anyone knows more about audio on Arduino, please chime in, or if you have more knowledge on the differences between Pi and CHIP, that could be valuable as well. As the CHIP is not yet available to consumers, I’m basing my assumptions on what I have gleaned on the CHIP over several different articles.

    • Robert White

      Yeah, this was my same problem. I got really excited to do this project and the chip isn’t even available for 6 months.

  • Marla Hughes

    I am so grateful TDH doesn’t know electronics. He would terrorize my Grand girls.

  • CSX321

    My kids had the 90’s follow-up to T.R., which was called TV Teddy. A few years ago when one was starting college, we were going through old toys to sell or donate. All of us who were in the room swear that, just as I was about to take the old batteries out of TV Teddy, he said what sounded like, “I can’t breathe!” It was a bit spooky.

  • Bob Da’Bird

    Well Im doing this project!!

  • Opinion