1
\$\begingroup\$

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.

\$\endgroup\$
14
  • \$\begingroup\$ Welcome to EE.SE. So what is your question? \$\endgroup\$
    – user105652
    Commented Jul 12, 2016 at 16:44
  • 1
    \$\begingroup\$ OTG Charging is completely dependent on the phone. It's not supported by many. \$\endgroup\$
    – Passerby
    Commented Jul 12, 2016 at 16:57
  • \$\begingroup\$ Consider finding a phone that's QI wireless charging compatible. \$\endgroup\$
    – Passerby
    Commented Jul 12, 2016 at 16:57
  • \$\begingroup\$ I'm sure you are probably already aware of this, but there are a bunch of pretty decent barcode scanner apps for smart-phones with cameras. You can also purchase various clip-on lenses if needed. \$\endgroup\$
    – Tut
    Commented Jul 12, 2016 at 17:06
  • \$\begingroup\$ "I'm sure you are probably ..." \$ sure \times probably = ? \$. ;^) Good point though on using the camera instead. \$\endgroup\$
    – Transistor
    Commented Jul 12, 2016 at 18:42

2 Answers 2

1
\$\begingroup\$

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.

\$\endgroup\$
2
  • \$\begingroup\$ Thanks for the chip suggestion. I'll look into to that a bit further, it certainly seems to do a lot. Wish it didn't have so many pins / wasn't so tiny! :-) \$\endgroup\$ Commented Aug 2, 2016 at 20:18
  • \$\begingroup\$ I've also ordered a TS3USB32008RSVR from TI, similar to the chip @Ali Chen suggested but less pins. Unfortunately it's smaller than my breakout board will take so I may have to make my own... \$\endgroup\$ Commented Aug 2, 2016 at 20:28
1
\$\begingroup\$

Some phones / tablets allow battery charging during USB OTG mode. I've seen documentation for two different schemes.

1) Normal OTG mode (no battery charging): ID pin is connected to the ground pin.

2) OTG mode with battery charging v1: ID pin connected to ground via 20k resistor.

3) OTG mode with battery charging v2: ID pin connected to ground via 120k resistor.

These mode work with a small subset of all the OTG-capable devices. But it's pretty easy to try with your particular device to see if it might work with it.

\$\endgroup\$
1
  • \$\begingroup\$ Thanks for the suggestion. I'm not too concerned with being able to charge the phone while it's being used with the scanner. The main problem I need to overcome is switching from OTG mode to being charged mode. It may be possible to just change the resistance on the ID pin when the charger is plugged in but I don't like the idea of the phone and the charger trying to drive the 5v line simultaneously until the phone realises a charger has been plugged in. \$\endgroup\$ Commented Aug 2, 2016 at 20:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.