-2

The PC's USB port design to suppply 5V to connected device but what if device already has 5V supply? Considered voltage stabillity/accuracy and data-tranfer abiility, what is the best way to do?

  1. Don't use USB 5V, just use common ground to transfer data.
  2. Use USB 5V to power device and disconnect internal 5V supply.
M lab
  • 1,191
  • 6
  • 21
  • That would depend on what the device is. And you don't mention it. – Justme Nov 14 '20 at 19:11
  • And USB-A and USB-B ports are designed to prevent this being a problem. Again, no information in your question. – Transistor Nov 14 '20 at 19:13
  • @Justme I asking for general device that I design. something that power by AC plug or battery and plug to PC sometime like 3D printer or robot. – M lab Nov 14 '20 at 19:23
  • @Transistor but how?? – M lab Nov 14 '20 at 19:24
  • Have a look at some existing circuits. The 5 V Arduino boards can be powered over USB or from an alternate source through the on-board regulator. The schematics are freely available. – Transistor Nov 14 '20 at 19:29
  • You can use a MODIFIED version of the PMOS reverse polarity ideal diode. Modified is important because the simple PMOS ideal diode only protects against reverse polarity NOT current being forced backward through it from the load side – DKNguyen Nov 14 '20 at 19:31
  • if you plan to never power the device from USB, then power only the USB interface .... use only common ground and data connections between the USB interface and the rest of the device .... the USB interface could be external to the device – jsotola Nov 14 '20 at 19:38
  • Devices you mention are so high powered that they would not work with USB power, so USB powering is not even possible. So USB power can be left sometimes unconnected or simply used for detecting if there is a USB connection plugged in or not. It does not have to power anything. – Justme Nov 14 '20 at 20:42
  • 1
    (there's literally dozens of similar questions on how to savely operate from one of two power sources, whichever is present, you've not looked far enough) – Marcus Müller Nov 14 '20 at 21:01

2 Answers2

1

You listed two options, and both are incorrect. The correct version is:

  1. Use your local 5V supply to power everything you need to power, MCU, whatever, but you must use the VBUS voltage level (aka USB 5V) to start USB interface. Thus you just need to sense the VBUS, translate it into your logic level, just as a logic signal, no more. See more here.
Ale..chenski
  • 38,845
  • 3
  • 38
  • 103
1

What you are describing is called a "Self-powered function" in the USB 2.0 specification section 7.2.1.

The key points in the spec are...

No device shall supply (source) current on VBUS at its upstream facing port at any time. From VBUS on its upstream facing port a device may only draw (sink) current. They may not provide power to the pull-up resistor on D+/D- unless VBUS is present (see Section 7.1.5). When VBUS is removed, the device must remove power from the D+/D- pull-up resistor within 10 seconds. On power-up, a device needs to ensure that its upstream facing port is not driving the bus, so that the device is able to receive the reset signaling. Devices must also ensure that the maximum operating current drawn by a device is one unit load, until configured.

The typical setup to switch between USB power or another power source is to tie the grounds together and use a pair of diodes (or ideal diodes) to switch between the power sources.

The USB specification wants the upstream facing interface on the device to not back-power the host in any way. This includes providing power to pullup resistors when VBUS is removed. For that reason, whatever chip is providing the USB interface (FTDI chip, MCU, etc) is usually powered directly from usb VBUS in order to meet the requirement of the USB specification. The rest of the system can be powered as you please.

user4574
  • 11,816
  • 17
  • 30