Author Topic: Using USB data pins for device identification in battery charging application?  (Read 2794 times)

0 Members and 1 Guest are viewing this topic.

Offline clemTopic starter

  • Newbie
  • Posts: 4
I'm working on my first battery powered project and I'm using USB for charging (no data). As part of the user interface for the device I need to be able to tell the difference between two different charging bases. The UI changes when the device is plugged into 'base A' and a different behavior when it is plugged into 'base B'. The device needs to be able to identify the two different bases even if the base is unplugged. This isn't for something like setting the charging rate, it is purely a UI behavior specific to the device.

My initial plan was to use the ID pin for this, but it seems that using D+ and D- are preferred. However the USB battery charger spec says that Dedicated Charging Port should short D+ to D-.

My current idea is to pull D+ to 3v3 though a 4k7, D- to ground with a 4k7 and connect D- to an ADC pin. In one base I'll put a 4k7 and the other a 10k across D+/D-. This way I'll be able to tell if the device is connected to the base even if the base itself is not plugged in (the 3v3 comes from the battery). Most chargers seem to leave D+ and D- open others short D+ to D-. If D+/D- is open I'll get 0V on the ADC and 1.65V if it is shorted. However, I'm not sure how a PC handle having D+ at 3v3 and D- at GND.

I realize this is non-standard, but any ideas how non-compatible it will be? Any ideas for a better way to implement this?
 

Offline kxenos

  • Frequent Contributor
  • **
  • Posts: 284
  • Country: gr
In the charging base you can short D+ with D- and connect these pins with a, say, 100k to GND and 200k to Vcc. In the other charging base do the opposite: 200k to GND and 100k to Vcc. At the mobile just compare D+ or D- with Vcc/2.
 

Offline amyk

  • Super Contributor
  • ***
  • Posts: 8240
However, I'm not sure how a PC handle having D+ at 3v3 and D- at GND.
That's how a full-speed/high-speed device is detected when plugged in. The host will have its own 15k pulldown resistors on D+ and D-. http://www.beyondlogic.org/usbnutshell/usb2.shtml
 

Offline Memphis

  • Contributor
  • Posts: 27
  • Country: cz
  • In quantum theory, we are lost in space and time.
    • My personal YT channel
Would be better to review the USB 3.0 and USB 2.0 specification for this 8)
http://www.usb.org/developers/docs/
...sorry for my english :palm:
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf