• No results found

Example Connection between USB Host and Android

N/A
N/A
Protected

Academic year: 2021

Share "Example Connection between USB Host and Android"

Copied!
28
0
0

Loading.... (view fulltext now)

Full text

(1)

Example Connection between USB Host and Android

This example illustrates the connection between Board ET-MEGA2560-ADK and Android through Port USB Host. In this case, it develops program by ADB (Android Debug Bridge) by using Library ADB of Microbridge. This example is compatible with every Android devices versions that have been installed the Operating System of Android version V1.5 and higher. It divides part of developing program into 2 parts. Firstly, it develops program in the part of Microcontroller (ET-MEGA2560-ADK); and secondly, it develops program in the part of Android device. In this case, it uses Program Android SDK to develop Application of Android. There are many websites that have published information about developing program for board by ADB (Android Debug Bridge); in this case, we recommend the

official website of

(2)
(3)

Android Versions

Android is the operating system as Open Source Project from Google; it is suitable for mobile devices, especially Android Mobile Phone and Android Tablet. This Operating System of Android from Google is Open Source that can be developed and improved independently; so, it attracts many developers around the world to share the knowledge and develop program to supply requirement until it is a large community. It uses JAVA Language with Library of Google called “Google Developed Java Libraries” to develop program. Google continues improving and modifying the Library and nowadays there are more than 10 versions.

(4)

Android version is specified by name code (Nick Name) and API Level; however, some details are different. So, code and Compiler version must be matching, otherwise it cannot compile any code program.

Android Version API Level

Name Code version (Nick name)

(5)

Android Open Accessory Development Kit (ADK)

ADK is Android Program Development Kit that allows external USB Host device to interface with Android Operating System such as Android Phone and Android Tablet in the Accessory Mode; so, Android device can act as Host. Most devices are cheap such as mobile phones; it can communicate with external device through USB Bus according to conditions and restrictions of ADK. The format of Protocol ADK can reduce difficulty in communicating through USB of mobile phones. In this case, it moves the difficulty in communicating to the side of USB Host that is the outside of mobile phone instead.

This capability is compatible with devices that have been installed the Android Operating System from version 2.3.4 (for old version that has been released) to version 3.1(for new product release). Accessory devices that are interfaced with Android devices in this operation mode must has own Power Supply; moreover, it cans also supply 5V/500mA to Android device to charge current for Android device.

Android Debug Bridge (ADB)

This is the format of developing program that is Application for external devices; so, Android device can communicate and command various Input/output with external devices. In this case, user can apply cheap Android devices in the market for many applications; it seems to increase unlimited Input/Output systems into mobile phones. This capability is included in all Android device versions that have been installed the Operating System version 1.5 or higher; so, it can support almost devices in the market that have been installed the Operating System of Android.

If interfacing Board ET-MEGA2560-ADK with mobile phone that has been installed the Operating System of Android, it looks like Board ET-MEGA2560-ADK acts as I/O of mobile phone; moreover, it is controlled and commanded by mobile phone through Cable USB. So, it seems that the mobile phone has the system of Input/Output that is both Digital and Analog, including other special Input/Output such as I2C, PWM, USART and so on.

(6)

The following example is a guideline to connect Android device with Board ET-MEGA2560-ADK; this example is modified from Library ADB of Microbridge. It uses the capability of GUI that uses touch screen and the display screen of mobile phone to command and display operating result of Input/Output of Board ET-MEGA2560-ADK. The operating result of program is to command ON/OFF LED(D13) on Board ET-MEGA2560-ADK according to the control of touch screen. In the meanwhile, Board ET-MEGA2560-ADK sends the result of converting signal from Analog(ADC0) and then sends back to the Android device.

(7)

How to test operation

The method to test the operation of this example is to develop program for 2 sides; Microcontroller and Android device. On the side of Microcontroller, it uses Board ET-MEGA2560-ADK and it develops program through Program Arduino with ADB Library of Microbridge. On the side of Android device, it uses computer PC with Program JAVA and Android Library of Google to be tool to develop program.

First of all, user has to compile and upload program in the part of Microcontroller into Board ET-MEGA2560-ADK by Program Arduino first. Moreover, user has to copy Library ADB for AVR Microcontroller that has been developed and modified by Microbridge and then paste it in the Folder “..\arduino-0022\libraries”. So, signals can directly interface with Hardware System of Board ET-MEGA2560-ADK as shown in the example below;

(8)
(9)

How to prepare ADK Development kit

1. Download and install Program JDK (Java Developer Kit) 2. Download and install Program Android SDK

3. Download and install program Eclipse IDE

4. Install Program ADT (Android Development Tool) Plugin

1. Download and install Program JDK (Java Developer Kit). This is Java Language Program that includes various essential Libraries to develop program for Android. User can directly download and install the program from web page;

(10)

Load from:

(11)

2. Download and install Program Android SDK. User has to choose and set values according to the actual Operating System that has been installed in computer PC. If using with Windows, there are 2 choices; Zip File and Install File. In this case, it is better to choose version File Install because it is more convenient. When user has downloaded the program successfully, should install in Folder “C:\android-sdk-windows” because it is more convenient to call. Next, choose Package for installation as Accept All; in this case, it takes a long time for processing.

(12)

3. Download and install Program Eclipse IDE.

(13)

4. Install Program ADT (Android Development Tool) Plugin. This Program ADT links files and sub-programs that are essential and related to develop program for ADK; so, it is more convenient to call and command program through window IDE of Program Eclipse correctly. User has to install this Plugin while connecting Internet; click Menu Help  Install New Software…

(14)

Set values in the window Install completely. Firstly, set the value in the blank of Work with as Add…; secondly, set Path value for downloading Program Plugin by setting Name as

ADT; thirdly, set Path value in the blank of Location: as

https://dl-ssl.google.com/android/eclipse/; and finally, click OK. User has to wait for a while and the program shows additional Developer Tools, user has to tick the check box and click Next to go to the next step.

(15)
(16)

Testing Example Application

1. Copy the example program that has been developed by ADK; paste and save in the Hard Disk as shown in the example below;

(17)

Click Menu File  Import…; choose Existing Projects into Workspace; click Next and finally, click “C:\DEMO_MEGA2560_ADK”

(18)

After user has already set Directory successfully, the program shows lists of all Project File in the Directory; in this case, user can tick check box in front of the Project File that user requires Import to test the operation.

(19)
(20)
(21)

Next, click Menu Project  Properties and choose Tab Java Compiler. User has to choose the Compiler version according to the Operating System of the device that is used with program development; in this case, user has to choose Enable Project Specific Setting and set the value as Compiler Compliance Level completely.

(22)
(23)

After user has compiled successfully, it displays the operating result in the format of File “Mega2560ADKV233Demo.apk” and it is saved the Folder “C:\DEMO_MEGA2560_ADK\Mega2560ADKV233Demo\bin“; in this case, user can install this file into the Android device instantly. If user has already installed Driver of Android device into computer PC and connected USB Cable between computer PC and Android device completely, user can run the operation from Program Eclipse instantly. Program transfers files to Android device automatically.

(24)
(25)
(26)
(27)
(28)

References

Related documents

Peabody Conservatory of Music (Johns Hopkins U. in Baltimore) (doctorate in performance and composition only) University of Maryland School of Music (all four plus ethno)

The user may switch between either the USB output which can be connected to the Android tablet provided; or the user can switch the camera to WiFi

+ 1 ALPHA ‘+’ (plus) sign, used as a delimiter between items in the header record Report As-of Date 10 ALPHA Date of the report, using the MM-DD-YYYY format.. Contact

For example, if the calling user already has a history at a specific virtual call center, and it can be established that during most of this user’s calls, the

The FT312D connects to a USB device on the Android platform, establishes the USB connection, enumerates Open Accessories, and then provides a bridge from the USB host port to a

The Pathway of Distinction Analysis (PoDA) [8] was applied to the NAFLD genotype data for the following histologic phenotypes: steatohepatitis, NAFLD activity score (NAS) and

@fkãnco` Nciignn fes edqgog n` rescacnci`i ig gsywic`q req rqcmgq` tg| gn yg`yqe oeme kãfgqe `wyeacekqàdcoe.. `nke pwg ` j` scie `aeqi`ie gf f`qq`yct` rgqe yg`yqe oeme

EC-Council shall not be held liable or responsible for the lack of knowledge, experience, or quality of work as a Certified Chief Information Security Officer. I will adhere to