A while ago, I asked about detecting whether a power jack is connected or not, in order to select power source from USB or DC jack.

You can see the question here: Power selection circuit for USB or DC Jack - both at 5V

I finally put together this circuit:

Power switch circuit On the input I expect a 5V supply.

I use a voltage divider (VJACK/2 = VSENSE -> going to a 3.3V uC input) to know if there is voltage at the DC jack (V-SENSE goes to a uC pin), and if there is enough voltage, I want to enable the power switch (AP2501M8-13 active LOW) in order for it to deliver the power for the rest of the circuit. Also, I'd like to detect if there isn't power (the DC jack was disconnected, or no voltage in the power supply), and in this case, disable the power switch.

I need this, cause I have two power modes in my system, and the HIGH power mode needs the power supply to run.

The problem I am having is that after unplugging the DC jack, I still have 5V in VIN and VJACK, so I can't detect with the micro controller a disconnect.

After unplugging the DC JACK, with the microcontroller, I enable and disable the power switch (EXT_POWER_EN line), and I still have 5V at the input. I would think that after disabling it, the input of the switch would go to 0V, dischargin C10 through R7 and R8.

I don't know if it's the power switch, that is bi-directional, or that it is not meant to be used like this, or that the 5V are leaking from somewhere else to the input, but I can't find the root of the issue.

I removed the C10 capacitor, to check if the problem was that it got charged, and could not discharge, but the problem persists without C10.

EDIT: Also, after connecting and disconnecting the DC Jack, if I touch VIN with a jumper wire to GND, it stays on GND, it doesn't get back up to 5V.

Any help appreciated!

  • \$\begingroup\$ The problem that you are having is that as soon as MOSFET Q1 is turned ON, there is always voltage at the input side of the MOSFET. The way that I deal with this problem is to insert a low-value resistor in series with the output side of the MOSFET and monitor current flow. \$\endgroup\$ – Dwayne Reid Jan 14 at 18:31
  • \$\begingroup\$ Hey Dwayne! Q1 is only a reverse voltage protection. When I say input and output, I refer to the power switch (U2). 5V line in the output of the power switch, are connected with the USB 5V. Then, when USB is connected, I get 5V at the input of U2 (VIN), until I connect this line to GND with a jumper wire. \$\endgroup\$ – sanotronics Jan 14 at 19:33
  • \$\begingroup\$ At which node is USB power connected to? \$\endgroup\$ – Dwayne Reid Jan 14 at 20:24
  • \$\begingroup\$ +5V at the output of the IC U2 \$\endgroup\$ – sanotronics Jan 14 at 20:40
  • \$\begingroup\$ Please try using a variety of resistor values and momentarily putting a resistor between "Vin" and ground. In other words, use a resistor instead of a short. Please modify your question with the results of that test. I would try resistor values starting at 10k and going lower as much as necessary. That is: 10k, 1k, 100R, 10R, etc. \$\endgroup\$ – Dwayne Reid Jan 14 at 23:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.