5
\$\begingroup\$

I am looking to create a charging device that can provide 5v power to charge a smartphone (or other consumer electronics device) via micro USB. How would I go about making this charging device "aware" of when it is plugged into the smartphone or not? It would need to be able to detect a simple "unplugging" of its micro USB male end from the smartphones's micro USB female end. It would need to be able to detect the "unplugging event" regardless of whether the smartphone is charging or not (i.e., it should not be affected by whether or not it is charging).

\$\endgroup\$
1
  • \$\begingroup\$ It would be really helpful that you've measured the current going into the smartphone in charging, fully charged and unplugged phases. \$\endgroup\$ Dec 14, 2011 at 7:16

3 Answers 3

5
\$\begingroup\$

A USB device requiring charging will usually signal its presence either by attempting to negotiate digitally or by placing certain combinations of resistance on the data lines (depending on its sophistication).

At end of charging it will decrease charge current to essentially zero but is liable to maintain a voltage monitoring presence on the line. It may also maintain a resistive ID on the data lines.But that is less certain.

It is extremely unlikely that a phone will draw NO current when connected. Load will be very small when fully charged but is liable to be detectable.


[1]. Wikipedia on common universal power supply.

[2]. Here is USB.ORG's developers approved class specification documents download page. The documents are longer than the title. Much.

For all there is to know about the battery charging interface you could download.

  • Battery Charging v1.2 Spec and Adopters Agreement (.zip format, size 589 KB)

The old version is also there as

  • Battery Charging v1.1 Spec and Adopters Agreement (.zip format, size 292 KB)

Also see these - with the 2nd possibly most relevant

  • USB 3.0 Connectors and Cable Assemblies Document Rev. 1.02
    Cable and Connector Class 2.0
    Series 'A' Plug form factor Guideline 1.0
    USB Connector for Mezzanine Applications Guidelines Rev. 1.0
    Micro-USB Cables and Connectors v1.01 Spec and Adopters Agreement

OR (recommended), just try it.

Get a microusb cable which you have access to the conductors of. Plug into a socket you can probe or cut the end off a cable or ... .
Plug in a phone and measure the voltages bewtween data + and - and power + and -.
Repeat with a few phones.
A pattern will emerge.

Tell us about it.

Note that as the spec has evolved so too will the phones, so what phones do now will be subtly (usually) different than a year or few ago. Drwaing current somewhere is liable to be a common thread.

I haven't tried this with recent phones but intend to. May not be soon enough for you though.

\$\endgroup\$
2
\$\begingroup\$

The USB specification requires a device to have between 1 and 10 uF of capacitance across its 5V and GND pins. It requires the hub (i.e. your charger) to have at least 100 uF of capacitance across those same pins.

This allows the hub to detect plug/unplug events without depending on the digital protocol, so it doesn't have to be "polling" the digital pins to detect a plug or unplug event. The detection is done by monitoring the current on the 5V line between the 100 uF cap and the A connector: Plugging in a device will cause an outward-going current spike as the 100 uF capacitor quickly charges the device's (<= 10 uF) capacitor, and unplugging will be seen as an (AC) spike in the other direction as the current on the resistor (and hence its voltage drop) drops to 0.

So all you need is a current-sense resistor in the 5V line, a current sense amplifier, and a couple comparator circuits. (You could cut it down to one comparator if you use a PIO output to change the comparator's threshold as needed.)

\$\endgroup\$
1
  • \$\begingroup\$ While the device capacitor should work for plugging in, it does not by itself work for unplugging a device that is fully charged and has basically stopped drawing current. It really depends on how much current is being drawn by the idle device - just about none from the device's capacitor alone (unless it's a terribly leaky bad one). \$\endgroup\$ Dec 14, 2011 at 17:06
0
\$\begingroup\$

What if the micro usb had a protruding momentary switch. This would no be closed when unplugged that letting you know item is unplugged.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ This would work but would add another mechanical fault point. The Standard actually already defined a procedure for this. \$\endgroup\$
    – Kortuk
    Mar 25, 2012 at 16:33

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.