And as a result of this passion, I've accumulated a fair amount of old toys with the intention of taking them apart, seeing how they work, and possibly hacking their electronics to make a cool autonomous robot. I have a bunch of RC toys from my childhood such as cars, an RC robot (Rad 2.0: very cool!), and a small hovercraft. In addition I've also managed to snag some cheap used toys off of eBay or from thrift stores. That's how I acquired my most recent project which will be the main focus of this post. More specifically, one day I was frequenting one of the geekier (awesomer) parts of the internet, when I thought to myself, robots are cool, and dinosaurs are cool, I wonder if someone has combined the two before (FYI most of my interests may make me seem like an eight year old, but I'm a legal adult I swear!). So I searched a bit around the linked website as well as the internet but could only find one or two examples of a robotic dinosaur. But then I stumbled upon this beauty.
This gorgeous thing is a semi-autonomous, remote controlled, robotic toy raptor. Normally retailing for $200, I managed to snag one of these suckers off eBay for a mere $15. The only catch was there was no remote! So I figured this would at the very least look pretty awesome tearing around in autonomous mode but optimistically, I hoped I could build a remote using an Arduino or possibly piggyback the electronics directly and have an Arduino controlling the built in microcontroller. Well let me tell you, it works!
In an attempt to save myself effort and money I started off by looking online to see if anyone else had had a similar idea. Turns out Wowwee robots are notoriously simple to hack and there was a whole online community that focused on hacking the RoboSapien, which is a humanoid robot. After some more research I found that these 'bots use IR wireless communication. This essential makes the robots way more hackable for a number of reasons. First off, most RC toys use radio frequencies between the remote and the toys. These radio frequencies are usually low power, relatively easy to make, and provide very little interference with the outside world. The only problem is there are several commonly used frequencies which all require special chips that are not commonly available in order to transmit data. Wowwee robots, on the other hand, use IR, or infrared, light to transmit data. IR is relatively high power compared to radio frequencies, but usually has a lower range. It is also a lot more susceptible to interference because there many things that produce IR radiation, such as the sun for example. IR controllers also tend to be more directional in nature, meaning you have to be pointing the remote at or around the thing you're trying to control. However IR does tend to be a more popular wireless control method because it's very cheap and readily available. In fact Radioshack sells IR LEDs that can be used to make custom remotes.
But anyways, while I certainly wouldn't have used IR to control a $200 toy, it does mean that the average hacker can easily recreate a remote control. The only caveat is that in order to one to control a commercial device, you need to know what protocol to use or how the controller sends data. So first off I needed to find out what modulation frequency the controller used. For those who don't know what that means, let me explain. As a said before, IR is notoriously susceptible to interference. Infrared is everywhere! Essentially anything that is producing heat is producing infrared light. TV remotes produce it, the sun produces it, we do as well. It's a pretty busy section of the spectrum so it'd be easy to lose signals if you're just blinking an IR LED. A good analogy would be if you're swimming way out in the ocean. You're probably not going to notice if the water level gradually changes by ten feet. You will notice, however, if all of the sudden the water gets really rough and there's a lot of waves constantly lifting and dropping you. This is what frequency modulation is. Rather than an IR LED being simply on or off, the LED is switched on and off thousands of times a second for a specified amount of time. The ones and zeros of a binary message can then be whether the receiver sees a modulated IR burst, how long one lasts, or how long a pause between bursts is seen.
This brings me to the Wowwee protocol. Despite the fact that not many people have hacked the raptor, I still managed to find enough info to understand the protocol since the same command structure is used by all the Wowwee robots. This makes my job of building a controller a breeze because, if the protocol had not already been documented I would have had to buy a controller and built an IR receiver to record the IR bursts that the controller sent. So with this difficulty aside, I could go straight to making the remote.
Using the this website, I found that the IR signal is modulated at 39.2KHz (I rounded to 40KHz which was good enough) with a 1200Hz transmission frequency which means a 833 microsecond bit width (the time taken to send a bit). The transmission starts with an eight bit width IR pulse, a logic high is a pause of four bit widths followed by a one bit width pulse, and a logic low is a one bit width pause followed by a one bit width pulse. There are a total of twelve bits in each message. Here's the command table taken from the above website which is now out of commission. The numbers are in hexadecimal format (base 16).
Normal Operation | ||
Function | Mode | |
Default | Mode 1 | |
Forward |
$186
| |
Backward |
$187
| |
Left |
$180
| |
Right |
$188
| |
Stop |
$18E
| |
Demo |
$1D0
|
$1B1
|
Head Right |
$194
|
$1B4
|
Head Left |
$191
| |
Tail Left |
$192
|
$1B2
|
Tail Right |
$193
|
$1B3
|
Bite |
$1D1
|
$1B0
|
I then proceeded to create an Arduino program to control an IR LED. Using the AVR built in PWM I managed to modulate the frequency to 40KHz. I then set up two NPN transistors in an AND gate format with the two inputs being the 40KHz signal and the bit logic signal which is manually timed using the delayMicroseconds function and some bit logic. I've uploaded the code to Github where it's free to use and distribute. I'll most likely be updating it over the next few weeks as I work more on the RoboRaptor. I'd like to convert the entire sketch into a RoboRaptor class with built in functions for walking, trotting, and running, as well as many of the other commands. That way in the future it'll be easy for other people to simply import the library and use it.
As for my other future plans with the raptor (I haven't come up with a name for him/her yet), I've noticed that the front speaker seems a little quiet which I'd like to try and fix. My dream is also to have a team of three of these, with one command Raptor and two soldiers, and get them to move around and hunt like the Velociraptors in Jurassic Park. The only problem with this is that there is no way to control two of the toys separately since they use the same command protocol (Guess the inventors never thought someone would have more than one of their $200 toys), so I might try and take apart the electronics, probe it to see how the internal microcontroller controls the RoboRaptor's movements, and try to imitate that with my own microcontroller that I can put in instead. That way I can have more control over how the Raptor moves, the noises it makes, how it communicates, etc. So while that's an ambitious endeavor, it's my ultimate goal!