I am using a Raspberry Pi 3 B+. Now I want to power up my Pi through GPIO pin 2 or 4 using a LM2576, and it should also work with USB power supply from adapter.

I want to know which supply is currently used by Pi, if both supplies are present I want to use only power from the LM2576.

  • You need to clarify "LM2576". – MatsK May 31 '18 at 15:33
  • LM2576 is a commonly found DC-to-DC buck converter found on Amazon. Not sure why OP needs to state that since Google provides the answer? – OyaMist May 31 '18 at 17:19
  • Devyani, I myself am powering all my Pi's with LM2576 via 2&4 from 12V. They're all around my garage and garden. I cannot think of a use case that requires USB power supply as well? Please tell us more. – OyaMist May 31 '18 at 17:21

I want to know winch supply is currently used by pi,if both supplies are present

That's not switchable, so they will compete. As far as I am aware, this is a bad idea, at the very least for the supplies.

| improve this answer | |
  • Actually, it's not an uncommon arrangement for redundant power schemes to be "OR'd" like this. – Seamus May 31 '18 at 19:39

My answer is only a slight variation from the one proposed by @MatsK.

First, you should know that your question does not seem (to me) to reflect a carefully-considered set of alternatives. You haven't explained what requirement or objective drives your specification that you will use power from one supply over the other. But your question does have an answer - perhaps not the answer you wanted, but if this doesn't fit, you can re-phrase your question, and perhaps we can do better!

Again, the "Diode-OR" arrangement proposed by @MatsK is the correct approach, although it may not address your preference for one supply over the other. I will attempt to do that here with a slight revision; actually I'll propose two different approaches. While you are considering all of this, you should read some more on the subject; here's an article on "Fundamentals of power system ORing". I've not considered the more complex design in this article (using a MOSFET instead of a diode) for this answer, as it just doesn't seem to warrant it.

Approach 1: Use a LM2576-ADJ

To give the LM2576 "priority" over the USB supply, you need to set its output slightly higher than the output voltage of the USB source. You can do this by using the "adjustable" version of the LM2576: LM2576-ADJ (brilliant name). As long as the LM2576 voltage output is higher than the USB, it will supply the current to the load, and the USB will supply little or none. The trick here will be setting it high enough to take the load off the USB, but not so high that you exceed the RPi specs for max voltage input. Schematically, the same as @MatsK's, but labeled to show the diffs:


simulate this circuit – Schematic created using CircuitLab

A coupla' things to note here:

  1. You should use Schottky diodes, and the ones I've chosen are not optimum. That drill is left for the reader.

  2. Due to the diode's forward voltage drop, the USB will only be able to deliver about 4.5 volts - maybe 4.7 volts if you find a good Schottky.

Approach 2: Use Different Diodes

Same principle here, but instead of tweaking the output of the LM2576-ADJ, we're going to use the standard LM2576, and give it "voltage priority" by using a diode with a lower forward voltage drop. The net effect is the same: The LM2576 will carry the load because its diode has a lower voltage drop than the one used for the USB supply:


simulate this circuit

The game in this circuit is diode selection. Both should be Schottky diodes; the one for the USB supply should have a slightly higher forward voltage drop. Ideally, the load and temperature curves for Vf will be similar. Again, the diodes here are not optimal, as that exercise is left for the reader.

| improve this answer | |
  • Where should i have to place 5v usb side diode ? I mean from usb socket or any other place? – Devyani Parmar Jun 3 '18 at 18:48

The PSU with the highest voltage will supply the Raspberry Pi with the power.

There is a risk with back power, if the voltage on PSU 1 is higher than PSU 2 there will be a current flowing from PSU 1 to PSU 2, this is the reason for the diodes, they will protect the PSU's from the back current.

Please remember that the diodes have a voltage drop that will impact in a decreased voltage level on the output to the Raspberry Pi.


simulate this circuit – Schematic created using CircuitLab

| improve this answer | |
  • 1
    Please fix this typo: "there will be a current flowing from PSU 2 to PSU 2" – Seamus May 31 '18 at 19:37

The simple answer is No! This is a bad idea.

On the Pi3B+ there is no isolation (other than polyfuse) between 5V and USB power - earlier models had an ideal diode to isolate USB power if power was supplied to 5V pin.

You appear to want to supply power via USB power and 5V pin - this would effectively connect 2 regulated switch-mode supplies together and the effect on feedback circuits is unpredictable - at best case only 1 supply would be used; at worst the power would be unstable and may oscillate.

The other answers, which suggest diode isolation, do not seem to answer the question you asked, as they suggest external combination and using a single power input. They would also cause a 0.7V drop, which would result in voltage below the recommended minimum of 4.75V.

It is possible to provide backup power, but this requires more sophisticated solutions. Devices exist (e.g. battery backup HATs) to do this.

| improve this answer | |
  • OK, so maybe I'm confused. Why don't you explain what you think he "appears" to want? Can you provide a diagram to illustrate your interpretation? – Seamus Jun 1 '18 at 1:15
  • @Seamus " power up my Pi through GPIO pin 2 or 4 using a LM2576, and it should also work with USB power supply" – Milliways Jun 1 '18 at 3:00
  • That's ambiguous, but I never expected a straight answer. – Seamus Jun 1 '18 at 16:57

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.