I am designing a device which must power a number of RGB LEDs. I am currently looking at WS2812 "NeoPixel" style LEDs, which have a max current draw of 60mA each. I would like to have a large number of these, but running at lower brightnesses.

The problem is that I want to supply this from a standard USB port, and I have more critical functions that run off of the same USB power, so I want some sort of current limiter/protection to ensure that the LEDs don't consume so much current that the USB controller shuts off the device.

  • Would a simple PTC/Re-settable fuse work?
  • Or something like this current limiter from Wikipedia.
  • Or should the supply be cut completely?

I don't need very high accuracy,but I would like to keep current under ~250mA±30mA.

Also since I need >100mA from the USB VBUS should I include a MOSFET or other way to disable the supply while the microcontroller is starting/restarting.

Finally I have seen some people recommend large(100-1000uF) smoothing capacitors to the LED's VCC. Which side of the protection should this be on?

  • \$\begingroup\$ Many people just use a separate power supply for the LEDs. In most cases, the grounds of the two power supplies can be connected together. \$\endgroup\$ – st2000 Oct 20 '17 at 13:40
  • \$\begingroup\$ Its a keyboard, so I would rather not have to have an external supply just for the LEDs. \$\endgroup\$ – Abex Oct 20 '17 at 13:49
  • \$\begingroup\$ That is going to be difficult. On one hand you likely should not draw more then 500mA total from the USB port. On the other you have, what, about 70 NeoPixels (assume 1 per key) that have the capability of drawing 60mA each. The simple answer is to be very very careful writing your software such that your total current use is well under 500mA. \$\endgroup\$ – st2000 Oct 20 '17 at 21:15
  • \$\begingroup\$ Not planning on doing per key RGB, if I wanted to do that I would find smaller LEDs and use Misunderstood's solution. Instead I just want some lighting on the underside, so ~20 LEDs at maximum. And yes, I will need to be very careful to ensure I don't overdrive my current restrictions, which is why I want some insurance to ensure they rest of the board doesn't shut down if this fails. \$\endgroup\$ – Abex Oct 21 '17 at 0:21
  • \$\begingroup\$ I found no such thing as "60 mA max current" in WS2812 datasheets. There are no specifications for this. As a matter for their suggested application circuit, the WS2812 manufacturer suggests 150R resistor in Vcc rail that feeds LEDs. This means that all three LED's can't possibly consume more than 20 mA (150 Ohms over 3 V drop worst case). There is a variant WS2812B, it also has no meaningful specifications. \$\endgroup\$ – Ale..chenski Oct 21 '17 at 20:06

Would a simple PTC/Re-settable fuse work?

PTC's are very slow. This is often used in the host to prevent board damage because they are cheap. If you want any selectivity (eg: your protection tripping first) you'd want something faster.

Or something like this current limiter from Wikipedia.

A current limiter will prevent you from tripping the host protection, but will also cause brownout on the microcontroller or ws2812.

Or should the supply be cut completely?

Yes, you want the power to trip immediately without your microcontroller browning out or the host protection to trip. Prevent the USB connection to be lost.
Luckily you can get current limited power switches. Take a look at mic20xx for example.


I would consider using Cree RGB CLMVB-FKA controlled with a TI TLC5973 3-Channel, 12-Bit, PWM Constant-Current LED Driver with a single resistor to set the maximum current. Or a TLC59731 3-Channel, 8-Bit, PWM LED Driver which uses a resistor inline with each LED.

The TI parts are superior to the NeoPixel. Uses a single wire interface. LEDs can be powered separately from the driver. And MUCH better documentation.

enter image description here

  • 1
    \$\begingroup\$ Yes, I would second this advice. The WS2812 design is deficient, it has three LEDs with vastly different voltages (RED=2.2V, Blue = 3.4V, per their documentation), while all of them having a single supply rail. An no mentioning of any current limiting. I am not sure how it works at all. \$\endgroup\$ – Ale..chenski Oct 20 '17 at 21:27

If you mean a standard USB port on a externally powered personal computer, then you can safely draw 500 mA without doing anything, especially if you are doing this for your home. Of course you need to make sure that your LED strip doesn't take more than that.

If you mean some product based on this keyboard with bunch of LEDs for sale, it is a different story, especially if you want to pass USB certification.

  • 1
    \$\begingroup\$ I would recommend you read up on the USB specification first. \$\endgroup\$ – Jeroen3 Oct 20 '17 at 18:47
  • \$\begingroup\$ @Jeroen3, I kindly suggest to take your recommendation back, remove your remark, and your vote immediately. Please read the Section 7.2.1 of USB 2.0 Specifications. First bullet reads: "... Systems that obtain operating power externally, either AC or DC, must supply at least five unit loads to each port..." \$\endgroup\$ – Ale..chenski Oct 20 '17 at 21:17
  • 1
    \$\begingroup\$ please keep reading. \$\endgroup\$ – Jeroen3 Oct 21 '17 at 17:00
  • \$\begingroup\$ @Jeroen3, which part of the words "must" and "at least" did you fail to understand? \$\endgroup\$ – Ale..chenski Oct 21 '17 at 19:26
  • 1
    \$\begingroup\$ @Jeroen3, I can't disagree with your position. That's why I said that if OP is trying to make a USB device as product, "it is a different story". The confusion between 100 mA and 500 mA is still alive on Internet, see details here, electronics.stackexchange.com/a/314188/117785 \$\endgroup\$ – Ale..chenski Oct 21 '17 at 19:49

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.