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.
Well, I did my troubleshooting as follows:
Code: Select all
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)
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:
It seems to me, until now, that I have only two ways to go from here: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.
5. LEDs drive 60mA when at full power, so at most they will draw 60.72A
6. 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.
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!