This question already has an answer here:

I am building a backlit button box for my PC and the controller has 2x 5 V power supplies on it from the USB. I am using 7 of these LEDs and the power specs are at the botton of this post. The controller website doesn't specify the amp output of the controller so I simply don't know.

For blue, white it is 3V, 20mA, forward voltage is 3-3.2V

Edit: reyann zero delay USB encoder


marked as duplicate by brhans, Voltage Spike, JRE, JYelton, Sparky256 Aug 2 at 2:15

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    \$\begingroup\$ What type of controller do you use? Some more information would be very helpful ;) \$\endgroup\$ – jusaca Jul 29 at 16:15
  • \$\begingroup\$ Before @jusaca edited the post, there where "2 5V power supply" on the controller. After editing, it has a "2.5V power supply". What's going on here? \$\endgroup\$ – Enric Blanco Jul 29 at 16:40
  • \$\begingroup\$ Ohhhh, I think I completly misread and figured that was just a spelling mistake. I guess you are right, I will revoke that change. \$\endgroup\$ – jusaca Jul 29 at 16:45
  • 1
    \$\begingroup\$ Post a pic of the controller, or any information available that could help. Otherwise this question is likely to end up closed. \$\endgroup\$ – Enric Blanco Jul 29 at 16:53
  • \$\begingroup\$ added controller \$\endgroup\$ – Jamie Jul 29 at 18:55

This is your controller connector layout, taken from your link:

Controller connector layout

So it looks like the 5V (red) connectors should be drawing power from the USB interface because there's no external power connector input. Can you use them for you LEDs? Let's see.

First thing to be aware is that there are some current limits in the USB specification. These go as low as 100 mA for a low power device. When an USB device is connected, and prior to configuration, it can only act as a low power device. Once it is configured, it can be allowed to draw current higher than that, but not before (safety feature).

A high power device can draw 500 mA. There also other USB power standards like SuperSpeed (USB 3.x), Battery Charging and USB-C out there than can draw as much as 3 A at 5 V, but I seriously doubt that your controller can configure itself in one of these modes.

So you'll get 500 mA (at most) assuming that your controller can configure itself as a high power device. But this is the first thing that you shold check!

Your 7x 20 mA = 140 mA is beyond the 100 mA limit. This means that you should somehow delay their turn on after the controller configures itself as a high power device. Once it is configured that way, then the current limiting resistor value required for each led is a very simple calculation:

  1. The current through the resistor must be 20 mA.
  2. The voltage dropped across the resistor must be the remaining voltage after the diode drop. In this case, 5 V - 3.2 V = 1.8 V.
  3. The resistor value should be then 1.8 V / 20 mA = 90 Ohm.
  4. The resistor power rating should be better than 1.8 V * 20 mA = 36 mW. A typical through hole resistor is 1/8 W = 125 mW so it'll be fine.

You can refine this calculation. The USB specification allows a 5% tolerance on the power line. On the other hand, some of your LEDs can drop as low as 3V. The voltage dropped across the resistor will be then 5.25 V - 3 V = 2.25 V. The resistor value should be then 2.25 V / 20 mA = 112.5 Ohm. Select a 120 Ohm 1/8 W resistor and you'll be fine.

As a final note, I would recommend that you consider reduction of the LED current. 10 mA (or even less) might be bright enough for your application, and could help you getting below the total 100 mA mark. That could help simplify your setup (no need to delay the LEDs turn on), or even make it feasible in case your controller is a low power device (hard 100 mA limit). Use a potentiometer to experiment with different brightness/current settings for a single LED, and then set the final value of the resistors accordingly.


So, looking at the link, my suspicion is that the 5V output is just coming directly from the USB - so it could supply much more than what you need for a few LED's.

The basic steps to determine the resistor here is

  1. Determine the voltage drop required, Vin - Vled = 5 - 3 = 2
  2. Determine the current required for the LED and resistor as they are in series - 0.02A
  3. Calculate the resistance by dividing the voltage across the resistor by the current: 2/0.02 = 100 ohms

This will also dissipate 0.04W in the resistor, which should not be an issue as standard resistors handle at least 0.125W. Also, as you are probably aware each LED should have it's own resistor.

  • \$\begingroup\$ so does that mean I need a 100 ohms resistor on each anode or each diode? and do I connect each LED to the power source or in series? \$\endgroup\$ – Jamie Jul 30 at 14:45
  • \$\begingroup\$ Until I re-read your post, I was assuming the LED's would be individually controlled, so it would be a resistor for each LED as in the top part of this image. However, if you just wanted all on or off, you could have one resistor that carries the sum of the LED's in parallel (L3, L4, L5), ie 60mA and then a resistor of 300 ohms. Also Enric's answer has some useful info. One final note, if you did plan to have 1 resistor for all 7 LED's, the resistor would need to handle 7*20mA * 2V = 0.28W \$\endgroup\$ – Bryan Jul 30 at 21:04

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