Electronic – USB OTG with occasional charging

chargeperipheralswitchingusbusb-otg

I'd like to use a mobile phone together with a barcode scanner as a poor-man's version of a computerised barcode scanner, something like this: http://www.thebarcodewarehouse.co.uk/pdas-and-handheld-computers/handheld-computers/motorola-MC9190-G/

My phone is capable of USB OTG, and that works well but it uses the same micro USB port for charging the phone and I'd like to avoid unplugging the barcode scanner to charge the phone.

I'd essentially like to combine the phone and scanner into a single device with a a socket that I can use to charge it.

I know that there are Y cables available, but these seem to provide power to the peripheral (scanner) rather than the phone. I have also seen various micro hubs but these again seem to provide power to the peripheral devices only.

I have seen various suggestions for a scheme similar to the one below but with the addition of a resistor to pull the ID line in the phone's connector low with specific values. I have been unable to find an easily digestible list of these, and there are suggestions that it is against the standard. I also don't know how it would handle the connection and disconnection of the charger.

enter image description here

In the OTG cable that I use to connect the phone and scanner, I believe there is a short between ID and GND. This tells the phone that it should be in host mode and provide power. When I plug the charger in, the phone needs to stop powering the 5v line and accept power instead.

I considered a simple switch to open circuit the ID pin, thus taking the phone out of OTG mode, and allowing it to charge. But, I believe it takes a short while for the phone to realise that the OTG device has been unplugged and to stop providing power, during that time the phone and the charger will be trying to supply power at the same time which doesn't sound good.

I also had a look for a chip that will handle this switching for me. They seem either to want to switch the data lines only which I don't think I need (unless the charger signals its presence this way), or be a charge controller for a battery (I don't need this since the phone will handle charging of its own battery).

The barcode scanner doesn't have to work while it's charging but that would be a nice-to-have feature.

Best Answer

This is a fundamental problem. When the ID=GND, your phone assumes the role of HOST, and therefore will SOURCE VBUS. And it will not charge its internal battery. When ID = open, the Phone will assume the role of device, will charge itself, but there will be no communication with your barcode scanner, since USB does not support device-device communication.

What you might need is to implement so-called "accessory charging adapter". See Section 1.4.1 and Section 6 of "USB Battery Charging Specification 1.2", which can be found on usb.org website link.

You might want to check with Texas Instrument offering as TSU6721 link for application ideas.

This all assumes that your phone really follows/supports the BC1.2 specification. If not, you are out of luck.