Introduction: Voice Controlled IRobot Create
I recently received an android Accessory Development Kit (ADK) and, coincidentally, also just received my iRobot create. So, I decided to put the two together to get a voice-controlled robot using the Android APIs as an easy way to perform the speech to text function. The result is fun to play with, and a great introduction to the ADK and the iRobot Open Interface!
Step 1: Materials List
Android Accessory Development Kit (or arduino with USB Host shield)
Android phone compatible with the ADK (I'm using the Nexus S)
USB micro B to A cable
Working installation of the Arduino development environment
Working Android development environment
25pin male connector (DB25)
size M power plug connector
Hookup wire, 22 gauge
LM7812 voltage regulator
Step 2: Build the Power Supply
This is a straight-forward power supply, following the schematic provided in the datasheet for the LM7812. I've added a PTC (positive temperature coefficient) to ensure the circuit doesn't draw too much current. When I first prototyped this, I used an LM317 configured to output 8V. However, the voltage regulator got too hot, and the PTC kicked in. So, I switched to instead using the 7812, which has held up much better. If your project seems to power on and off quickly, it's most likely because you've wired something wrong, and the PTC is heating up and cooling off, causing the power lapses. If you need further help with your power supply, I highly recommend Sparkfun's tutorial: http://www.sparkfun.com/tutorials/57 . The LED is completely optional. I like to have one to get that positive feedback that current is flowing.
Step 3: Wire Up the DB25 Connector
The iRobot Create open interface specification details the pinout for the cargo connector that we'll be hooking into. Pins 10, 11 and 12 are switched VPWR, which means they provide power when the iRobot Create is powered on. I chose to use switched VPWR because it can provide up to 1.5A. Since the ADK needs to provide .5A to the phone, I didn't think the .5A provided on the other power connections would suffice. You can solder up a connection to any one of the 3 pins listed above. For ground, I chose to wire up pin 15, which is the first pin on the bottom (shorter) row.
We also need to wire up serial communications between the iRobot Create and the ADK board. For this, solder wires to pins 1 and 2.
Step 4: Solder the Power Plug
The power plug will connect from the breadboard's power rails to the ADK barrel jack. The Arduino specifications state that supplied power should be between 7 and 12 volts. Our voltage regulator will give a constant ~12V through this connector. The connector cover should screw off. You can then solder the wires to the two leads. The tip of the connector is positive, so check with your multimeter's continuity setting to ensure you solder your red and black wires to the right places! Try to solder the wires to the insides of the connector, otherwise it will be difficult to screw the black cover back on.
Step 5: Connect the Power Supply
Plug the 25pin connector into the iRobot Create's cargo bay connector. Take the switched vpwr wire and connect it to the input to the power supply circuit. This is the red wire that goes to the switch. Next, connect ground to the ground rail on the breadboard. We'll also hook the barrel connector into the power and ground rails now.
Step 6: Verify the Power Supply
Now it's time to ensure that we're getting the right voltages! I used my multimeter's aligator probes and a couple of hookup wires to ensure I was getting the right voltages. First, hook the red wire up to the input source. The black probe will be hooked up to ground for both tests. As you can see in the picture, we get a reading of 16V. Next, hook the red wire up to the power rail on the breadboard. You should now see a reading of ~12V (11.9 in my case). Congratulations, you can now hook up the ADK!
Step 7: Connect the Serial Lines
I wired up the red wire to the iRobot Create's RX pin (pin 1). This wire, then, needs to be connected to the ADK's TX pin. I'm using Serial2 in the code, so we'll wire it up to TX2. The other wire goes to RX2, of course.
Step 8: Load the Code Onto the ADK Board
Now that we have a powered up arduino, we can program it to do our bidding! Verify (compile) and upload the attached pde to your ADK. Programming is done via the smaller (mini) connector on the ADK.
The ADK and the Android app running on the cell phone communicate via a protocol that the application writer designs. In our case, we'll start with a very basic, character-based protocol that will allow us to provide the following commands:
The simple character protocol is translated by the arduino firmware into the appropriate iRobot Open Interface command. I've leveraged the Roomba arduino library, written by Mike McCauley.
Step 9: Install the Android App
Connect your phone to your computer via the USB cable and run:
adb install adk_moto.apk
For those wishing to modify the code, I've included a tarball of the sources.
Step 10: Try It Out!
The power on sequence is persnickety. First, ensure that the power switch on the breadboard power supply is set to the off position. Power on the iRobot Create. Once it's initialized (after the beep), power on the adk using the switch. It should play an ascending chromatic scale of notes to let you know it was successful. Finally, connect up the phone using the USB cable. Again, you'll hear a satisfying ascending pair of notes to let you know it is working. You will be prompted to run the adk_moto application when the phone is plugged in. You can check the box to always associate this application with this accessory. Now, you can speak to the robot, using one of the following voice commands:
dock (This runs the built-in cover and dock demo.)
whistle while you work (if you like sing-alongs ;-)
The possibilities for expanding on this are pretty much endless. There is a bit of a time delay between saying a command and getting a response. This is due to the fact that the voice recognition processing is done on google's servers (which means you need an internet connection for this to work). Next up, I'm going to add more sensors (heading towards a turtle bot), and continue to use the phone for the voice input, and harness some of the other sensors the phone provides (such as camera, accelerometer, gyroscope, etc).
In all, this was a fun project, and an easy way to get started in robotics. Let me know if any of the steps need clarification.
We have a be nice policy.
Please be positive and constructive.