Connect Android to Arduino via USB on the go
The feauteres found in a modern smartphone is uncomparable to any other hardware platform found within this size and pricerange. A smartphone packs: display, GSM, bluetooth, soundcard, storage, accellerometers, wifi, 3g/4g etc. The only limitation is interfacing with physical sensors and in a tangible computing sense. This is where a combination of an Android and an Arduino sounds like a match made in heaven.
Unfortunately it can be rather tricky to get running. The best simplest solutions is to use an Android phone and an USB OTG (On-the-go) cable.
There are some limitations with this solution:
- The phone will not charge: The OTG standard does not have a viable way of charging the phone while connected. What this means is that one have to find alternative charging solutions for prolonged activity (one can hack the battery directly).
- The phone may not stay alive: Since the phone is not connected to a power source it may turn off it screen quite quickly. This can sometimes be set in the settings menu and it can be solved in the software or through third party software.
- This only works with Android API Level 12 and above. For earlier Android devices we recommend the ADB solution with an Arduino ADK board.
- Android phone API LEVEL 12 / Firmware 3.1 or above.
- USB OTG CABLE.
- Arduino UNO or Leonardo (Other boards may work but this seems to be the simplest).
- Arduino IDE.
- Processing IDE.
- Our software KIT.
- Download the software kit and unzip it.
- In the "processing" folder move the folder "usbotg" to your Processing libraries folder.
- In the "arduino" folder move the the folder "EasyTransfer" to your Arduino libraries folder.
- Move the "AndroidMode" folder modes in your porcessing folder. If you already have a AndroidMode folder then replace it (this version of android mode is compiled to api level 19).
- Look here to learn about general Android setup for processing. You need to install the general google android sdk.
- Install the "EasyTransfer_Example" example on Arduino.
- Install the "arduinootgexample_thread" example on Android phone via processing.
- Connect the phone and arduino board. Your android phone should automatically suggest your app.
This toturial is a modification of the android usb serial library: