Electronic – Power source select for Raspberry Pi

gpiopower supplyraspberry pi

I'm creating a board which takes an external power source to drive motors which are controlled by a ULN2003A connected to the Raspberry Pi GPIO.

It would be nice if when the external power source is connected it could provide power to the Raspberry Pi itself through the 5V GPIO pin.

I appreciate this would require a voltage regulator, a polyfuse (to replace the one I'm bypassing that would normally protect the Micro B USB power input) and an ultrafast rectifier for reverse polarity protection.

My question is whether or not it is possible to detect that the Pi is already powered through USB and therefore block the back powering feature (to avoid having two sources connected).

Ideally if the user were to yank the Micro B USB cable the back powering would just kick in and take over. And likewise if the Micro B USB cable we re-inserted to disable it again. I don't really see how that could be possible so maybe it isn't!

Best Answer

It seems that what you are attempting is quite similar to what is implemented in the Arduino. See e.g. Arduino Uno's schematics. It requires a few external component (a MOSFET to serve as a switch, a diode, etc). to be implemented. I'm not familiar enough with the Raspberry Pi, so I dont know if this scheme could be implemented without modifying the board.