Android adk with a standard Arduino UNO and USB Host Shield

Source: Internet
Author: User
Android adk with a standard Arduino UNO and USB Host shield a few weeks have past since my last post and a lot was going on. First off how great was Google io? I Hadn't the chance to participant ipate personally but I watched a lot of sessions online and was amazed of what Google had up its sleeve. new APIs, services, best programming practices but most importantly a lot of great talks about Android. as a software and hardware tinkerer I was gglad to hear that Google pushes into the direction of the Internet of Things. with the upcoming project Android @ Home and the introduction of the accessory Development Kit (adk), Google showed some future outlook into their Internet of Things strategy.

here is the link for the keynote of day one where they announced the adk, and the dedicated adk Session, in case you missed one of them.

so what was done to support hardware communication? With Android 3.1 and Android 2.3.4 Google implemented USB APIs to communicate with accessories via USB. the Android devices operate in USB slave mode so that the accessories need to provide USB Host capabilities. to demonstrate what is possible when your device communicates with external hardware, Google developed a reference demo board and released it as open source. they based their reference board on the Arduino which is really great, because it is widely spread in the open hardware community. their example firmware and Android software is based on their reference board to show what kind of sensors and actuators are easily accessible. so if you attended the Google Io and got your reference board on site, that's great news for you. you coshould just dive right in and tinker with it.

Unfortunately not everyone cocould get a ticket (Me neither), so those developers have to wait for compatible hardware boards being distributed some time at the end of the year, or they cocould order one from the Japanese Company Which produced them for the Google Io. Unfortunately they are very pricey and cost about 400 $.

Soon after hearing that I decided to port the firmware and software to my basic Arduino UNO and my USB Host shield. It is no suprise that I wasn' t the only one who did that.

So if you have the Arduino UNO and a USB Host shield lying around you might just want to give the adk a try.
The cool thing about it is that you register a USB broadcast receiver er on your device that can be automatically detect when the device is connected to your board and start up the corresponding application.

Here the steps I took to make my setup work with the adk:

  1. Read and understand the adk Section In the Android Developers guide.
  2. Follow the installation process.
  3. Don't use Googles usb_host_shield library. I used a patched version which I found   Here.   If you are having trouble compiling the demokit. PVDF it may result from a wrong pin definition in the patched usb_host_shield library. Just open the max3421e. cpp file and change   # Define int PB1   To   # Define int portb1   And # Define rst pd7   To   # Define rst portd7 . You might also try to use the newlyreleased   Original version of the usb_host_shield library which now supports the adk, but I don't know if it works.
  4. Strip down the demokit. PVDF to its bare essen, meaning only the communication part.
  5. Strip down the example Android app to the communication part and implement your own use cases.

To make it a bit easier I provided my example Android app and my stripped down version of the demokit. pdat GitHub. feel free to play around with it. note that my approach wocould be considered as a temporary hack or proof concept rather than a good solution of the porting problem. so when new versions of the adk will be released you wowould have to modify them again which wowould be painful.

Here is a quick demo of controlling the digital pins 2-7 in output pinmode:

As promising as the adk is right now, I have a problem with having to connect my device via cable to the accessory. the future of the Internet of Things will be wireless, so as long as there are no Android devices which support a ZigBee like protocol, I will use my Arduino/Android WiFi approach which you might remember from Post In the past.

That being said...
I can't wait for Android @ home at my home ;).

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.