Electronic – Best way of making a battery powered USB charger

usb

I recently made a USB charger that takes a 9V battery. I've noticed it doesn't work with a lot of devices though. It was very simple though, just a 5volt regulator hooked to a USB plug and 9V battery and a switch.

Note: I'm wanting to use what I have on hand(all sorts of capacitors, resistors, and 5v regulators) so the minty boost is out of the question(requires some components I don't have any of, such as inductors)

So what did I do wrong? I just shorted together the data+/- pins(bad idea now that I've thought about it). Should I have these hooked to something or just left unhooked? Also, should I worry about installing a 500mA PTC fuse? And lastly do I need any kind of capacitors to handle any rippling and such?

Best Answer

I just shorted together the data+/- pins(bad idea now that I've thought about it).

Nope. That's the standard, actually. The official USB Battery Charging v1.2 Spec is almost completely unreadable, but it does say:

A Dedicated Charging Port (DCP) is a downstream port on a device that outputs power through a USB connector, but is not capable of enumerating a downstream device. ... A DCP shall short the D+ line to the D- line.

The the current is literally limited by the charger. There is no negotiation of what the device is allowed to draw, the charger just drops its voltage when the device tries to draw more current than it can handle. (And the device then has to lower its draw in response or the charger shuts down?)

Of course, Apple has to do it their own proprietary incompatible way for iPods and iPhones:

The mysteries of Apple device charging

The nice thing about Apple is that they tell the device how much current it's allowed to draw, and it obeys.

And the phone manufacturers had their own ways before the standard, usually using the ID pin:

USB charger specifications and compatibility list

I don't know if there's a circuit that will work with all of the above, but if you find one, let me know.