
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.)
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.
(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.
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.
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.
46 thoughts on “Adventures in Android ADK Development: Hardware”
Comments are closed.
When you have Eclipse and the Android plugin configured already then you can find the screenshot button directly in the DDMS perspective.
Very cool, now I see it. Thanks for pointing it out, much simpler.
Well this is all and good, but suppose we are not planning on using that nearly impossible to obtain ADK gizmo? FTDI makes one that looks to be infinitely better.
Oh and whose phone are you using for this adventure?
The same APIs work on a regular Arduino plus USB Host Shield. See, for example:
http://marioboehmer.blogspot.com/2011/05/android-adk-with-standard-arduino-uno.html
The same APIs work on a regular Arduino plus USB Host Shield. See, for example:
http://marioboehmer.blogspot.com/2011/05/android-adk-with-standard-arduino-uno.html
Hey I am selling my ADK from Google I/O… never been used and I don’t dev around hardware. Let me know if anyone is interested. Email me at thepeacedout at gmail dot com or shoot me a tweet at ThePeacedOut … I only have one so it might go fast!
Pardon me! I didn’t see that line about the phone itself at first.
Hi… play this competition and get a chance to win goods
worth 2000 as well as self designed t shirt…. Come play with us…
http://www.ilogo.org
Hello, excuse my ignorance, but this board is only used for development?. If you create an accessory to interact with android, you must purchase one of these boards for each accessory you make?
Hello, excuse my ignorance, but this board is only used for development?. If you create an accessory to interact with android, you must purchase one of these boards for each accessory you make?
Hello, excuse my ignorance, but this board is only used for development?. If you create an accessory to interact with android, you must purchase one of these boards for each accessory you make?
Hello, excuse my ignorance, but this board is only used for development?. If you create an accessory to interact with android, you must purchase one of these boards for each accessory you make?
Hi, the general idea is to develop your accessory with this dev board and then engineer a much cheaper device that only contains the exact parts you need. This is the idea with Arduino, PIC, and most other microcontrollers. With an Arduino dev board, for example, you could test things out on the board, upload the code to the Atmel chip, pop the chip out, and then build a minimal product around that chip, removing any unnecessary, costly components.
Would i be possible to design a custom app to use android to control a arduino device that connects over BT rather than USB? If you developed using this board?
Would i be possible to design a custom app to use android to control a arduino device that connects over BT rather than USB? If you developed using this board?
Hi, the general idea is to develop your accessory with this dev board and then engineer a much cheaper device that only contains the exact parts you need. This is the idea with Arduino, PIC, and most other microcontrollers. With an Arduino dev board, for example, you could test things out on the board, upload the code to the Atmel chip, pop the chip out, and then build a minimal product around that chip, removing any unnecessary, costly components.
sweet! :P
[2011-08-28 15:09:54 – DemoKitLaunch] Installation error: INSTALL_FAILED_MISSING_SHARED_LIBRARY
[2011-08-28 15:09:54 – DemoKitLaunch] Please check logcat output for more details.
[2011-08-28 15:09:56 – DemoKitLaunch] Launch canceled!
I am doing as yours as mine
Run in Emulator can install it but when I run on my android 2.3.4 device ,eclipse had those error
I check in internet but all about google map and USB error
I try to that but it still wrong I can’t fix this error is anyone can kill it?TIA
Exactly the same problem here. I can run the demo kit on the emulator but cannot install to connected phone. I have installed other apps from eclipse to phone. Trying to install on a Samsung Galaxy 5 with cyanogenmod 2.3.5. What phone are you using?
Did you ever try using the relay terminals? Are they even enabled? It seems like they should be, but I can’t pull volts off of either no or nc. Are the pins different for the relay terminal than what is configured for the led?
My demokit app just sits there saying “please connect a..” even tho it is connected to my arduino mega adk with the demokit sketch running. Help!
It seems to only work on google 1 , google s, and motorola xoom, Not sure about the galaxy nexus.
I’ve only got beyond the “please connect a device…” messages on my xoom when I have a usb connected from my pc to the adk ( in addition to the usb from the xoom to the adk).
When I try to power the adk with battery (instead of over usb from my pc) , it does not get past the “please connect a device…” message. I think DemoKit is waiting on a connection to a pc to do debugging which holds up the rest of the program.
Anyone know of a simple hello world example instead of DemoKit?
You can connect Arduino with any java application as I believe. Check this tutorial: http://www.whatisarduino.org/bin/Tutorials/Java+Serial+API+and+Arduino
What’s so special about connecting Andriod and Arduino (not wireless). I believe it is poinless!!