I'm playing around with Google Open Accessory.
I've tested with a simple implementation on the Arduino Mega ADK and
an implementation on a .NET MF chip (c#).
When I connect either device to a cheap tablet, for example the ONDA V712
(http://www.onda-sale.com/onda-v712-dual-core-7-inch-16gb.html),
the tablet detects the accessory and asks me to install the required APK.
If however I connect either device to a Samsung Galaxy S3, Note II or Note 8 it doesn't work.
The Galaxy simply says: "Connected as USB media device".
I find it hard to believe the Galaxy range of devices are not compatible with #android open accessory so perhaps those devices need a configuration tweak of some kind? To give an idea, the code for the Arduino Mega ADK is taken from a sample from WROX:
#include <AndroidAccessory.h>
#include <ch9.h>
#include <Max3421e.h>
#include <Max3421e_constants.h>
#include <UsbHost.h>
char application [] = "wrox_temperature_sensor";
char accessory [] = "wrox_temperature_sensor";
char company [] = "Wiley";
char versionNbr[] = "1.0";
char serialNbr[] = "1";
char url[] = "http://media.wiley.com/product_ancillary/66/11184547/DOWNLOAD/t.apk";
int sensorPin = 0;
long timer = millis();
AndroidAccessory usb(company, application, accessory, versionNbr, url,serialNbr);
void setup()
{
usb.begin();
}
void loop()
{
if (usb.isConnected())
{
if( millis() - timer > 10 )
{
int val = analogRead( sensorPin );
float voltage = (val * 5.0) / 1024.0;
float tempCelcius = voltage * 100;
float tempKelvin = tempCelcius + 273.15;
byte * b = (byte *) &tempKelvin;
usb.write(b, 4);
timer = millis();
}
}
}
But I'm thinking the Arduino/NetMF devices are not the problem.
I've also powered the Arduino with a 12v adapter so that it has
enough juice to power/charge the Galaxy devices.
Arduino output when connected to a Galaxy device:
Device addressed... Requesting device descriptor. found possible
device. swithcing to serial mode could not read device protocol
version
Arduino output when connected to the Onda device:
Device addressed...
Requesting device descriptor. found android
acessory device
config desc interface desc
1
2
I also checked if there is a file on each of the Galaxy devices indicating AOA support, and there is: '/etc/permissions/android.hardware.usb.accessory.xml'
<permissions>
<feature name="android.hardware.usb.accessory" />
<library name="com.android.future.usb.accessory"
file="/system/framework/com.android.future.usb.accessory.jar" />
</permissions>
Notes:
On the Arduino side, I'm using the UsbHost
library from ArduinoADK-beta-001.zip
which I donwloaded from the ADK site. That archive contains two versions, version 1 and version 2, but using version 2 the code and samples don't even compile.
Each of the Galaxy devices use Android 4.1.1 or higher.