Android USB adapter and app allows ZX control

This forum is for posts that might be considered off-topic but that may be useful or interesting to members. Examples include posts about electronics or programming in general, other microcontrollers or interesting devices, useful websites, etc.
GTBecker
Posts: 616
Joined: 17 January 2006, 19:59 PM
Location: Cape Coral

Android USB adapter and app allows ZX control

Post 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
Tom
GTBecker
Posts: 616
Joined: 17 January 2006, 19:59 PM
Location: Cape Coral

Post 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.
Tom
stevech
Posts: 715
Joined: 22 February 2006, 20:56 PM

Post 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.
GTBecker
Posts: 616
Joined: 17 January 2006, 19:59 PM
Location: Cape Coral

Post 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
Tom
cerickson
Posts: 45
Joined: 20 May 2008, 15:50 PM
Location: Waikoloa Village, HI, USA
Contact:

Post by cerickson »

This will allow data transfer over an Android phone's USB connector without rooting the phone:

https://www.sparkfun.com/products/10748
GTBecker
Posts: 616
Joined: 17 January 2006, 19:59 PM
Location: Cape Coral

Post 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).
Tom
stevech
Posts: 715
Joined: 22 February 2006, 20:56 PM

Post 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.
dlh
Posts: 395
Joined: 15 December 2006, 12:12 PM
Location: ~Cincinnati

Post by dlh »

500mA is the maximum that a device can draw from a host/hub.
stevech
Posts: 715
Joined: 22 February 2006, 20:56 PM

Post 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.
dlh
Posts: 395
Joined: 15 December 2006, 12:12 PM
Location: ~Cincinnati

Post 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
DocJC
Posts: 112
Joined: 16 March 2006, 6:23 AM
Location: Cleveland, OH
Contact:

Post 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
GTBecker
Posts: 616
Joined: 17 January 2006, 19:59 PM
Location: Cape Coral

Post 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.
Tom
stevech
Posts: 715
Joined: 22 February 2006, 20:56 PM

Post 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.
GTBecker
Posts: 616
Joined: 17 January 2006, 19:59 PM
Location: Cape Coral

Post 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.
Last edited by GTBecker on 21 January 2013, 20:08 PM, edited 3 times in total.
Tom
dlh
Posts: 395
Joined: 15 December 2006, 12:12 PM
Location: ~Cincinnati

Post by dlh »

http://robots-everywhere.com/re_wiki/in ... audio_port

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