0
\$\begingroup\$

I am designing a little device to use inside my PC. My circuit contains a microcontroller which needs to communicate with the host system, and I wanted to do that via a USB port. The microcontroller will be powered by 5V, but my circuit also contains components that need 12V, so I want to add a 4-pin Molex connector to get power from the PC's PSU.

The question here is: to power the microcontroller, should I use the 5V that the USB provides or the 5V that the PSU provides? Is there any difference between the two in terms of amperage or how clean/stable/reliable the voltage supplied is?

Additionally, I wanted to ask someone more experienced about the following potentially crazy idea (I am almost certain this is a bad idea, but want to ask anyway): could I maybe use both? (connect the 5V pin of the USB to the 5V pin of the DC power connector?) Would there be a noticeable potential difference that could cause currents to flow between them (afaik, both of them fluctuate slightly, not exactly perfect 5V)? Would it be safe?

I am asking this because I don't know yet exactly how much power my device will eventually need to draw, and if merging the two 5V inputs is safe and doesn't lead to bogus power consumption, it could be an easy way to increase the current available without needing to add a second connector for more power from the PSU.

\$\endgroup\$
  • \$\begingroup\$ Do you really believe that it will require more than 500mA? \$\endgroup\$ – Ignacio Vazquez-Abrams May 16 '15 at 21:58
  • \$\begingroup\$ You almost certainly won't need both. Which one you should use will depend on how you interface to the USB. If you use a dedicated IC there should be reference designs for bus power or self power. If your micro controller has USB built in it might be easier to self power and skip negotiation. \$\endgroup\$ – David May 16 '15 at 22:07
  • \$\begingroup\$ I am using an Atmel AVR microcontroller without USB support, and then I hope to use the V-USB firmware/software implementation of the USB protocol, avoiding the need for extra hardware. \$\endgroup\$ – Jasen Borisov May 17 '15 at 14:01
0
\$\begingroup\$

Certainly NOT connect the PSU's 5 V to the USB 5V. The whole idea of the USB connector is providing power to peripherals which potentially misbehave. So the USB port should remain separate.

USB normally provides 100mA (which should be plenty for normal microcontrollers). Intelligent USB peripherals can negotiate up to 500mA by software.

The PSU can probably deliver over 15-20A on the 5V line, and somewhat less on the 12V line.

Note that the microcontroller's firmware has to be behave differently if it's selfpowered or draws from the USB port. The firmware has to inform the host on how it is powered (over the bus. This is part of the descriptor sent to the host when inserted). Frequently, USB devices feed from the USB +5V just for the communications, and use proper power for the rest.

Also, the peripheral has to disconnect its bus connections automatically when the USB +5V disappears, so it has to monitor that line.

I'd suggest that, unless you're wanting to heat coffee or other high current app, you use the USB power. It's less likely to interfere with the normal working of the PC. (And there might be an unused connector on the motherboard)

\$\endgroup\$
  • \$\begingroup\$ Alright, thank you, I understand. The USB port provides a lot less power then (I am not very familiar with the USB spec). I will try to use it in my prototype design and see if the power it provides is enough. If it is, I will stay with it. I will also familiarize myself with the most important aspects of the USB specification, so that I know what to expect in terms of behavior. Also, what do you mean that the firmware has to be programmed differently depending on the power source? I didn't quite understand what you meant by that. Could you clarify please? \$\endgroup\$ – Jasen Borisov May 19 '15 at 16:03
  • \$\begingroup\$ I edited the reply - I meant that the controller has to reply differently when self-powered or bus-connected. This has to be done by the firmware. \$\endgroup\$ – jcoppens May 19 '15 at 16:21

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.