-3
\$\begingroup\$

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.
\$\endgroup\$
9
  • \$\begingroup\$ That would depend on what the device is. And you don't mention it. \$\endgroup\$
    – Justme
    Nov 14, 2020 at 19:11
  • \$\begingroup\$ And USB-A and USB-B ports are designed to prevent this being a problem. Again, no information in your question. \$\endgroup\$
    – Transistor
    Nov 14, 2020 at 19:13
  • \$\begingroup\$ @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. \$\endgroup\$
    – M lab
    Nov 14, 2020 at 19:23
  • \$\begingroup\$ @Transistor but how?? \$\endgroup\$
    – M lab
    Nov 14, 2020 at 19:24
  • 1
    \$\begingroup\$ (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) \$\endgroup\$ Nov 14, 2020 at 21:01

2 Answers 2

1
\$\begingroup\$

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.

\$\endgroup\$
1
\$\begingroup\$

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.
\$\endgroup\$

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