Archive for November 18th, 2015
Adafruit’s Neopixels are RGB LEDs with a built-in current-limiting 400 Hz PWM controller and a serial data link. Successive Neopixels aren’t synchronized, so their PWM cycles can produce serious current spikes.
Lighting up just the red LED in two Neopixels at PWM 16/255 produces this current waveform (at 10 mA/div):
Each red LED draws about 20 mA, so when the two Neopixel PWM cycles coincide, you get a nasty 40 mA spike. When they don’t coincide, you get a pair of 20 mA pulses. Those pulses walk with respect to each other at a pretty good clip; the oscillators aren’t trimmed to precision.
Lighting up three Neopixels with PWM 16/255 on the red does exactly what you’d expect. The horizontal scale is now 100 µs/div, making the PWM pulses five times wider:
The narrow spike comes from the brief shining instant when all three Neopixels were on at the same time. Now you have three PWM pulses, each with slightly different periods.
Remember that these are PWM 16/255 pulses. When they’re at full brightness, PWM 255/255, there’s only a brief downtime between pulses that last nearly 2.5 ms and they’ll overlap like crazy.
Obviously, the more Neopixels and the lower the average PWM setting, the more the average current will tend toward the, uh, average. However, it will have brutal spikes, so the correct way to size the power supply is to multiply the number of Neopixels in the string by the maximum possible 60 mA/Neopixel… which gets really big, really fast.
A 1 meter strip of 144 knockoff Neopixels from the usual eBay supplier will draw 144 x 60 mA = 8.6 A when all the pulses coincide. Worse, the supply must be able to cope with full-scale transients and all the fractions in between. A husky filter cap would be your friend, but you need one with a low ESR and very high capacity to support the transients.
No wonder people have trouble with their Neopixel strings; you really shouldn’t (try to) run more than one or two directly from an Arduino’s on-board regulator…