I have an industrial PC which has some usb ports, and I want to use that port to get 5V and convert it to the 3.3V (with decoupling caps). But now I need to use that 5V to drive 12 relays on my board.

My question is that, Can I directly use that 5V, or should I add some filters or sth? I worry about the computer, when I connect them, can any current flow back and destroy the computer? Here is the schematic of my power port and 3.3V output.

enter image description here

  • 3
    \$\begingroup\$ How much current do the relay coils use? How much current does your board draw? What is the current rating of the USB port you want to draw power from? \$\endgroup\$ – Andrew Morton Jul 25 at 12:59
  • \$\begingroup\$ Coil current is 80mA but I dont know the total requirements of the board, should I calculate the total current requirements? The USB port that I'm going to connect, will supply 0.9A (USB 3.0) \$\endgroup\$ – Teoman Açıkgöz Jul 25 at 13:02
  • \$\begingroup\$ 12 relays * 80 mA per relay = 960 mA. Then you have to add on the board's current requirement and it starts to look like you may need an external PSU. \$\endgroup\$ – Andrew Morton Jul 25 at 13:05
  • \$\begingroup\$ For the other part of your question, Why is there a diode connected in parallel to a relay coil? \$\endgroup\$ – Andrew Morton Jul 25 at 13:05
  • \$\begingroup\$ @AndrewMorton I found another relay which has coil current 16.7 mA, so in this case I can use the usb port as a supply? \$\endgroup\$ – Teoman Açıkgöz Jul 25 at 14:18

Officially, an USB device has 1 power unit (100mA) when nothing more was negotiated. It's slightly more complicated if you add standby power requirements to the equation, since this power is time limited, but I have yet to see a host that enforces this.

After the 1 power unit (100mA) you can ask for more. This can be rejected.
However, many PC USB 2.0 ports are always capable of 500mA unless otherwise specified. An USB 3.0 can negotiate up to 900 mA, most likely this will be available without special enumeration.

Higher voltages with USB PD Type C are not possible, you must use an USB PD Controller for that.

One other consideration is the maximum inrush specification. I recall for USB 2.0 this being 4.7uF, which is quite low.

Enough XY-problem. You are talking about an industrial PC. This is most likely fed from a 24V uninterrupted supply bus which you can also use for this. That is much more suitable and standard way of doing things.


Can I use the power from a computer USB port to run my board?

YES, providing you remain within the intial power delivery limit, or negotiate a higher current from the port (more work).

You need to understand the Power Delivery (PD) spec, but you could start reading here.

To prevent backflow of power you would typically use a series FET within your power supply.

Obviously there are many existing USB peripherals (which are themselves embedded systems) that connect to USB. One problem you face is that if you have to negotiate higher current, then there may be a problem when the Host computer sleeps, or powers off. You might lose power under various circumstances that may be difficult to manage.

One suggestion to consider if you are building a professional solution is to tap into +5VStandby. This requires a plug in board within the computer, but allows power all the time except when unplugged. I use this to run a Raspberry Pi from my computer, and it is always on.

If you are using relays within you embedded system then you obviously handle any back-EMF problems within your board. No other implications exist for the upstream power other than staying within the power rating.

NOTE: As suggested in another answer you should NEVER parallel USB port power connections.


Your circuit can be used as long as the current draw does not exceed the limits of USB specification. Check which type of USB you have and if you can indeed switch your relays using this, you may need to connect multiple USB ports in parallel to achieve this you are better off using an external supply.

Regarding input voltage protection, check your LDO if it has reverse current protection,for example this one does: TPS7B7702 .

If it does not, you'll need to add a Schottky diode between USB and LDO input to prevent reverse current. Naturally, this will lead to some drop across the diode.

  • 1
    \$\begingroup\$ Never connect multiple USB ports in parallel you have no idea of the internal implementation or control. \$\endgroup\$ – Jack Creasey Jul 25 at 13:24
  • \$\begingroup\$ Fair point, I have fixed my answer. \$\endgroup\$ – khan Jul 25 at 13:44
  • 1
    \$\begingroup\$ @JackCreasey -- so the ASUS CD-ROM drives that used to be sold with a USB Y cable are not compliant?? My assumption always was that only the power and ground were connected, and the passive port would provide the default unnegotiated current. \$\endgroup\$ – Scott Seidman Jul 25 at 13:54
  • \$\begingroup\$ I dont think the total current will exceed, I have 24V supply but getting 5V looks simple that's why I asked. \$\endgroup\$ – Teoman Açıkgöz Jul 25 at 14:23
  • 1
    \$\begingroup\$ @ScottSeidman I'd suggest the ASUS CD-ROM drives were probably not compliant ….but there are lots of USB peripherals out there that are non-compliant. Imagine what might happen today if you tried a Y-cable on a USB port with a standard peripheral and a charger than negotiated 12V ….I don't think it would be a pretty picture. \$\endgroup\$ – Jack Creasey Jul 25 at 14:32

If you dont have any warranty lef then:

Why use USB, Just cut a Red wire for 5V, an Orange Wire for 3.3V, and Black wire for ground directly from PSU. Attach wires and bring them outside the case. Solder them and insulate them properly.


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.