10. Background & Concepts
● No standard protocol / API
● Only selected devices
● Only selected developers
11. ● Android Open Accessory(AOA) support
○ From 3.1, Back-ported to 2.3.4
○ USB api
○ AOA protocol
○ ADK
Background & Concepts
12. ● Android Open Accessory(AOA) support
○ Standard
○ Any developer can develop
○ Works on every AOA supporting Android device
Background & Concepts
13. ● AOA 2.0 protocol & ADK 2012
○ Announced from Google IO 2012
○ Connection via Bluetooth
○ Audio output
○ HID accessory support
○ From JellyBean(4.1)
Background & Concepts
15. AOA protocol
Is in accessory mode?
(show vendor id, product id)
Support AOA?
(GET_PROTOCOL)
Start accessory mode
(ACCESSORY_START)
Establish connection
Bad
ending
:'(
YES
NO
YES
NO
16. USB API
App can communicate with USB devices
● Host mode
○ From 3.1
● Accessory mode
○ Back ported to 2.3.4(Google APIs add-on library)
17. USB API
● Notify connected device using intent
● Can enumerates connected devices
● Request permission to user
● Can interact using I/O Stream like file
18. ADK - components
● Sample USB api using application(DemoKit)
● Sample sketch for ADK using AOA(demokit)
● AOA protocol implementation library
● Arduino-USB control library
● ADK H/W design
19. ADK - impl of AOA protocol
AndroidAccessory class
20. ADK - impl of AOA protocol
isConnected : start point
21. ADK - impl of AOA protocol
Is in accessory mode?
22. ADK - impl of AOA protocol
Do you support AOA?
23. ADK - impl of AOA protocol
I am...; Start accessory mode.
41. Just do it - 2. Let's make simple AOA
ADK Install
● Download ADK and extract
42. Just do it - 2. Let's make simple AOA
ADK Install
On Windows:
1. Copy the arduino_libs/AndroidAccessory and
arduino_libs/USB_Host_Shield directories (the
complete directories, not just the files within) to the
<arduino_installation_root>/libraries/
directory.
43. Just do it - 2. Let's make simple AOA
ADK Install
On Mac:
1. Create, if it does not already exist, an Arduino directory
inside your user account's Documents directory, and
within that, a libraries directory.
2. Copy the arduino_libs/AndroidAccessory and
arduino_libs/USB_Host_Shield directories (the
complete directories, not just the files within) to your
Documents/Arduino/libraries/ directory.
44. Just do it - 2. Let's make simple AOA
ADK Install
On Linux (Ubuntu):
1. Copy the firmware/arduino_libs/AndroidAccessory
and
firmware/arduino_libs/USB_Host_Shielddirectories
(the complete directories, not just the files within) to
the<arduino_installation_root>/libraries/
directory.
2. Install the avr-libc library by entering sudo apt-get
install avr-libc from a shell prompt.
45. Just do it - 2. Let's make simple AOA
To debug Arduino
1. Serial.begin(<baud-rate>)
2. Serial.println("This is debug message.")
46. Just do it - 2. Let's make simple AOA
To debug Android device without USB
1. $ adb tcpip 5555
2. $ adb connect <device-ip>:5555
3. $ adb logcat
4. $ adb usb
But, looks doesn't works well...
47. Just do it - 2. Let's make simple AOA
● For IP Confirm,
○ Wifi settings > Option menu > Advanced
48. Just do it - 2. Let's make simple AOA
● example code
○ example/ADKMiniHack
■ Change project build target to Google APIs 10
○ example/Sketch
49. Just do it - 2. Let's make simple AOA
● OSCOKIRQ failed to assert
○ Problem occurs from ADK USB library's Max3421e.
○ Below is workaround for this from discussion
50. Let the hacking begin
: Suggested misson
● Clavier that Input from phone screen, Output
to Arduino
○ Turn on/off LED for each keys
○ Blink RGB led for each keys
○ Turn off when it's too dark(night)
○ Make tones higher with analog dialer
52. This work by SeongJae Park is licensed under the
Creative Commons Attribution-ShareAlike 3.0 Unported
License. To view a copy of this license, visit http:
//creativecommons.org/licenses/by-sa/3.0/.