Hacktime for adk

425
-1

Published on

Describe about ADK and Arduino, How to use them.

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
425
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
0
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Hacktime for adk

  1. 1. Hacktime for ADK SeongJae Park <sj38.park@gmail.com>
  2. 2. Great to meet you SeongJae Park <sj38.park@gmail.com> A member of GDG Suwon Newbie to Arduino Let's enjoy hacking
  3. 3. Just do it - 1:Let's hack Arduino Download and install IDE, Arduino 1.0 If Mac, install FTDI USB driver(Link)
  4. 4. Just do it - 1:How to hack Arduino Let's blink led on Arduino board
  5. 5. Just do it - 1:How to hack Arduino Let's blink led on breadboard
  6. 6. Just do it - 1:How to hack Arduino Let's blink led on breadboard
  7. 7. Just do it - 1:How to hack Arduino 5V Ground 300 Ohm LED Ground 300 Ohm 5V
  8. 8. Background & Concepts Android accessories
  9. 9. Background & Concepts Android accessories
  10. 10. Background & Concepts ● No standard protocol / API ● Only selected devices ● Only selected developers
  11. 11. ● Android Open Accessory(AOA) support ○ From 3.1, Back-ported to 2.3.4 ○ USB api ○ AOA protocol ○ ADK Background & Concepts
  12. 12. ● Android Open Accessory(AOA) support ○ Standard ○ Any developer can develop ○ Works on every AOA supporting Android device Background & Concepts
  13. 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
  14. 14. AOA support structure overview AOA protocol USB api Application
  15. 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. 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. 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. 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. 19. ADK - impl of AOA protocol AndroidAccessory class
  20. 20. ADK - impl of AOA protocol isConnected : start point
  21. 21. ADK - impl of AOA protocol Is in accessory mode?
  22. 22. ADK - impl of AOA protocol Do you support AOA?
  23. 23. ADK - impl of AOA protocol I am...; Start accessory mode.
  24. 24. Establish connection Find end points, set configuration 1
  25. 25. ADK - impl of AOA protocol End points usage
  26. 26. Sample sketch using ADK adkminihack
  27. 27. Sample sketch using ADK New AndroidAccessory
  28. 28. Sample sketch using ADK init and power on
  29. 29. Sample sketch using ADK Connect, listen, echo
  30. 30. Sample app using USB api ADKMiniHack
  31. 31. Sample app using USB api Feature, Library, Intent filter
  32. 32. Sample app using USB api accessory_filter.xml
  33. 33. Sample app using USB api ● "com.android.future.usb" for gingerbread ● "android.hardware.usb" for only 3.1 or upper
  34. 34. Sample app using USB api Get UsbManager and Enumerate accessories Request Permission
  35. 35. Sample app using USB api Open accessory
  36. 36. Sample app using USB api File-like interface
  37. 37. Sample app using USB api Listening, too.
  38. 38. Sample app using USB api Clean up when accessory detached.
  39. 39. Sample source codes ● Downloadable from github
  40. 40. Just do it - 2. Let's make simple AOA
  41. 41. Just do it - 2. Let's make simple AOA ADK Install ● Download ADK and extract
  42. 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. 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. 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. 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. 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. 47. Just do it - 2. Let's make simple AOA ● For IP Confirm, ○ Wifi settings > Option menu > Advanced
  48. 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. 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. 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
  51. 51. Let the hacking begin : Sample
  52. 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/.

×