Android Open Accessory Mode

Android Open Accessory Mode is a feature of Android OS 3.1 (back portable to version 2.3.4) whereby an external USB host controller may enumerate the Android USB peripheral port and create a two way data port to allow external hardware to control the Android platform or for the Android platform to control external hardware. A typical application may be buttons, LEDs, or joystick as found on a games controller.

For more information on Open Accessory Mode in Android platforms see: https://developer.android.com/guide/topics/connectivity/usb/accessory.html

FTDI offer a solution for connecting to the Open Accessory Mode via the Vinculum-II device. Examples may be found on this page.

Example 1 - Buttons and LEDs Controller

In this example the Vinculum-II evaluation board (V2EVAL) is used to communicate with an Android platform via the Vinculum-II USB host port 1.

VNC2 GPIO lines are used to drive LEDs in response to commands from the application running on the Android platform and to read other GPIO lines in response to button presses on the V2EVAL hardware to control software LEDs in the Arduino application.

A fifth LED will flash at a variable rate as a slider on the Android application controls the VNC2 PWM interface.

This gives the appearance of an LED dimmer switch.

Source code and a precompiled ROM file for running on the Vinculum-II may be downloaded from here:

https://www.ftdichip.com/Support/SoftwareExamples/Android/vinco_android_acc.zip

Source code and a precompiled application file to run on the Android platform may be downloaded from here:

https://www.ftdichip.com/Support/SoftwareExamples/Android/android_acc_appl.zip

For more information on the project see: AN_181_ Accessing Android Open Accessory Mode with Vinculum-II

Example 2 – Collection of FT31xD Demo Applications

The Android.zip file contains seven Android Open Accessory Demo applications for use with the FT311D and FT312D (note only UART apps apply to FT312D). The zipped file contains both source code and the compiled .apk

  • GPIODemoActivity.apk

A demonstration to show the Android device reading / writing GPIO lines on the FT311D.

  • UARTTestActivity.apk

A demonstration to show the Android device streaming data via the FT311D/FT312D UART port.

  • UARTLoopbackActivity.apk

A demonstration to show the Android device reading and writing data via the FT311D/FT312D UART port.

  • PWMDemoActivity.apk

A demonstration to show the Android device writing PWM waveforms on the 4 PWM channels of the FT311D.

  • I2CDemoActivity.apk

A demonstration to show the Android device reading and writing data via the FT311D I2C host.

  • SPIMasterDemoActivity.apk

A demonstration to show the Android device reading and writing data via the FT311D SPI host.

  • SPISlaveDemoActivity.apk

A demonstration to show the Android device reading and writing data via the FT311D SPI slave.

Also included in the Android.zip file are projects for the robotic arm and slider demos featured in our Android video.

For more information on the projects see: AN_208 FT311/FT312D Demo APK User Guide

White Paper

FTDI’s Senior Application Engineer, Gordon Lunn, has written a whitepaper entitled ‘Connecting Peripherals to an Android Platform’. It describes how to connect peripheral accessories to Android OS based tablets and phones, including the Android Open Accessory Initiative. To read this whitepaper on our Android page, please click here.