Electrical – How to calculate capacitor size in relation to LED quantities

capacitorcurrentled striprgb

According to the NeoPixel best practices (which is the exact product I'm using):

Before connecting NeoPixels to any large power source (DC “wall wart”
or even a large battery), add a capacitor (1000 µF, 6.3V or higher)
across the + and – terminals as shown above. The capacitor buffers
sudden changes in the current drawn by the strip.

Seems to me that the size of the capacitor is linked to the amount of pixels to be used (since more pixels = more max current drawn). If I'm correct, would anyone care to explain how to calculate the capacitor size in relation to the amount of pixels?

Some extra specs:

  • Each individual NeoPixel draws up to 60 milliamps at maximum brightness white (avg 20 milliamps).
  • They require 5V.

Update based on comments:

  • Power supply will be a low quality wall wart that puts out anywhere from 9-15V (but my circuit has a LM7805 voltage regulator that will bring this down to 5V.
  • The distance from the capacitor to the first LED in the strip will be around 1 inch.

Best Answer

This will not provide an answer on how to calculate the capacitor size, but I'll use the answer space to draw a small model of a NeoPixel strip + Power supply + cable. This might help you understand the role of the capacitor. I'm sorry if you already knew any of this.

Data lines are not shown, etc.

schematic

simulate this circuit – Schematic created using CircuitLab

Ok, so when the strip draws current, current goes through the cable and with the parasitic R of the cable causes a voltage drop (U = R*i, Ohm's law). The longer and/or thinner the cable, higher the parasitic R and more severe the voltage drop.

During these voltage drops, the capacitor is there as a buffer, as the guide suggests. This also means that if the parasitic R of the cable (and of the power supply) is negligible, the capacitor will make little difference. In the same way, its benefits are limited by the Parasitic R of the Strips itself (measure the voltage of a long strip, it will be far below 5V when on, you might even notice some color change).

So while it may be possible to calculate ripple vs capacitor size, I suggest you determine this empirically, if possible watching the 5V line with a scope as the LEDs light up.