Go Down

Topic: Interfacing Arduino and Android using a USB host shield. Testers needed! (Read 5263 times) previous topic - next topic

Inopia

I've developed a C library to allow an Arduino Mega to talk directly to an Android phone over USB using SparkFun's USB host shield. This library will allow you to drive motors, servos, sensors, etc. from your phone.

The USB protocol is Android Debug Bridge (ADB), which supports multiple bi-directional pipes. Since ADB is a part of any Android device there is no need to root your phone or install custom drivers for this to work, just enable debugging from the settings menu.

If anyone with a USB host shield, an Arduino Mega, and an Android device would be able to test this, I'd be very grateful. Specifically I have been having some stability problems which seem to be electrical, as the phone is trying to charge from the host shield and it may not be outputting enough current :)

The code is Arduino Mega only right now (that's all I own) but should be trivial to port to the 'smaller' Arduinos, please contact me if you're willing to try to port it for me.

http://code.google.com/p/microbridge/

Zoandar

I have a lot of learning to do first, but I might someday be interested in trying this with an Arduino Uno I have, along with my LG Ally phone. Would that work in place of the Arduino Mega?

I do not have the USB hosting shield though. What is their cost?
Zoandar
  ---v/\/\/\v---

Inopia

I added support for 168/328p-based devices like the Uno and Deicimila yesterday.

Opcod

Hi

So i'm pretty pleased to read you about that. Very good job. My project curenttly is almost exactly going into an Android tablet. For now i try to show data and picture on a 7inch panel with a ctrl board, but having hard time and it's pretty slow anyway. So i will turn into an Android tablet that will read the data from the arduino mega (not a uno).

I have seen your video, it's perfect for the output, but can it also do the reverse ? Like if you have temperature sensor and a gps.. Can you collect the data from the arduino and show them to the screen? Like as acting as a serial monitor..

So for now, i have 2 android tablet that i can test on : android 1.6 and the new one with the honeycomd firmware. For the usb host, i'm about to pick the one from (circuits@home) his version 2.0 with the 5volt version. That i follow his progress since long time.

Let me know.

Inopia

MicroBridge supports multiple bidirectional connections. The easiest way to get data from the Arduino to the phone/tablet is for your App to listen on a TCP port (using ServerSocket). On the Android side you can do

Code: [Select]
adb_connection * tcpConnection = adb_openConnection('tcp:1234', true, adbEventHandler);

And when you have data to send, just write to the connection:

Code: [Select]

uint16_t sensorValue = readADC(0);
if (tcpConnection->status == ADB_OPEN) adb_write(tcpConnection, sizeof(uint16_t), (uint8_t*)&sensorValue);



Sudar

The function "adb_openConnection" is not present in the current version of microbridge. Have you changed the function name or do we have to use a different function?
Checkout some of my Arduino projects and tutorials

Go Up