Glitchy WS2812B LEDs

Hi!

I’m currently developing a project where I’m controlling 1012 WS2812B LEDs using a raspberry pi 3 B and I’m having an annoying issue where my LEDs keep glitching. For example, if I drive all the LEDs green at the same time, they flick or chunks glitch blue or some LEDs turn red for a few microseconds. I’ve tested with an Arduino and I don’t have the same issue, but since the Arduino has much less memory it is much more hard to create interactive animations, so I’ve switched to rasp.

This is my setup:

  • Rasp 3 B

  • 1012 WS2812b connected as a stripe

  • External 5V 70A power supply

  • Infrared sensor (this is irrelevant to the problem, since LEDs flick even without using the sensor)

This is a sample blinking code, that illustrates something that is enough to make my LEDs glitch.

import board
import neopixel
import time

pixel_pin = board.D18

num_pixels = 1012
color = 0

pixels = neopixel.NeoPixel(pixel_pin, num_pixels, brightness=0.5, auto_write=False, pixel_order=neopixel.GRB)

while True:
    pixels.fill((0, 255, 0))
    pixels.show()
    time.sleep(1)
    pixels.fill((0,0,0))
    pixels.show()
    time.sleep(0.2)

Well, I did my troubleshooting as follows:

  1. Yes, the GNDs are all connected (external power supply, LEDs and Rasp), checked continuity with multimeter and they are, indeed, all connected;

  2. Tried a similar code using Arduino and they all blink fine, no gliches so the LEDs are ok;

  3. Tested power supply and its delivering steady 5.2V

  4. I’ve found an article (https://ben.artins.org/electronics/glitchy-neopixels/) that says:

The root of the problem here is that — according to the NeoPixel data sheets — the NeoPixel data line voltage (in logic-high state) has to be at least 0.7× the NeoPixel power voltage.

  1. LEDs drive 60mA when at full power, so at most they will draw 60.72A

  2. External power supply has 3 connectors for GND and 5V and I’ve divided the LEDs almost equally in 7 groups/lines connected to VCC and GND even though they are all connected through Dout->Din. They are all connected to the same power supply, I’ve just tried balanced the current going through the cables.

In other words, the power voltage has to be at most 1.43× (= 1 / 0.7×) of the data line voltage. Therefore, if the data line is at 3.3V, then the highest voltage you can put on the power line and still have a reliable NeoPixels is 1.43 × 3.3V = 4.71V.

As a result, if your NeoPixel power is close to 4.7V, the NeoPixels will be unreliable in interpreting its data line, resulting in flicker and random color changes.

It seems to me, until now, that I have only two ways to go from here:

  1. Match my data line voltage to at least ~3.7V (70% of my 5.3V power supply )

  2. Match my LEDs VCC to maximum ~4.7V (143% of my 3.3V data line voltage)

So, I know that sometimes making things simple are not possible but I would like to keep it as simple as possible. Main questions are:

  1. Can I use transistors to match my data line voltage to something close to 5V?

  2. How can I drop my current from 5.3V to 4.7V, considering it might draw 60A? Diodes drop more voltage as more current is drawn, right? Rectifiers?

Any other ideas, hints and thoughts are much well appreciated!

Cheers!

Best bet is to try a level shifter to interface the 3.3v processor to the 5v Neopixels. 74AHCT125 (or the single-gate SOT23 version) seems to be the most common solution. I wouldn’t try dropping the supply rail as you will already be fighting voltage drop issues along your LED chain. If you must, use a supply with an adjustable output. Dropping 60A 0.7v with a diode will dump 42W of heat in the diode that you need to get rid of.

/mike