Hack Your Hasbro R2D2 With an IOIO Microcontroller!
by evolvingmonkeys in Circuits > Robots
50904 Views, 97 Favorites, 0 Comments
Hack Your Hasbro R2D2 With an IOIO Microcontroller!
My wife bought me a Hasbro Interactive R2D2 Astromech Droid for my birthday a few years ago after I said how much fun it would be to hack it and I've finally managed to get inside and start playing!
Although the built-in voice control functions are fun and cool to play with, and our 2 year old loved to dance to the "Hey R2, Dance Program" Cantina Song, there isn't much actual practical functionality to it. So, this is the first step in making the toy into a customizable remote control sentry robot. This is an easy and educational first microcontroller project that's great for a parents and kids or classrooms.
Since the release of Android's Accessory Development Kit (ADK) last summer, Android devices can now natively act as a USB host to microcontrollers such as Arduino and IOIO boards. After I disassembled it and pulled out the stock PCBs, I played around with Arduino and was able to get the wheel motors and the dome moving. Being more of a tinkerer than a programmer, I didn't have the expertise to build the necessary iOS or Android App to remote control the motors. The added complication of building sketches for the Arduino led me to the IOIO board for now, which allows direct control from the Android device via USB or bluetooth without having to program and reprogram the microcontroller when I add sensors and eventually the dome motor control.
I found Simon Monk's new book, "Making Android Accessories with IOIO", and decided to use his method and open-source sample code to tackle the first step of the process: remote controlling R2 from a smartphone!
This is the beginning of an effort to build myRobot, an open-source robotics control platform utilizing Android and eventually iOS devices as "heads", to build telepresence robots out of almost anything! After R2 and other basic two-wheeled platforms are completed, Roomba support will be next, followed by Arduino support. Stay tuned!
Parts List:
Android Controller Device (I'm using a Samsung Nexus S)
Hasbro Interactive R2D2 Astromech Droid
IOIO for Android Microcontroller, sku: DEV-10748
Motor Driver 1A Dual TB6612FNG, sku: ROB-09457
Barrel Jack to 2-pin JST Cable, sku: TOL-08734
JST Right Angle Connector, sku: PRT-08612
Break Away Female Headers, sku: PRT-00115
8 x AAA battery holder
9V to Barrel Jack Adapter, sku: PRT-09518
Bluetooth USB Adapter - most generic ones should work
Jumper Wires
Electrical Tape
All of the parts except the Android phone and R2D2 itself can be purchased from Sparkfun, home of the IOIO, for less than $100 after shipping and taxes.
Tools:
Soldering Iron
Dremel
P1 Phillips screwdriver
Drill with 3/8" bit
The emotional capacity to disassemble our beloved R2
Note:
Version 2 of the IOIO will likely be coming out over the next few months, which if it looks like the promo image, will hopefully negate the need to solder on the female headers and JST adapter.
Although the built-in voice control functions are fun and cool to play with, and our 2 year old loved to dance to the "Hey R2, Dance Program" Cantina Song, there isn't much actual practical functionality to it. So, this is the first step in making the toy into a customizable remote control sentry robot. This is an easy and educational first microcontroller project that's great for a parents and kids or classrooms.
Since the release of Android's Accessory Development Kit (ADK) last summer, Android devices can now natively act as a USB host to microcontrollers such as Arduino and IOIO boards. After I disassembled it and pulled out the stock PCBs, I played around with Arduino and was able to get the wheel motors and the dome moving. Being more of a tinkerer than a programmer, I didn't have the expertise to build the necessary iOS or Android App to remote control the motors. The added complication of building sketches for the Arduino led me to the IOIO board for now, which allows direct control from the Android device via USB or bluetooth without having to program and reprogram the microcontroller when I add sensors and eventually the dome motor control.
I found Simon Monk's new book, "Making Android Accessories with IOIO", and decided to use his method and open-source sample code to tackle the first step of the process: remote controlling R2 from a smartphone!
This is the beginning of an effort to build myRobot, an open-source robotics control platform utilizing Android and eventually iOS devices as "heads", to build telepresence robots out of almost anything! After R2 and other basic two-wheeled platforms are completed, Roomba support will be next, followed by Arduino support. Stay tuned!
Parts List:
Android Controller Device (I'm using a Samsung Nexus S)
Hasbro Interactive R2D2 Astromech Droid
IOIO for Android Microcontroller, sku: DEV-10748
Motor Driver 1A Dual TB6612FNG, sku: ROB-09457
Barrel Jack to 2-pin JST Cable, sku: TOL-08734
JST Right Angle Connector, sku: PRT-08612
Break Away Female Headers, sku: PRT-00115
8 x AAA battery holder
9V to Barrel Jack Adapter, sku: PRT-09518
Bluetooth USB Adapter - most generic ones should work
Jumper Wires
Electrical Tape
All of the parts except the Android phone and R2D2 itself can be purchased from Sparkfun, home of the IOIO, for less than $100 after shipping and taxes.
Tools:
Soldering Iron
Dremel
P1 Phillips screwdriver
Drill with 3/8" bit
The emotional capacity to disassemble our beloved R2
Note:
Version 2 of the IOIO will likely be coming out over the next few months, which if it looks like the promo image, will hopefully negate the need to solder on the female headers and JST adapter.
Disassemble R2!
The Hasbro R2D2 is fairly straightforward to take apart, basically remove every screw you see on the back and in the battery compartment. I found this extensive video guide on youtube if you run into any problems.
The most difficult part is removing the dome base, as it is fairly securely attached with double-sided tape. Gently pry the front and back body pieces apart, and then gently pry the dome base out of the front body piece.
I did unsolder the wires rather than cutting, leaving the wires from each leg motor intact, as well as all of the dome sensors for future use.
I'm one of those guys that always has either extra parts laying around or not enough screws because they rolled away, so I used the magnet from R2's front casing to hold onto everything as I went.
The most difficult part is removing the dome base, as it is fairly securely attached with double-sided tape. Gently pry the front and back body pieces apart, and then gently pry the dome base out of the front body piece.
I did unsolder the wires rather than cutting, leaving the wires from each leg motor intact, as well as all of the dome sensors for future use.
I'm one of those guys that always has either extra parts laying around or not enough screws because they rolled away, so I used the magnet from R2's front casing to hold onto everything as I went.
Prepare the IOIO and Motor Driver Boards
The IOIO and Motor Driver boards both come without headers, so if you're planning to play around, rather than solder your leads directly, I'd suggest soldering on male headers. You can just solder the ones you need if you want, but I preferred to just get it all done at once.
Sparkfun has "Breakaway" female headers in strips of 40 for $1.50 each. Unfortunately they're not really "Breakaway", they're a solid run of 40, so to use the "Breakaway" feature you have to use a knife or a Dremel. Sparkfun also sells Swiss Machine Pin style snap-off female headers that are more expensive at $3.95 for a strip of 30, but easier to prepare.
I went with the "Breakaway" and mark the length I want then use a Dremel to cut through the next header, filing down the edge flat with the end of the cutting wheel.
I tried using a PanaVise to hold the board, but it's easier to just flip over the IOIO with the headers in position flat on your workspace. As for soldering, this was my first foray into soldering PCBs, and I was surprised how easy the pins were to solder in and how quickly it went, especially since I finally invested in a good soldering station, a Hakko FX-888 - highly recommended! I'd suggest reading up a bit if you're a novice, I used MightyOhm.com's "Soldering is Easy" comic book which is excellent.
Aside from the headers, to deliver more than 5V to the IOIO, you have to solder on a JST connector to the bottom, then make a JST-->9V cable to connect to the battery or use a JST-->Barrel connector cable with a Barrel connector -->9V cable.
Sparkfun has "Breakaway" female headers in strips of 40 for $1.50 each. Unfortunately they're not really "Breakaway", they're a solid run of 40, so to use the "Breakaway" feature you have to use a knife or a Dremel. Sparkfun also sells Swiss Machine Pin style snap-off female headers that are more expensive at $3.95 for a strip of 30, but easier to prepare.
I went with the "Breakaway" and mark the length I want then use a Dremel to cut through the next header, filing down the edge flat with the end of the cutting wheel.
I tried using a PanaVise to hold the board, but it's easier to just flip over the IOIO with the headers in position flat on your workspace. As for soldering, this was my first foray into soldering PCBs, and I was surprised how easy the pins were to solder in and how quickly it went, especially since I finally invested in a good soldering station, a Hakko FX-888 - highly recommended! I'd suggest reading up a bit if you're a novice, I used MightyOhm.com's "Soldering is Easy" comic book which is excellent.
Aside from the headers, to deliver more than 5V to the IOIO, you have to solder on a JST connector to the bottom, then make a JST-->9V cable to connect to the battery or use a JST-->Barrel connector cable with a Barrel connector -->9V cable.
Prepare the Battery
There are 2 sets of 4 batteries in the stock R2, 4 x AA for running the controllers and 4 x D for driving the motors. The IOIO takes 5-15V and 4 rechargeable D cells would give me 4.8V, and I wanted to make sure that the voltage will be able to power an Android phone off of the IOIO USB port eventually, so I opted for an 8 x AA battery holder, for 9.6V that fits perfectly into the compartment.
I drilled a 3/8" hole through to the back of the compartment and threaded the female barrel connector through.
With 5V-15V in through the JST connector, the IOIO delivers either 5V or 3.3V out through the pins and 5V out through USB to power a smartphone device. Although the IOIO can theoretically supply 1.5A at 5V, my brother-in-law fried an IOIO running fairly small motors directly off an IOIO, so I decided to splice into my battery output and run a direct 9.2V wire to the Motor Driver.
Note: The increased voltage overdrives R2's motors a bit, so he's faster, but it could eventually burn them out - more testing required.
I drilled a 3/8" hole through to the back of the compartment and threaded the female barrel connector through.
With 5V-15V in through the JST connector, the IOIO delivers either 5V or 3.3V out through the pins and 5V out through USB to power a smartphone device. Although the IOIO can theoretically supply 1.5A at 5V, my brother-in-law fried an IOIO running fairly small motors directly off an IOIO, so I decided to splice into my battery output and run a direct 9.2V wire to the Motor Driver.
Note: The increased voltage overdrives R2's motors a bit, so he's faster, but it could eventually burn them out - more testing required.
Wire Up R2
Below is the wiring diagram from Simon Monk's book, "Making Android Accessories with IOIO."
Rather than soldering male headers onto one side of the Motor Driver board so that it plugs directly into the IOIO, I opted to use male headers on both boards and connect with jumper wires.
Wiring order for R2's leg motors:
A1 - Red (Left Leg)
A2 - Black (Left Leg)
B1 - Black (Right Leg)
B2 - Blue (Right Leg)
I haven't figured out why one side is the reverse of the other, but it worked this way for me after switching leads around a few times to determine the direction of the motors.
Rather than soldering male headers onto one side of the Motor Driver board so that it plugs directly into the IOIO, I opted to use male headers on both boards and connect with jumper wires.
Wiring order for R2's leg motors:
A1 - Red (Left Leg)
A2 - Black (Left Leg)
B1 - Black (Right Leg)
B2 - Blue (Right Leg)
I haven't figured out why one side is the reverse of the other, but it worked this way for me after switching leads around a few times to determine the direction of the motors.
Install Software and Connect to IOIO Via Bluetooth
I'm an iOS guy and still figuring out Android to some extent, so feel free to add alternate ways to do the following:
1. Download Simon Monk's IOIO Rover App from the link provided in his book, "Making Android Accessories with IOIO"
2. To install programs outside of the Android Marketplace, now Google Play, the easiest way I've found is to install Dropbox and Easy Installer, both available in the Marketplace. Copy IOIO Rover into your Dropbox, then open it on the Android device.
3. Power R2 up, and connect to the IOIO via Bluetooth. Settings-->Wireless & Networks-->Bluetooth settings
If your Bluetooth USB dongle is compatible, it should come up as "IOIO (XX,XX)" under Bluetooth Devices.
Complete the pairing process by following the prompts.
4. Reopen the IOIO Rover App and start driving R2 around the house!
Notes:
Simon's app is very rudimentary, without joystick-like control, telepresence functions, or sensor integration.
We should have an upgraded version available in the next month or so to make your own remote-controllable sentry robot out of an old R2D2 or two-wheeled platform, with Roomba and RC Car versions coming after!
Keep track of updates at http://www.evolvingmonkeys.com
1. Download Simon Monk's IOIO Rover App from the link provided in his book, "Making Android Accessories with IOIO"
2. To install programs outside of the Android Marketplace, now Google Play, the easiest way I've found is to install Dropbox and Easy Installer, both available in the Marketplace. Copy IOIO Rover into your Dropbox, then open it on the Android device.
3. Power R2 up, and connect to the IOIO via Bluetooth. Settings-->Wireless & Networks-->Bluetooth settings
If your Bluetooth USB dongle is compatible, it should come up as "IOIO (XX,XX)" under Bluetooth Devices.
Complete the pairing process by following the prompts.
4. Reopen the IOIO Rover App and start driving R2 around the house!
Notes:
Simon's app is very rudimentary, without joystick-like control, telepresence functions, or sensor integration.
We should have an upgraded version available in the next month or so to make your own remote-controllable sentry robot out of an old R2D2 or two-wheeled platform, with Roomba and RC Car versions coming after!
Keep track of updates at http://www.evolvingmonkeys.com