Actually I'm not an Adroid developer myself, but I just got this crazy project in my mind that would motivate me to become one: I want to communicate in a serial way to an electronic device (designed by myself) from an android app, in order to issue commands to it.
My main goal here is to keep it cheap, so my first thougt is to connect the device via the USB port of an Android phone, but I understand Android has some limitations about using this port from the app level.
Can anyone give an advice about it?
If it's not possible at all, what other mechanism would you advice?
There are some devices that seem to work as USB host devices (namely tablets); maybe you can access them in the way needed for this. But it is probably easier to use Bluetooth. When connecting via Bluetooth you (can) create a serial connection, too.
Then there are some experimental / esoteric ways of communication via the headphone jack. Just send the right "sounds" that are interpreted by your device. I think I saw some IR adapter for the headphone jack to use an iPhone as TV remote.
Joined: Feb 03, 2011
I am trying to avoid wireless connections like bluetooth to save some costs. But it seems like the best option so far.
One more question: If I want to plug via USB, is it totaly required that my device acts as a USB host?
Hauke Ingmar Schmidt
Joined: Nov 18, 2008
One of the devices has to be host. I don't know if there are phones out there that provide this; I don't think so. So you would have to design your device to be a host. Still the Android device has to interact correctly. I am not sure if you can access the USB like you would do with a simple serial connection. Even with desktop Java this is tedious. I guess how the Android device acts as USB slave (e.g. mass storage device, modem) is more of a basic level, i.e. part of the firmware. But maybe there is someone around who has deeper experience with this.
But Bluetooth is just made for this. Costs about 10$ if your own device already is USB capable. That is for home brewed devices. If you want to built them in the thousands this may be to expensive, but then you would certainly use another hardware design with a communication chip that includes Bluetooth.
The one annoying thing with Bluetooth is that you have to watch for two batteries as you can't power the connected device like you could with USB.