Apparently with Android 2.3.4 and 3.1 one can now access USB accessories.
I have a Ardupilot Mega (based on Arduino) board with a USB cable connected to my laptop, and I can connect to it using a simple serial communications program over COM7 and 115,200 baud. This allows me into the command-line interface, and I can issue commands and get logs.
Is it possible to write an Android app that will communicate over USB to my Ardupilot Mega board?
I've seen many similar threads, but most of them were pre-USB host.
There are 3 simple steps to launch USB to serial adapter:Download and install the driver for your particular converter. Plug the converter into the computer's USB port. Attach a serial device to the converter.
Since USB can do the same thing as many COM ports, most computers now lack serial ports. If you need one to satisfy your software, though, USB's benefits don't help you. The solution is to plug a USB to serial adapter into a USB port and set it to act as COM1.
usb-serial-for-android is my open source library written for exactly this need. It supports FTDI and CDC-ACM usb serial devices using Android's USB host support; no root or ADK necessary. It can talk most Arduinos.
The project is still in its early days, but the basic support has worked well enough for several projects. There is also a discussion list where you can get help.
Unfortunately the library from mik3y's answer (see here: mik3y/usb-serial-for-android) seems to be long dead. It has many problems and waiting pull requests. Also the LGPL licence prevents anybody to fork it and maintain it.
But don't lose your hope, there's a working replacement and it's under the MIT licence. felHR85/UsbSerial.
EDIT: I found a maintained fork of mik3y's library. But the licence or readme is not updated, so I suppose the owner doesn't have a connection to mik3y and simply took it and improved it. I hope he won't get into any trouble because of the licence, because we need this library. See kai-morich/usb-serial-for-android
EDIT2: It seems that all of these libraries are maintained again, mik3y joined forces with kai-morich and they're working together now.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With