Subscribe to Make Magazine Today!

demokitservo Adventures in Android ADK Development: Hardware

At this point in my Android saga, I’ve gotten the Android SDK and Eclipse all running well enough to run a Hello World in the Android emulator. This is an important step, but I want more. I want it running on real hardware! In this case, a Nexus One phone.

I installed a system update to bring the phone up to snuff, specifically to OS version 2.3.4 (Gingerbread). The ADK and USB host functionality requires 2.3.4 or later. Using the steps in this guide, I set up the phone for development mode. The key steps are to set the phone’s Applications > Development mode to “USB debugging”, and to set the “Debuggable” flag to “true” in the AndroidManifest.xml file for the HelloWorld program in Eclipse.

Now, when I ran the HelloWorld from Eclipse, instead of launching the emulator, it uploaded and ran the app on the phone. This went without a hitch, so I decided it was time to move on to working with the ADK.

Again, the Android Developer website has excellent info on installing what you need to use the ADK. First up, I made sure I had the Arduino IDE 22 installed, then I downloaded and unpacked the ADK package which contains a few necessary Arduino libraries (for the USB host functionality, Open Acessory Protocol library, and CapSense library to register when you touch the little gold Android robot on the demo shield), a DemoKit Android app, and a corresponding DemoKit Arduino sketch. The download also includes all the fabrication files for the ADK board and demo shield, in case you’re curious or want to roll your own. I uploaded the DemoKit.pde sketch onto the ADK Arduino using the Arduino software.

Before I could compile and run the Android DemoKit application, it was necessary to install the Google APIs Level 10 add-on library. This part tripped me up, because when I went to the Android SDK and AVD Manager in Eclipse I mistook the SDK Platform API 10 (which I already had) for the Google APIs Android API 10, which I needed. I also had to set the Eclipse project to build with the Google API target, NOT the Android target platform. The DemoKit application threw loads of errors until the Internet helped me figure that one out. (There may have been cursing and throwing of objects, I’m not telling.)

api10 Adventures in Android ADK Development: Hardware

api10build Adventures in Android ADK Development: Hardware

Once that was behind me, I was able to set the DemoKit application to “debuggable” and run it on the phone! I couldn’t plug the Arduino into the phone while uploading the Android app, so it kicked up this groovy image.

pleaseconnectadk01 Adventures in Android ADK Development: Hardware

(Incidentally, I found this nifty way to take screenshots of the phone onto my computer at Android Central.)

With my excitement mounting, I unplugged the phone’s USB cable from my computer and into the ADK Arduino board, which is powered by a 12V wall wart. I launched the DemoKit app from the phone and everything worked! The app has two modes, input and output. The input mode displays data from the Demo Shield on the phone, including the temperature and light sensor data as well as the two axis joystick, three buttons, and the capacitive robot pads.

demokitinput Adventures in Android ADK Development: Hardware

Output mode allows you to use sliders to light up and color mix three (seriously bright) RGB LEDs, control three servos and tap on-screen buttons to open and close two 12V relays.

demokitoutput Adventures in Android ADK Development: Hardware

I had a lot of fun playing around with the DemoKit app, mixing light colors, blinding myself, flipping the relays, and checking out the input data on the Nexus One’s lovely screen. I’m sure there are many, many possibilities for writing Android apps that will utilize the ADK hardware in mind-blowing ways, but for now, I’m pretty excited just having such a nice touchscreen interface to an Arduino.

Here’s a video showing me using a converted continuous rotation servo on the board, as well as playing with the LEDs.

John Edgar Park

John Edgar Park likes to make things and tell people about it. He works in CG animation at DisneyToon Studios and writes for Make, Boing Boing, and other places online and in print. You can find him at and twitter @johnedgarpark — if you like that sort of thing.

blog comments powered by Disqus

Related Supplies at Maker Shed


Get every new post delivered to your Inbox.

Join 29,168 other followers