# OTG detection with only signal wires

USB On-The-Go (OTG) has an "attach detection protocol" (ADP) which allows the host device to know if a peripheral is connected.

ADP periodically measures the capacitance on the USB port to determine whether there is another device attached, but the implementation gets cloudy.

There's a short description of ADP on the Wikipedia Page and here is the official documentation. I've read both but maybe I'm not getting something.

In my application, a DPDT relay will be used to switch the VCC and GND of a USB cable between a charger and an OTG cable. However, the signal wires will remain connected to the OTG side all the time. Will this trigger the Attach Detection Protocol and cause the host to supply power at the wrong time?

EDIT: I found this on the official documentation page 22 and it seems to be answering my question.

ADP operates by detecting the change in VBUS capacitance that occurs when two devices are attached or detached. The capacitance is detected by first discharging the VBUS line, and then measuring the time it takes VBUS to charge to a known voltage with a known current source. A change in capacitance is detected by looking for a change in the charge time.

Since only the VBUS (5V) is used, is it safe to say that ADP won't be triggered by the signal wires by themselves?

• post that as an answer and accept it ... maybe include the last sentence from page 22 (the one about complex capacitance) – jsotola Nov 28 '17 at 2:11
• some OTG considerations here usb.org/developers/docs/devclass_docs/batt_charging_1_1.zip on OTG and battery charge considerations. – Tony Stewart Sunnyskyguy EE75 Nov 28 '17 at 2:17
• Never seen in my life a real off-shelf device that uses any of "session control" or "VBUS pulsing" protocol, only in prospective reference designs of deep past. As China manufacturers have decided, OTG host knows if a device is attached when the ID pin gets grounded. Then it drives the VBUS out. If not, it remains as device. This is how the entire industry of smartphones operates, sorry. In any case, OTG is obsolete. The function of role swapping has moved to Type-C specifications. – Ale..chenski Nov 28 '17 at 2:53

This is required for ADP detection as described in the USB 2.0 OTG & Embedded Host specification.