Combining power input and USB data port for a Raspberry Pi Zero (W)

by BrownZ   Last Updated June 09, 2019 09:25 AM

I am attempting to design some peripheral circuit around a Raspberry Pi Zero W for a portable project. It will be powered by a lithium battery. I want to bring out the USB port of the Pi; I also wanted to use the same port for charging the battery, so I don't have to have separate power jacks.

Essentially, I am piecing three things together: the Pi and other on board components as the main load, the battery management circuitry and the battery (henceforth referred to as BMC) as the main power supply, and a USB port.

schematic

simulate this circuit – Schematic created using CircuitLab

Here is a link to the actual, more comprehensive schematics draft for my particular project.

I can't just connect all the power rails together; the two ends of the BMC (VIN and 5V OUT) will be tied together: not good. I can't just force power in only; then I must have a externally powered hub for whatever USB device I might connect.

Now, the port can be either a power supply to the BMC (a charger or a battery pack), or a load drawing a wee bit of power (USB device). I figured that the device attached to the port is unlikely to switch between these roles. So my idea is if I can detect whether something connected to the port is a power source or a load, I can make the circuitry act accordingly: connect the power pin of the ext. port to 5V OUT of BMC if the port is a load or to VIN of BMC if the port is a power source; and maybe leave it hanging if the type can't be determined.

Question 1: Will simply checking voltage differences between the power pin of the USB be enough to differentiate loads from power sources? Say, will phones, self- or externally-powered storage devices, etc. have a voltage on their connections even if they do not meant to supply power? Will some USB device not be identified this way?

  • Question 1A: Is there a better way?

Question 2: If affirmative to 1, will my design below work?

schematic

simulate this circuit



Related Questions


Creating a 3S4P pack, making it safe

Updated June 07, 2019 22:25 PM


Appropriate Battery

Updated June 11, 2019 03:25 AM

Power supply switching circuit design

Updated December 15, 2018 05:25 AM