I’ve never been an Apple fan. Sure, it works for some, but the closed approach has just never sat well with me. One thing that Apple does well, however, is accessory integration, and for years now, I’ve sat back as I’ve seen wave after wave of Apple-compatible home stereos, car stereos, boomboxes, toasters, and refrigerators come marching down the assembly line. Well, no more, fellow Android-users, as Google has announced the Android Open Accessory Development Kit (or ADK), available for developers who want to offer accessory integration for Android devices. Google’s demonstration at Google I/O today involved an exercise bike, so versatility is definitely on the menu for the ADK. Before you get too excited however, be aware that the service will be limited to Gingerbread 2.3.4 and Honeycomb 3.1, and right out of the gate it will be limited to USB with Bluetooth integration planned in the future. This latter part is great news as darn it all if I don’t want a Google Talk based Dick Tracy video watch. Full press release after the break!
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
- 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
- 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
- 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/AndroidAccessorydirectory. 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