0

I'm currently working with some WS2812B LEDs and tried out adding a capacitor to be safe from voltage spikes (was recommended by Adafruit). I noticed that a soon as I connect a capacitor between 5V and ground that the USB is disconnect from the PC (Windows Usb disconnect sound plays). I wondered why and tried another setup. This time just the capacitor between 5V and ground. Nothing else. According to my knownledge this isn't a short (capacitor is intact) and therefor this setup should be valid. Again the same thing happens: USB disconnects...

I really don't know why this happens but want to understand it. The capacitor I use is rated 16V 1000 mF (electrolytic in case this is relevant). The capacitor is also connected the right polarity. What forces the USB to disconnect (and let Windows play the USB disconnect sound). Am I may damaging the USB Port somehow and therefor a disconnect is forced as a security measurement?

Oh yeah... Using an Arduino Uno R3 made by Elegoo.

Hope you can help me out, Tmirror

1
  • put the capacitor on the other end of the LED strip; it does more good there anyway by smoothing the borderline low voltage situations at the end (possibly buying you several more stable pixels), and it uses the strip's intrinsic resistance to limit inrush current spikes. That said, you still might need a smaller capacitor if you want to power over USB and avoid the protection mechanisms. You might also try a powered USB hub; those are often a lot more forgiving than built-in ports, which are better protected because blowing a built-in really sucks...
    – dandavis
    Commented May 30, 2020 at 21:27

1 Answer 1

1

The USB specifications allow a maximum of 10uF total capacitance on the USB power lines. By putting 1000uF you have given it 100x more than is allowed.

This causes a massive inrush current and the USB host (your computer) sees it as a short circuit, so it shuts off the power in a panic to protect itself.

A capacitor does have a role to play in helping to remove power supply noise caused by power-hungry and noisy devices like WS2812B LEDs, but just slapping it across the power supply pins isn't going to really help.

Instead you should increase the impedance of the power supply to the noisy device(s) and use a capacitor to reduce the impedance again. This will help to preferentially draw current from the capacitor to supply the LEDs while smoothing out the draw from the main supply over time.

A simple circuit is to use a resistor with a capacitor:

schematic

simulate this circuit – Schematic created using CircuitLab

The values I show there for the resistor and capacitor are pretty random. The smaller the resistor the more demand will be put on the power supply. The bigger the resistor the more demand will be put on the capacitor. If the resistor is too big the capacitor won't be able to store enough power to run the LEDs, and too much voltage will be dropped across it. If the capacitor is too small it won't be able to store enough power to run the LEDs. Tuning those values depends very much on the amount of noise there is and the current draw of the LEDs.

You must also make sure the resistor can handle the amount of power dissipated by the current flowing through it.

4
  • If we'd need a 10R (or greater) to limit current to the official 500ma @5v, we can only fully turn on 2 rgb LEDs before 1.2v is lost through the resistor and the blue LEDs and ws2812b start having issues with undervoltage...
    – dandavis
    Commented May 30, 2020 at 21:23
  • @dandavis Like I said, the values I show are random. Choose suitable values depending on the situation.
    – Majenko
    Commented May 30, 2020 at 21:25
  • Sure, but unless the situation is "power a strip of 2 LEDs", there's no values that work...
    – dandavis
    Commented May 30, 2020 at 21:28
  • If you draw 400mA through a 0.25Ω resistor it will drop just 0.1V. uk.farnell.com/multicomp/mcknp0w2j025ka10/…
    – Majenko
    Commented May 30, 2020 at 21:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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