Page 1 of 2

Android USB adapter and app allows ZX control

Posted: 18 December 2012, 18:19 PM
by GTBecker
FYI, Android 3.1+ tablet users, an adapter to provide USB hosting (a tablet is normally a client) is cheap (ebay "OTG", ~$7 shipped) or easy to make (search "make OTG"), and a free app (or buy it, ~$7) serves as a terminal that can talk to either Prolific or FTDI USB/serial adapters.

The OTG adapter can connect a keyboard, mouse, or another USB client device - or a hub - to talk to the ZX device via the tablet. Of course you can also use the virtual, or a Bluetooth, keyboard.

https://play.google.com/store/apps/deta ... serialterm

Posted: 18 January 2013, 12:33 PM
by GTBecker
An FTDI USB/TTL 3.3v or 5v cable (3.3v version: http://www.newark.com/jsp/search/produc ... KU=28W2088), when reprogrammed for inverted logic, works fine with ZX devices - and can supply power. With an OTG cable that provides a USB host, connecting a project to an Android tablet is simple and clean.

Posted: 18 January 2013, 14:20 PM
by stevech
small audience here I know, but....
Anyone know how an Android app on a locked smart phone (in the US) can pass data to/from the USB port in any means? The USB Serial profile isn't supported as best as I know, nor any other USB profile that I can find. It may also be phone-specific and certain cellular carriers remove such from their Android baseline that they approve for use on their network.

Don't want to "root" the OS - this is not a hobby project.

Posted: 18 January 2013, 14:44 PM
by GTBecker
More info needed. Phone USB client from what? Or phone USB host to what? What do you want to transfer?

B4A has lots to read on USB comm, like: http://www.basic4ppc.com/forum/basic4an ... #post63117

Posted: 18 January 2013, 14:50 PM
by cerickson
This will allow data transfer over an Android phone's USB connector without rooting the phone:

https://www.sparkfun.com/products/10748

Posted: 18 January 2013, 17:03 PM
by GTBecker
Forgot to mention: while the hardware necessary to provide USB hosting is included in the Motorola Xoom tablet (and needs only be enabled by pulling a connector pin low) it, and a 4-port hub, are built in to the desk dock of the Droid Bionic phone. A Samsung-equipped friend suggests that's true for his pair as well.

That is both an advantage (no OTG cable required to use USB appliances with the phone in the dock; they just plug in and are recognized) and a disadvantage (external power is required for the dock, and it is awkward in a portable setting - like programming servos at the flying field).

Posted: 19 January 2013, 17:57 PM
by stevech
Thanks, all. The interest is in phones, not tablets. E.g., Samsung 3G, AT&T or Verizon.

I've seen the FTDI chip providing USB Host mode. What role would the phone have as a USB end device?

Also... anyone know if this is correct: USB spec says >= 500mA on the USB port. I assume some/most/all phones can't or won't provide that much current.

Posted: 19 January 2013, 18:24 PM
by dlh
500mA is the maximum that a device can draw from a host/hub.

Posted: 19 January 2013, 22:51 PM
by stevech
500mA, right, per the USB spec. But many battery powered devices I've encountered, including most laptops, don't comply. So I was wondering if anyone knows, re Android phones.

Also.. hoping for comment on the above, asking what role the Android phone plays when an FTDI USB host chip is connected.

Posted: 20 January 2013, 2:45 AM
by dlh
You appear to be equating maximum allowed with minimum required and to expect a battery powered unit to act like a standard USB host.

Try these...
http://en.wikipedia.org/wiki/USB#Power
http://www.uta.edu/engineering/news/med ... gnLine.htm

Posted: 20 January 2013, 16:57 PM
by DocJC
My understanding is that a USB device can expect the host to provide up to 100 mA when the device is first plugged in and enumerated.

The device can then send a request asking for up to 500 mA current, but the host does't have to grant that request.

Additionally, if the device tries to draw more than 100 mA the host can shut that port down. This is sometimes seen on PCs.

JC

Posted: 20 January 2013, 18:01 PM
by GTBecker
>... what role the Android phone plays when an FTDI USB host chip is connected...

I'm still uncertain of what you want to do.

A phone's USB port normally looks like a memory device to a USB host - whether it is served by an FTDI USB host chipset or any other chipset brand - and it is controlled by a host like a desktop computer. The phone might also respond to other USB profiles, like MTP or PTP, to transfer specific data structures more effectively than simple files.

I suspect that the phone - if charged - draws little current from the host; it is then self-powered. A computer's USB port can supply no more than 500mA (and some might only supply 100mA, by spec - like an unpowered hub which draws its current from the host) and is likely therefore to not be able to charge the phone - which typically requires more than an Amp, supplied by an AC power supply or 12v adapter.

Whether connected to a phone or a desktop, if a device needs more current than the host (or hub port) can provide, the port will be disabled by the host controller. To avoid that, an externally-powered hub can be used. I have, for instance, a DLink 7-port hub that needs a 4-Amp supply if it is expected to provide 500mA to each of its ports.

Posted: 21 January 2013, 15:37 PM
by stevech
Goal is to exchange low speed, low volume bytes with a device plugged into an Android phone, such as Samsung. Use the drivers that come with the carrier-approved phone. Don't root the phone. Add whatever software, so long as the phone doesn't have to be rooted (unlocked).

The serial port profile for USB seemingly doesn't exist in the baselines in common phones. Ideally, the data exchange would be via 3.3V UART I/O, but that doesn't seem doable due to driver issues.

The usefulness of an FTDI chip which can be a USB master seems N/A. Here, the phone becomes a USB end device, confuses me, as the Android would normally be the master with HID devices or mass storage devices.

Re the power issue: just need an average of 40mA but peak might go up to 120mA for a few mSec. The goal is to eliminate the need for self-powered external device. My newest laptop, like many I suppose, has one USB port that has always-on power for charging devices. However, my HTC phone doesn't charge from that port; it will display that power is connected. The HTC USB charger is 1Amp. Maybe that's why.

Posted: 21 January 2013, 16:35 PM
by GTBecker
stevech wrote:> ... Android would normally be the master with HID devices or mass storage devices.
That is incorrect. Android, the OS, is capable of controlling appropriate USB hardware so that it behaves as a host, but phones are not typically capable of hosting. One cannot plug a USB mouse or a thumb drive into a phone's USB port (although both a Bluetooth mouse and keyboard can be used). The phone's USB port is configured as a client, not a host.

You might consider Bluetooth, or the Sparkfun device suggested earlier might be suitable.

Posted: 21 January 2013, 16:40 PM
by dlh
http://robots-everywhere.com/re_wiki/in ... audio_port

I doubt that many phones will be able to supply that much power.