So i need to connect Android device with this.
The robot is running an API command interpreter on the USB port. Connection to the robot is made through a USB cable. The driver converts the USB port connection to a Com port connection.
I have htc hero with android 2.3.4 on board. But i can buy 4.0 tablet if i have to.
I have found the tutorial that covers the Serial library. This library allows you to connect with other Bluetooth devices using virtual serial ports (RFCOMM). I want to do the same thing but using usb connection.
Also i have found API to connect, read and write data through theses serial ports, but i don't think i really need this.
I'm in the begging of the development, so any help would be appreciated. I'm looking for some library or code sample that allows me to use virtual com port on android. something like this.
edited:
found something here not sure if it will help.
Related
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.
I have to communicate from tablet to PC using USB. I have studied about using TCP and abd but i have to do with the Serial port. I am even not sure is that possible or not. So please guide me through what is the way to achieve this. Any help is appreciated.
You can use a USB to UART bridge device to do this, but the caveat is that your tablet device will need a driver to do so. Your tag shows you are using Android, which is based on the Linux kernel. Linux already supports plenty of USB to UART bridge devices natively, so once you choose one you can go through the steps of building in the driver to your Android image and probably perform a make menuconfig and add in support for your driver that way.
Communication to the PC on the other side of the bridge can be through a standard RS232 serial port (if available), or you can use USB to UART bridge on the other side as well.
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.
I have a third party usb device, that when plugged into a Windows machine, is recognized as a serial device and assigned to the COM 4 port. I can communicate with the device just like I would with a device connected via a serial port. For instance, I can write "abc" serially to the device via the USB connection.
I have been searching for a way to do a similar thing in Android. If I try the Usb Host method, and use a UsbManager to open the UsbDevice, I can get one interface, with 2 endpoints. I have tried sending control messages using the method in UsbDeviceConnection, but the method returns -1 for everything (though I don't know what I should use for the parameters of that method).
Is there a way to get an OutputStream that I can write to that will send bytes to the USB device? Right now I am looking at recompiling the kernel to include a virtual COM port driver and write some native code to be able to do this.
Thanks!
Edit: I am using the FTDI serial to USB converter circuit. Is this compatible with Android?
If linux kernel in your device supports FTDI, you can access this device as normal COM port. It will be named something like /dev/ttyUSB0.
If your kernel does not supports this type of devices, you can write your own driver using UsbHost interfaces. Check kernel's FTDI driver source code for guide.
You can use 3rd party drivers for this purpose,
this driver from SlickDevLabs works so nice,but cost you 100$.
http://slickdevlabs.com/slick-usb-2-serial-library/
If you don't mind rooting your phone and writing some C, you can communicate with the FTDI in Android using the Android driver here:
http://www.ftdichip.com/Drivers/D2XX.htm
There is a libftd2xx-jni.so in there that you can link with your C code - I've tested it and it works.
Rooting device is strongly unrecommended in common case, because i can do this for my device but i can't do this for public app, which is distributed on android market. In that case i think controlTransfer() is the only way to deal with it.
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.