switch between external power and usb power

Thread Starter

ToBeFrank

Joined Nov 18, 2010
13
I am creating a board that has both an external power source and a usb power source. I would like to be able to switch between them with priority given to the external power source. Will I have any problems using the attached circuit?

 

Attachments

retched

Joined Dec 5, 2009
5,207
That circuit appears to have 3 inputs. 1 from the regulator, one from the 5v line, and another 5v from the USB.

I would look into power management ICs.

Maxim and TI both have offerings.
 

Thread Starter

ToBeFrank

Joined Nov 18, 2010
13
That circuit appears to have 3 inputs. 1 from the regulator, one from the 5v line, and another 5v from the USB.
There are 2 inputs and one output. There is a +12V input to the voltage regulator, which the regulator outputs as +5V. I labeled that "EXT +5V". The input from the USB port I labeled "USB +5V". The "+5V" label is my +5V power rail that goes to the rest of the circuit.

I would look into power management ICs.
Can you explain why? Will my circuit not work? Here is my understanding of this circuit:

1) If the external power is not connected, the gate of the p-channel mosfet will be low and thus drain and source will be connected allowing the +5V power rail to be connected to "USB +5V".

2) If external power is connected, the gate of the p-channel mosfet will be high and thus drain and source will not be connected and the +5V power rail will get power from "EXT +5V".

It's entirely possible I don't understand this correctly.
 

thatoneguy

Joined Feb 19, 2009
6,359
I don't see a reason to include the USB +5v at all. Without negotiation, you can only get 100mA from the USB port, while you can draw a 1A or more from the 12V-5V regulator, depending on type.

There are pre-made solutions to this problem inside nearly all external hard drive enclosures, if you have one laying around, or buy one for $15 or so. The power management and switching supply are built in to get enough current to run the drive.
 

Thread Starter

ToBeFrank

Joined Nov 18, 2010
13
You have the 5v rail connected to the gate also.. It will never go low.
You are correct. My bad! Attached is the corrected circuit. Could there be any problems due to the +12V not being regulated before going to the mosfet? EDIT: Never mind the italics part, assume the +12V is regulated (because it is).

 

Attachments

Last edited:

Thread Starter

ToBeFrank

Joined Nov 18, 2010
13
I don't see a reason to include the USB +5v at all. Without negotiation, you can only get 100mA from the USB port, while you can draw a 1A or more from the 12V-5V regulator, depending on type.
The external power source is a vehicle. I would like to be able to optionally power the microcontroller from the USB so firmware upgrades and retrieving of logged data can occur without having to be hooked up to the vehicle. I shouldn't need more than 100mA for that should I? If so, my understanding is I can get up to 500mA from USB if I code for it.
 
Top