ADKã¨Arduinoã®ä½¿ããã
å
æã®è¨äºã«ç¶ãã«ã¤ãã¦ADK-demoãã¼ãã®ä½¿ãããã¨AndroidAccessoryãã¢ã¢ããªã®ãã«ãæ¹æ³ã«ã¤ãã¦ã¬ãã¼ããããã¾ãã
â Android Accessoryã¨ã¯
ä»å¹´ï¼æã«googleããçºè¡¨ãããAndroidãã¼ãã¦ã§ã¢æ¡å¼µè¦æ ¼ã®ãã¨ã§ãã
詳ããæ
å ±ã¯ãã¡ããåç
§ãã¦ãã ããã
ãhttp://developer.android.com/guide/topics/usb/adk.html
ä»åã¯googleã§å
¬éããã¦ããã½ã¼ã¹ã³ã¼ãã使ç¨ãã¾ããã
ãhttps://dl-ssl.google.com/android/adk/adk_release_0512.zip
â Android Accessoryã®é¢ç½ãã¨ãã
ä¸è¬çã«ãã¼ãã¦ã§ã¢ã®æ¡å¼µã¨ããã°USBã«å¨è¾ºæ©å¨ãæ¥ç¶ããã¨ããã¤ã¡ã¼ã¸ãããã¾ãã
Android Accessoryã¯ããªãã¨å¤é¨è£
ç½®ãUSBãã¹ãã§Android端æ«ãå¨è¾ºæ©å¨ã¨ãã¦æ¯èãã¾ãã
ãã®æ¹å¼ãåãã¡ãªããã¨ãã¦ã¯ã¹ãã¼ããã©ã³ã®ããã«é»åçã«éåãªããã¤ã¹ãã
å¤é¨ã¸é»åä¾çµ¦ããããã¨ãªããå¤é¨ããé»åä¾çµ¦ãåããªããåæ°¸ä¹
çã«åä½ããããã¨ã
ã§ãããã¨ã§ããã¾ããã¬ã¼ã ã¯ã¼ã¯å±¤ã§ãã¼ãã¦ã§ã¢/ãã©ã¤ããé è½ãã¦ããã¦ãããã¨ãã
é£ãããã©ã¤ããªã©ãæ¸ããªãã¦ãå¤é¨æ©å¨ãæ¥ç¶ã§ããã¡ãªãããããã¾ãã
ï¼ï¼Android Accessoryãå®ç¾ããããã®ãã¼ãã¦ã§ã¢
å½åAndroid Accessoryã¯Arduinoããã¼ã¹ã¨ããå®è£
ã¨ãã¦çºè¡¨ããã¾ããã
æè¿ã«ãªã£ã¦Arduinoãç¨ããªãADK対å¿ãã¼ããããã¤ãåºã¦ãã¦ããããã§ãã
ä»åã¯ADKã®åºæ¬ãç¥ãããã«ãArduinoããã¼ã¹ã«ãããã®ãç¨ãããã¨ã«ãã¾ããã
Arduinoãç¨ããADKãå®ç¾ããã¢ããã¼ãã¨ãã¦æ¬¡ã®ãããªãã®ãããã¾ãã
ãa) RT-ADKãã¼ã
ãb) Arduino ADKãã¼ã
ãc) Arduino MEGA 256 + USB HOST Shield 2.0
d) Arduino uno + SparkFun USB HOST Shield
RT-ADKãã¼ãã¨ãµããã¼ã
RT-ADKãã¼ãã¯Googleã®ãã´ãä»ãã¦ãã¦ãæã£ã¦ãã¦å¬ããåºæ¿ã§ã¯ããã¾ãã
ã¡ãã£ã¨å
¥æã大å¤ãªãã¨ããããä»åã¯æ¬å®¶Arduinoãåºãã¦ããArduino ADKãã¼ãã§ã®
使ç¨æ¹æ³ãä½µãã¦è¨è¼ãããã¾ãã
âArduino USBã·ã¼ã«ãã¨ADKãã¼ãã®éãã«ã¤ãã¦
ãªãªã¸ãã«ã®USB HOSTã¯ã·ã¼ã«ãã¨ããå½¢ã§æ¡å¼µãããããã«ãªã£ã¦ãã¾ãã
RT-ADKãã¼ãã¨Arduino ADKã§ã¯ã·ã¼ã«ãæ¥ç¶ç¨ã®ä¿¡å·ã温åããããã«
USBåè·¯ã®æ¥ç¶ã«Arduinoéäºæã®ä¿¡å·ã使ã£ã¦ãã¾ãã
ãã®ããæ¬å®¶ USB HOSTã·ã¼ã«ãã®ã©ã¤ãã©ãªããã®ã¾ã¾ä½¿ããã¨ãã§ãã¾ãã
ã¡ãã£ã¨å¤ãã§ããæåã®ãã¡ã¯ADK Packageé
å¸ã«å«ã¾ãã¦ããã©ã¤ãã©ãªã使ãããã«ãã¦ãã ããã
ã©ããã¦ãæ°ãããã®ã使ãããæ¹ã¯æ¬¡ã®ãã³å²ãå½ã¦ãæ¸ãæããã°ä½¿ããããã«ãªãã¯ãã§ãã
ãINT GPIO_9 -> ATMEGA2560(PE6)
ãRST GPIO_8 -> ATMEGA2560(PJ2)
ãGPX GPIO_7 -> ATMEGA2560(PJ3)
1-1ï¼ãã¼ã«ã¨ã©ã¤ãã©ãªã®æºå
ADKã§å¿
è¦ã¨ãªãArduinoã®éçºç°å¢ã¯æ¬¡ã®ããã«ã¤ã³ã¹ãã¼ã«ãè¡ãå¿
è¦ãããã¾ãã
ã»Arduinoã½ããã¦ã§ã¢
Arduinoãåããããã®åºæ¬ãã¼ã«ã¯æ¬¡ã®å ´æããå
¥æãããã¨ãã§ãã¾ãã
ãhttp://arduino.cc/en/Main/Software
ããã§ã¯9/20æç¹ã§ææ°çã§ããArduino 0022 ã使ç¨ãã¦ãã¾ãã
arduino-0022.zipããã¦ã³ãã¼ãããä»»æã®ãã©ã«ãã«å±éãã¾ãã
ãã®ãã¼ã«ã¯ä»»æã®ãã©ã«ãããèµ·åã§ããã®ã§å¤é¨ãã©ã¤ãã«å±éãã¦ã使ç¨ãããã¨ãã§ãã¾ãã
ä»åã¯G:\ã«å±éãããã®ã¨ãã¦è¨è¼ãã¦ãã¾ãã
ã»Arduino ADK追å ãã¡ã¤ã«
Arduino ADKã使ãããã«å¿
è¦ãªè¿½å ãã¡ã¤ã«ã¯æ¬¡ã®å ´æã«å
¬éããã¦ãã¾ãã
ãªããã®è¿½å ãã¡ã¤ã«ã¯RT-ADKãunoã«ã¯å¿
è¦ããã¾ããã
http://www.arduino.cc/en/Main/ArduinoBoardADK
ä¸çªä¸ã«Windowsãã©ã¤ãã®infãã¡ã¤ã«ãå
¥ã£ãzipãã¡ã¤ã«ãããã¾ãã®ã§ãã¦ã³ãã¼ããã¦
Arduino MEGA ADK.infãG:\arduino-0022\driversã«ã³ãã¼ãã¦ããã¾ãã
ã»Android Accessoryã©ã¤ãã©ãª
Android Accessoryã§ä½¿ç¨ããã©ã¤ãã©ãªãã¤ã³ã¹ãã¼ã«ãã¾ãã
adk_release_0512.zipãå±éãADK_release_0512\firmware\arduino_libs以ä¸ã«ãã
次ã®ï¼ã¤ã®ãã©ã«ããG:\arduino-0022\librariesã«ã³ãã¼ãã¾ãã
ã»Capacitive Sensingã©ã¤ãã©ãª
RT-ADKãã¼ãã«è¼ã£ã¦ããã¿ããã»ã³ãµã¼ã®ã©ã¤ãã©ãªãã¤ã³ã¹ãã¼ã«ãã¾ãã
ãhttp://www.arduino.cc/playground/Main/CapSense
ããã«å
¬éããã¦ãã CapacitiveSense003.zip ããã¦ã³ãã¼ãã
å±éãããCapacitiveSense003ãã©ã«ããG:\arduino-0022\librariesã«ã³ãã¼ãã¾ãã
1-2. ã¹ã±ããã®ãã«ã
Arduinoã®ä¸çã§ã¯ã½ã¼ã¹ã³ã¼ããã¹ã±ããã¨å¼ã³ã¾ãã
ADKã§é
å¸ããã¦ããã³ã¼ãã«ã¯ã¹ã±ãããå«ã¾ãã¦ãã¾ãã®ã§ãããããã«ããã¦ä½¿ç¨ãã¾ãã
ã¾ãADK_release_0512\firmwareã«ããdemokitãã©ã«ããG:\arduino-0022ã«ã³ãã¼ãã¦ããã¾ãã
arduino.exeãèµ·åå¾ã«File -> Openãå®è¡ã ä¸è¨ã³ãã¼ãããã©ã«ãã«ããdemokit.pdeãéãã¾ãã
次ã«Tools -> Board ã«ã¦ "Arduino Mega 2560"ãé¸æãã¾ãã
Sketch -> Verify Compileãå®è¡ãããã¨ã«ãããã«ããéå§ããã¾ãã
æ£å¸¸ã«ãã«ããããã°ã¹ãã¼ã¿ã¹é¨åã«"Done compiling"ã¨è¡¨ç¤ºããã¾ãã
âArduino ADKã®ã¿ã使ãå ´åã¯
Arduino ADKã«ã¯ RT-ADKã®ä»å±ãµããã¼ãã®ãããªãã®ãããã¾ããã®ã§ãã¬ãããã¼ãã§ä»£ç¨ãã¾ãã
ä»åã¯ãã«ã«ã©ã¼LEDï¼åã¨ã¹ã¤ããï¼åãè¼ãã¦ã¿ã¾ããã
RT-ADKã®ãµããã¼ãã«æ¯ã¹ãã¬ãããã¼ãã«è¼ããåè·¯ã¯ãªããç°¡ç´ ãªãã®ã¨ãªã£ã¦ãããã¨ãã
ADKãªãªã¸ãã«ã½ã¼ã¹ãã次ã®ã³ã¼ããã³ã¡ã³ãã¢ã¦ãããå¿
è¦ãããã¾ãã
ãJoyStick
ãTemp/Light Sensor
ãRelay
ãServoMoter
ãCapacitiveSenser
ä¿®æ£æ¸ã¿ã®ã¹ã±ããã次ã®å ´æã«ç½®ãã¾ããã®ã§ããã¡ããåèã«ãã¦ä¸ããã
https://sites.google.com/a/brilliantservice.co.jp/beagleboard/adk/demokit_ADK.pde?attredirects=0&d=1
1-3. ã¹ã±ããã®ã¢ãããã¼ã
ãã«ããçµãã£ãã¹ã±ãããã¢ãããã¼ãããåã«ãäºãPCã¨Adruinoãæ¥ç¶ãã¦ããã¾ãã
Arduinoãã¼ããæåã«æ¥ç¶ããæã«ã¯ãã©ã¤ããè¦æ±ããã¾ãã®ã§æ¬¡ã®ãã©ã¤ããã¤ã³ã¹ãã¼ã«ãã¦ä¸ããã
RT-ADK -> G:\arduino-0022\drivers\FTDI USB Drivers\
ãArduino ADK -> G:\arduino-0022\drivers\Arduino MEGA ADK.inf
次㫠Tools -> Serial Portã§ãã¼ãã«æ¥ç¶ãã¦ãããã¼ããæå®ãã¾ãã
File -> Upload to I/O board ãå®è¡ããã°ãã«ããããã¹ã±ããããã¼ãã¸è»¢éãã
ADKãã¼ãã¨ãã¦ä½¿ç¨ãããã¨ãã§ãã¾ãã
ï¼ï¼AndroidAccessoryãã¢ã¢ããª(DemoKit)
AndroidAccessoryãåä½ãããããã®ãã¢ã¢ããªã¯Android Open Accessory Development Kit
(adk_release_0512.zip)ã«å«ã¾ãã¦ãã¾ãã
ä»åã¯ãã®ãã¢ã¢ããªã使ã£ã¦åä½ç¢ºèªããã¨ããã¾ã§è¨è¼ãããã¾ãã
ãªããã¨ããããåä½ã ãã¨ããæ¹ã®ããã«ãã«ãæ¸ã¿ã®apkãã¡ã¤ã«ãæºåãã¾ããã
https://sites.google.com/a/brilliantservice.co.jp/beagleboard/adk/DemoKit_singed.apk?attredirects=0&d=1
ç½²åä»ãã«ãã¾ããã®ã§ããã®ã¾ã¾ adb installçã§ã¤ã³ã¹ãã¼ã«ã§ãã¾ãã
â ãããã¯ã¼ã¯è¶ãã®ãããã°
ADKã¯adbã§ä½¿ãããUSBãã¼ããå¡ãã§ãã¾ããããUSBæ¥ç¶ã«ãããããã°ãã§ããªããªãã¾ãã
ããã§æç·LANçµç±ã§adbã使ããããã«ãã¾ãã
ããã§ã¯BeagleBoardã®IPã¢ãã¬ã¹ã192.168.1.23ã¨ãã¦è¨è¼ã¦ãã¾ãã
IPã¢ãã¬ã¹ã¯ä½¿ç¨ããç°å¢ã«åããã¦èªã¿æ¿ãã¦ãã ããã
ã»BeagleBoardå´ã®è¨å®
adbãã¼ã¢ã³ãåæ¢ããã®ã¡ã«adbã®è¨å®åãæ¿ãã¾ãã
ã·ãªã¢ã«ã³ã³ã½ã¼ã«ãã次ã®ããã«å
¥åãã¾ãã
adbdã¯Androidèµ·åæã«USBæ¥ç¶ã¨ãªã£ã¦ãã¾ãã¾ãã®ã§
# stop adbd
# ifconfig usb0 192.168.1.23 up
# setprop service.adb.tcp.port 5555
# start adbd
èµ·åãã¨ã«ä¸è¨ã®æä½ãè¡ãããã«ãã¦ãã ããã
ã»ãã¹ãå´ã®è¨å®
ãã£ããadbãµã¼ããåæ¢ãã¦ãããããã¯ã¼ã¯çµç±ã§æ¥ç¶ãè¡ãã¾ãã
adb kill-server
adb start-server
adb connect 192.168.1.23:5555
æ£å¸¸ã«æ¥ç¶ã§ããã°ãUSBæ¥ç¶ã¨åãããã«"adb"ã"ddms"ã使ã£ã¦ãããã°ãè¡ããã¨ãã§ãã¾ãã
2-1. ã½ã¼ã¹ã³ã¼ãã®æºå
ä»å㯠Android Open Accessory Development Kitã§å
¬éãã¦ããã½ã¼ã¹ã³ã¼ããç¨ãã¾ããã
ããã§é
å¸ããã¦ããADK Package(adk_release_0512.zip)ãD:\workspaceã«å±éãã¾ãã
2-2. Eclipseããã¸ã§ã¯ãã®ä½æ
é
å¸ããã¦ããã½ã¼ã¹ã³ã¼ãã¯ãã®ã¾ã¾ãã«ããããã¨ãã§ããªããã¨ãã
æ°è¦ããã¸ã§ã¯ããä½æãã¤ã¤ã¤ã³ãã¼ãããã¾ãã
Eclipseãèµ·åå¾ File -> New -> Android Projectã§æ°è¦ããã¸ã§ã¯ããä½æãã¾ãã
æ°è¦ããã¸ã§ã¯ãã®ãã¤ã¢ãã°ãåºã¾ãã®ã§æ¬¡ã®é
ç®ãå
¥åãã¦Finishãã¿ã³ãæ¼ãã¾ãã
Project nameã¯ä»»æã®ååã§ãã¾ãã¾ãã
ã"Create project from existing source"ãé¸æã
ã"D:\workspace\adk_release_0512\ADK_rlease_0512\app"ãæå®
Build Targetã¯"Google APIs(2.3.3)"ãé¸æ
â»Android 2.3.4ã®é
ç®ãç¡ãã®ã¯2.3.4çºè¡¨æã«3.0ã®ããã«API Level 11ãå®ç¾©ããã¦ãããã
é©åãªAPI Levelãå²ãå½ã¦ãããªãã£ãããã®ããã§ãã
ãã®ãã2.3.4ã¯2.3.3ï¼Î±ã¨ãã¦æ±ããã¦ãã¾ãã
2-3. ãã«ãããããã°
ADBã®æ¥ç¶ãã§ãã¦ããã°ãã®ã¾ã¾åä½ããããã¨ãã§ãã¾ãã
Targetãã¼ã¸ã§ã³ãä¸è´ãã¦ããªãããè¦åãã¼ã¯ãåºã¾ããåé¡ããã¾ããã
ãã¢ã¢ããªãã¤ã³ã¹ãã¼ã«å¾ã«ADK ãã¼ããæ¥ç¶ããã¨æ¬¡ã®ãããªç»é¢ãåºã¾ãã
ããã§OKã®ãã¿ã³ãæ¼ãã¨ãã¢ã¢ããªãåãåºãã¾ãã
ãã¿ã³ãã¸ã§ã¤ã¹ãã£ãã¯æä½ã«åããã¦ç»é¢ãå¤åããããR,G,Bã®ã¹ã©ã¤ãã
åããã¨LEDãç¹ç¯ããã°æ£å¸¸ã«åä½ãã¦ãã¾ãã
ä»åã¯æ©è¶³ã§ã¯ããã¾ãããAndroidã«ç¬èªãã¼ãã¦ã§ã¢ãä»ããæ¹æ³ã«ã¤ãã¦è§£èª¬ãããã¾ããã
Androidã¨ããã°Javaã¢ããªã¨ããã¤ã¡ã¼ã¸ãããã¾ãããAdruinoãç¹ããããã«ãªãã°
ç°¡åã«ãã¼ãã¦ã§ã¢ã触ããããã«ãªãã¾ãã
ãããæ©ã«ãã¼ãã¦ã§ã¢ã«èå³ãæã£ã¦ãã ããæ¹ãå¢ããã°å¹¸ãã§ãã
次åã¯ADKã®å¿ç¨ç·¨ã¨ãã¦Farmboxã®ãã©ãããã©ã¼ã ã¨ããã«å¿
è¦ã«ãªãæ©è½
(ç¡ç·LANã¨Webã«ã¡ã©ãªã©)ã®è¿½å æ¹æ³ã«ã¤ãã¦ã¬ãã¼ãããäºå®ã§ãã