Automatic distinction between PC-USB and Wall Adapter-USB

batteriesusbwall-wart

I want to ask if it's possible and an advice on how to make an automatic distinction between an PC-USB port and Wall-USB adapter. I've a battery charger IC (for example http://www.mouser.com/ds/2/405/bq24074-556796.pdf) where I can set max. IN current. I have no problems to set it to 500mA, but I'll always charge the battery at 500mA in PC and Wall-Adapter. But I want to charge the battery at 1-1.5A when I connect it to Wall-Adapter and when I connect it to a PC I don't want to fry PC usb port and charge battery at 500mA. Something like in a smartphone. I thought about sending some data via usb to know if it's an PC or Adapter but I need something more safety and always working.

Best Answer

There are two main ways that USB high current is indicated (Apple's way and everyone else.)

Apple uses a resistor divider to set D+ and D- at various voltages to indicate between 500mA and near 2A charge. 1.1 and 1.5A I think in there. I would have to think if this puts a kink to below if you use an Apple charger.

Everyone else shorts D+ and D- together. Many USB charge controllers handle the detection on the USB data lines. If you are making a one of device, that is an easier route.

For your own detection, tie D+ to VCC with 10k resistor. Tie D- to GND with 100k resistor. Read D-, if high you can pull high current. If low, you can't.

For your Mouser linked chip: Pull EN2 low with 10k resistor. Connect D- to EN1 to enable full current if data lines shorted or 100mA if not.