Saturday, March 30, 2013

Low Cost Google Android Arduino ADK (India)

I recently bought a Arduino ADK clone called the Freeduino Mega 2560 ADK. The seller's website has a tutorial based on the Android Debug Bridge (ADB). However the official demos and apps are using the Android ADK. Moreover ADB requires users to enable some additional privileges.

Here is how I used the same board and to get started with ADK.


Aim:

Use the official DemoKit app from google and control a LED

Requirements

Hardware Requirements:

  1. Android Phone (Android version 2.3.4 or above. I used Google Nexus 4)
  2. LED
  3. Resistor
  4. Freeduino-Mega-2560-ADK
  5. Connecting Wires 

Software Requirements:

  1. Arduino IDE (I used version 1.0.2)
  2. USB Host Shield Library 2.0
  3. Eclipse IDE (I used Version: Indigo Release Build id: 20110615-0604)
  4. Android SDK
  5. Demo Android App

Prerequisites:

There are enough resources to successfully install and configure Eclipse IDE and Android SDK. Similarly there are enough resources about installing Arduino IDE.
So I am not covering it.
Try using the blink example in Arduino to ensure that the Freeduino-Mega-2560-ADK is in working condition.

Preparing the Arduino Board:

Installing the USB_Host_Shield_2.0 is merely unzipping it in the "libraries" directory of arduino.
(NOTE: I got an error saying that arduino doesnt support "." in library name. So I had to rename the directory from USB_Host_Shield_2.0 to USB_Host_Shield_2_0)

Open avrpins.h and uncomment the line.

#define BOARD_MEGA_ADK 

Open Arduino IDE. (a restart of the IDE might be required to detect the new library)
Upload example demokit_20 sketch (File -> Examples -> USB_Host_Shield_2_0 -> adk -> demokit_20) .

Connect a resistor and LED in series between PIN 3 and GND.

Installing the Demo Android App:

  1. Unzip the contents of adk_release_0512.zip
  2. Import the project into Eclipse. (File -> Import -> Anrdroid -> Existing Code Into Workspace)
  3. Right click on the project . Properties -> Android . Change the target from Anrdoid 2.3.3 to Google API 2.3.3. 
  4. Connect the phone to the PC. and Install the app on the phone (Run -> Run As -> Android App). Choose the Phone in "Android Device Chooser". 

Finale

Disconnect the phone from the computer and connect it to the Freeduino-Mega-2560-ADK. the app should automatically pop-up.