Communication between Android device and Arduino Microcontroller - android

I want to transmit data from Arduino microcontroller to an Android device, over USB port.
I dont have an Arduino ADK board, cant communication take place without this board and just the microcontroller?? How should I go about with this communication?
Also, Android 3.1 and further devices have the host mode, how can I use an Android 2.3.4 accesory mode for communication??

Have you checked out the IOIO? It doesn't use your computer's USB port...but I still think it could be helpful: https://www.sparkfun.com/products/10748

Related

can we use Bluetooth dongle both on Host (xp) and Guest android OS at a time

I wanted to implement communication between c# server and android application through bluetooth. I don't have real android device so I am using android emulator in Virtualbox.
I have activated bluetooth in android emulator but unable to share bluetooth between both xp and VM android. My pc does not have bluetooth internal hardware. I am using Bluetooth Dongle. How can I share same bluetooth device both on xp and VM android?
I wanted to establish communication between c# server running on host xp and VM android emulator by using same bluetooth dongle. is it possible to discover and connect android emulator from host xp using same bluetooth dongle?
Sorry If I ask anything silly or or my way of questioning is not right. I don;t have much knowledge about all this stuff.
Thanks everyone for help!
I think what you want to do is not possible (I also wanted to do it but couldn't make it work).
What would be interesting, is if it's possible to connect 2 separate BT dongles to a single computer and get them to pair.

Drawing power from USB device to android tablet through OTG cable

I am working on a project which involves communication between a android device and arduino. The final assembly of the project would be a box-like structure with only the android device's screen being visible (the remaining sides would be enclosed) . Space is Important; i'd like the apparatus to be as small as possible & using minimum cables.
Communication with the arduino has been established using usb host apis.
Now; the android tablet and arduino are connected through:
USB OTG cable on the Android tablet (micro-usb male & usb female)
Mini-usb to usb on arduino (USB male & mini-usb male)
The problem: I want the android tablet to charge itself through the connection.
Currently the arduino powers itself from the android tablet. However; finally the tablet and arduino will be connected for hours together; and that'll drain out the battery. The arduino board will be getting power from an external source. I'd like the tablet to draw power from arduino. This is working when the Tablet is switched off; however the tablet stops charging itself and begins discharging as soon as it is turned on.
This is probably because the tablet goes in the Host mode (as USB HOST) and the arduino as the device/accessory. Usually in such connections, the host sends the power and the accessory charges itself. Can this be the other way around??
My understanding is that in these kinds of connections Host Negotiation Protocol (HNP) is implemented first to determine the host. Is it possible to forcibly make arduino host and the tablet an accessory? and in such a case will proper communication be possible?
Alternatively, is it possible to enable and disable host mode from within an android app?
The main purpose is to be able to draw power from usb otg cable (I'm trying to avoid using additional cables)
Please if anyone can provide assistance , it would be appreciated.
Thanx a lot in advance :)
Your device will not be able to draw power while connected as the Host.
You should look into the Android Open Accessory(AOA) Protocol, though you need the proper hardware to connect to.
AOA allows the tablet to be connected as a USB accessory which will allow it to draw power and charge, but it also lets the Android device behave as if it were a host sending the commands to the connected hardware.

Android external accessories development library?

I want to build a device with sensors (either with an Arduino or a homemade circuit with a microcontroller) and I want to send data from it to an Android device via an USB cable. What is the library required to connect devices via USB? Is there any documentation I could read for it? The problem is that whenever I search for this I only get results about the ADK and their board, not for other devices.
Are there things I should know beforehand? I'm not new to either field, but it's my first project with the two connected.
Thank you.
The first thing to check is if your Android device is equipped with USB host interface. In such case you can connect a regular USB device to your Android and use this API to communicate with the device.
However, typical Android device (virtually every mobile phone) is only equipped with USB device interface, for connecting to PC or another USB host. In such case you have to use the Android's USB Accessory support. The most important idea behind Android Open Accessory protocol is that it swaps (logically) USB device and USB host roles. It's the USB host that looks for the device with particular vendor/product ID, selects particular USB protocol interface, and then simply uses the in/out bulk endpoints found to communicate - pretty smart, isn't it?
To build Android Open Accessory compatible device you then need a CPU with USB host interface. If you want to use Arduino, this shield is probably a good starting point, given its firmware implements Android Open Accessory Protocol already. There are some example applications as well.
This works great on my Nexus7 which is connected over the OTG to Arduino Mega.
Android USB host serial driver library for CDC, FTDI, Arduino and other devices.
Hope it helps!
You have two solution
1: Your Arduino board act as a USB host and power the Android device.
With this solution you have to implement and USB Host stack on your Arduino board and must implement Android Open Accessory Protocol. Your Arduino board must power the Android device. Then you app must use the USB Accessory API to communicate with your board.
Avantage:
work with almost all Android Devices (no need for an USB Host port on Android device)
Disavantage:
The device board is more complicated (must provide power for both devices)
Firmware is more complicated (must implement USB Accessory mode)
2. your Arduino board act as a USB device and the Android device powers
you board.
With this solution your do not have to implement a specific USB protocol. Your board will act as a standard USB device. Since you act as a device you can power your board directly from the USB cable (the Android device will power itself and your baord). To communicate with your board you will use the USB host API of Android.
Avantage:
the device board is very simple
the firmware is simple and easier to debug (you can even test it with you PC)
Disavantage:
Works only with Android devices that have an USB Host port
On most device you will need a specific cable or adapter (ex :otg usb host cable)
I have experience with solution 2, and it works pretty well. All source code for the Android source is available from the link below. I have verified that it works with sensor devices from the company where I work on the following Android devices:
Samsung Galaxy S3
Acer Iconia tab a200
Asus Tranformer Pad TF300T
But it should work on most tablets and recent phones you can see this post if you want look at our experience.

Accessing other devices using Android tablets

I am looking for a way to communicate with a control-board (u can consider it a sensor device) using USB cable. My sensor device supports usb but I think android does not have a way for that.
Can that be possible through Bluetooth dongle?
Is there any Android device available which supports USB host.
USB host has been "hacked" into a lot of android phones, but it's not very user friendly and weird cabling is needed along with a power supply as the phone won't power a usb device.
Some of the "first generation" android tables apparently had USB host on some models.
I've seen pictures of a Xoom connected directly (via a short OTG cable) to a thumb drive that it appears to be powering and reading from, apparently it was unofficial software.
As for your other questions, yes, you can use bluetooth if you get a bluetooth modem for your embedded device. Or you can use wifi. Some of the phones have low voltage debug serial ports. Or you can build a modem / DTMF control interface to connect to the headphone jack...

USB Communication with Android/Arduino

I am working on this Android application that needs to communicate over USB. I have an Archos 101 Tablet (specifications here: http://www.archos.com/products/ta/archos_101it/specs.html?country=us&lang=en). It has a full USB host port. I can put a flash USB drive in the USB port and copy files to and from the flash drive onto internal storage.
I have this Arduino Fio board, with an XBee attached to it. I have an XBee Explorer Dongle with another XBee that I plan to hook into the Archos 101 tablet into the USB port.
As of right now, I can put the XBee Explorer Dongle into my computer and send/receive data to and from the Arduino Fio, no problems.
Is there a way for Android to talk over USB? I know there has to be drivers somewhere in the tablet allowing USB communication, but I cannot find a way to access them or use them.
I can see Android recognizing the XBee Explorer Dongle. I downloaded a terminal emulator, and I can type "dmesg" and see that it sees the dongle hooked up. But I cannot do anything with it.
I seem to need a FTDI driver for Android.
I would greatly appreciate any help in getting my tablet to communicate with the XBee Explorer Dongle.
If you have root and can hack your kernel, FTDI offers its D2XX driver for Android OS. Check its website, please.
If your Android device is 3.1+, you should be able to use Android USB host to talk with Arduino. However, I met some issues on this.
If you have ADK/UHS at hand, your Arduino can act as USB host and talk to Android USB device. Even in same hardware, if your Android OS is quite old like 1.5/1.6, you have to use ADB interface rather than ADK (Accessory Developer Kit) protocol.
If you have Bluetooth, you can write your own Bluetooth SPP in your app.
If you can handle WiFi, you can write app to communication with socket, or via latest WiFi direct mode in Android.
Communication is various. However, it depends your hardware.
There is a solution by Inopiaaardbei using Arduino and a USB host shield with an Android Debug Bridge running on Arduino.
Using this solution you can use serial communication between the Android phone and the Arduino board.
See my post and the link inside for more info.
You can use an android adk or the android ioio connected to an xbee module as I did in this article. I have published the code on my github and another guy is going to implement the gui currently.
USB is not easy to programm, and it would be much easier with ethernet or rs232. However, if you insist, then take a look at V-USB (SW USB), LUFA (HW USB) and Lufaduino (HW USB). If Android has USB CDC drivers already embedded then it could be the easiest path for you if you implement it in AVR too. Slow, cheap and software only AVR USB CDC implementation is here.

Categories

Resources