Google is moving right along as it just announced the Android Open Accessory Development Kit, which basically allows developers to create apps that will interface with accessories. Apple has been doing this for quite some time now with the iPhone and iOS, sort of like apps that work with dedicated accessories like Nike’s embedded chip in its running shoes, and now Android is in the game. The demo we saw at Google I/O showed an Android smartphone working in conjunction with an exercise bike, so clearly the possibilities here are pretty wide in range.
The Open Accessory API is available on Gingerbread 2.3.4 and Honeycomb 3.1, so you developers out there who have been waiting for an opportunity like this can jump right on it. Below are further details on the new accessory dev kit:
Android Open Accessory Development Kit
The Android 3.1 platform (also backported to Android 2.3.4) introduces Android Open Accessory support, which allows external USB hardware (an Android USB accessory) to interact with an Android-powered device in a special “accessory” mode. When an Android-powered powered device is in accessory mode, the connected accessory acts as the USB host (powers the bus and enumerates devices) and the Android-powered device acts as the device. Android USB accessories are specifically designed to attach to Android-powered devices and adhere to a simple protocol (Android accessory protocol) that allows them to detect Android-powered devices that support accessory mode. Accessories must also provide 500mA at 5V for charging power. Many previously released Android-powered devices are only capable of acting as a USB device and cannot initiate connections with external USB devices. Android Open Accessory support overcomes this limitation and allows you to build accessories that can interact with an assortment of Android-powered devices by allowing the accessory initiate the connection.
Note: Accessory mode is ultimately dependent on the device’s hardware and not all devices will support accessory mode. Devices that support accessory mode can be filtered using a
<uses-feature>
element in your corresponding application’s Android manifest. For more information, see the USB Accessory Developer Guide.The Android Open Accessory Development Kit (ADK) provides an implementation of an Android USB accessory that is based on the Arduino open source electronics prototyping platform, the accessory’s hardware design files, code that implements the accessory’s firmware, and the Android application that interacts with the accessory. The hardware design files and code are contained in the ADK package download. You can buy the hardware components of the ADK if you do not already have them. The main hardware and software components of the ADK include:
- A USB micro-controller board that is based on the Arduino Mega2560 and Circuits@Home USB Host Shield designs (now referred to as the ADK board), which you will later implement as an Android USB accessory. The ADK board provides input and output pins that you can implement through the use of attachments called “shields.” Custom firmware, written in C++, is installed on the board to define the board’s functionality and interaction with the attached shield and Android-powered device. The hardware design files for the board are located in
hardware/
directory.- An Android Demo Shield (ADK shield) that affixes atop the ADK board implements the input and output points on the board. These implementations include a joystick, LED outputs, and temperature and light sensors. You can create or buy your own shields or wire your own features to the ADK board to implement custom functionality. The hardware design files for the shield are located in
hardware/
.- A library based on the Arduino USB Host Shield library provides the logic for the USB micro-controller board to act as a USB Host. This allows the board to initiate transactions with USB devices. Describing how to use this entire library is out of the scope of this document. Where needed, this document points out important interactions with the library. For more information, see the source code for the Arduino USB Host Shield library in the
firmware/arduino_libs/USB_Host_Shield
directory.- An Arduino sketch,
firmware/demokit/demokit.pde
, defines the firmware that runs on the ADK board and is written in C++. The sketch calls the Android accessory protocol library to interact with the Android-powered device. It also sends data from the ADK board and shield to the Android application and receives data from the Android application and outputs it to the ADK board and shield.- The Android accessory protocol library, which is located in the
firmware/arduino_libs/AndroidAccessory
directory. This library defines how to enumerate the bus, find a connected Android-powered device that supports accessory mode, and how to setup communication with the device.- Other third party libraries to support the ADK board’s functionality:
- An Android application, DemoKit, that communicates with the ADK board and shield. The source for this project is in the
app/
directory.