# Is there a simple way to detect which connector is powered?

I have a circuit with two power connectors, J1 and J2. I would like to be able to detect which one the power is coming from. The trick is that the connectors need to provide power to each other. See concept drawing below. I can't think of any way other than putting in a series impedance and then using a diff amp to detect current direction. Can anyone think of a simpler way? Currently I'm using a jumper on the board to tell the circuit which one is providing the power.

The voltage is 24Vdc. Current range is 20mA to 800mA. Induced voltage drop can be around 1Vdc.

The reason is to have the circuit under power behave differently (master/slave) ie. Master is powered via J1, and the slave is powered by J2.

simulate this circuit – Schematic created using CircuitLab

• What range of currents and voltages are we dealing with? Details in your question, please, rather than in the comments. What voltage drop can you tolerate. Aug 22, 2018 at 22:50
• Why do you need to know which connector the power is coming from? Is that because they could both be powered? As you schematic shows now there isn't a problem. Aug 22, 2018 at 23:31
• The reason is to have the circuit under power behave differently (master/slave) ie. Master is powered via J1, and the slave is powered by J2. Aug 22, 2018 at 23:36
• Hall effect current sensors are directional but you'd have to consider specifics to see if they are applicable. Aug 22, 2018 at 23:49

It's possible to reliably detect microvolt voltages. Say you pick 100uV as something that's easy to do reliably. A 0.5" trace that is 50 mils wide will drop 100uV at 20mA. At 800mA it will drop around 5mV, pretty much negligible.

Take an op-amp such as the Microchip MCP6V61T- it has a guaranteed Vos of less than 5uV and draws only 80uA. The chip can only take 5V so you'd need a supply, or there are more expensive parts (eg. OPA192) that will work directly from 24V.

Your circuit could look like this:

simulate this circuit – Schematic created using CircuitLab

You may not need the 1K resistors and capacitor but if there is a strong surge (say to charge a capacitor) then you could conceivably exceed the 300mV or so input range of the op-amp. That would be more than 40A with the suggested 0.005 ohm trace resistance, and more like double that with the op-amp ground placed in the center of the trace.

• I like this idea, but @frarugi87 brings up a valid point, sometimes there is no slave device connected, so the master may not be able to detect this state. Aug 24, 2018 at 15:02
• You can either add a dummy load to the slave or make a window comparator or half a window comparator (offset the input(s)) to detect all 3 situations if you want. Aug 24, 2018 at 18:54

The problem with detecting the voltage drop is that it is highly dependent on the current absorbed. If the slave is disconnected then the master may not know who it is.

A solution used for instance on USB otg is to have an additional pin on the connector, and then use it to signal what it should be.

For instance 1) you connect the wire to GND for the master, and leave it open for the slave. This way you will be able to use both connectors, and choose the master with the cable. Cables are 2 wire 2) you make wires "directional", then the "outgoing" end has it disconnected and the "ingoing" is connected to gnd. This way you will know where is the power coming (the pin connected to ground) 3) other solutions which can come in mind

Best regards