First LED flickering/wrong Color WS2812B

I'm running 110 WS2812B LEDs with an Wemos D1 mini clone (AZDelivery) and the first LED flickers and won't even turn off but rather show red or green. I changed the data line cable several times, tried different resistor values (220,370,520), changed the first LED with new ones even from different sellers and changed the Wemos Pin from D5 to D0.

In the beginning it worked well for around 4-5h before the flickering started when the brightness of the LEDs changed. After that no ever what I did it won't stop even though all the other LEDs run perfectly. Even when disconnecting the single LED from the rest it still flickers. The measured voltage from my 8A Meanwell powersupply was 5.18V max. My code is using the FastLED library and dimms the LEDs based on the surrounding light and eventually turns them off. The data line cable is around 20-30cm long and soldered on the Wemos Pin.

Any ideas what's the cause? It has to do with the data line because otherwise all other LEDs would be affected too if my powersupply would be the cause right?

Edit: also tried a logic level shifter for the data line, no effect at all
Edit 2: redid the complete electronic now with a NodeMCU and a way shorter data line with a 330 ohm resistor, problem persists, now I'm completely clueless, tried everything and resoldered every connection

Do you have the 100nF capacitor on the 5v rail just next to the ws2812B ? Many times not having that one is the cause of flickering.
The logic-level shifter would only have effect if none of the LED's would work properly.
According to the datasheet every ws2812B should have a 100nF cap to itself, and most strips do have them on it, but at times the capacitor may be to small.

actually the opposite. The data signal is being forwarded by the ws2812B. If it is not received correctly, it can not be forwarded correctly.
I run my leds (ws2811's and ws2812b's ) through a 7400 series TTL (hct type ideally) but without the capacitor ws2812b's will flicker. (ws2811 are usually on strip that has a sufficient capacitor on it)

How did you wire the level shifter ?

I thought that a large capacitor was advised at the ledstrip (after the wires) of about 100µF to 1000µF.

You need a maximum of 6.6A.
Is that power supply a white block, type LPV-60-5 ?
That seems okay, but perhaps it does not like the PWM signal. Perhaps it was overheated in the past and does not work well anymore.

I had the same problem. My Christmas displays (500 WS2811's on a string) are 5 meters from the controller. (Because I am not going out in the snow if something in the controller needs attention). I put a single WS2811 inside my controller box to feed the data line. Works fine now. The downside is that the first LED is #1, not #0.

1 Like

I added a 470µF capacitor with no effect, and yes it's the LPV-60-5 with 8A max. Had another unit laying around and tried it out but still the wrong colour on the first LED, also measured about 5.18V at the first LED which should be fine by the data sheet. I ditched the level shifter for now because I had multiple WS2812B - NodeMCU projects running without any level shifting but maybe I have to look more into this because currently I don't know what to do anymore, exchanged every crucial part.
Otherwise I have to go with the solution to just add a LED in front of the whole thing which malfunctions but is hidden inside the box. Would be the easy and dirty approach :wink:

When 100 NodeMCU work without level shifter, that does not mean that the 101th NodeMCU will also work. You are at the edge of working and not working.

The 5.18V is high. Can you make it 4.5V ? Then the voltage levels of the signal comes into range.

If you want to give up the first led, then you can power it via a diode to lower its voltage. Easy and dirty:

I still have my doubts if you connected the level shifter properly.

I addded a 470µF capacitor with no effect at all, ditched the logic level shifter and shrinked the LED strip to only 2 LEDs for test purposes, problem persists and the first LED still shows the wrong color when dimmed or updated.

I tried different ESP8266 boards and all had the same problem with the first LED, the level shifter I tried was something like this from ebay: I connected the 3.3V, 5V and Ground to the module and the strip worked but still had the problem with the first LED. I don't have much space in the box so that a proper step down module which would withstand 8A wouldn't fit inside so I think I have to go with the diode option.
But I don't quite get why it worked in the first place for a couple of hours before this all started. I updated the ESP by USB cable and after that the first LED was wrong. I replaced the ESP, updated back to the old code, checked and replaced the PSU, rewired every connection...

What the specs require is a 100nF (ceramic disk or polypropylene), right next to the first LED.

Just use a 74hct04 powered with 5v and pass through 2 gates. That the d702 transistors work is actually surprising.

Did you always have that protection resistor of 330 Ω to the first led ?
Can you try a Arduino Uno with a very simple ledstrip example ? If the first led still fails, then it might be broken.
Or have you also tried other ledstrips ?

Do you have a smaller piece of the ledstrip or just a single led ?
You can test the first led with a single led. The code for the rest of the ledstrip will be simply ignored.

Perhaps you write beyond an array in your sketch. That can have weird unexplainable results.

To convince me that you wired the level shifter properly, you have to prove it with schematic or photo :wink:

There is one other thing that I can think of: ground currents.
The currents from the leds go to the ground wire. That is a lot of current through the ground wire. If that somehow can disturb the ground of the Arduino board, then about everything can go wrong.

tried different led strips and different first LEDs, strip is fine, tried it with just two LEDs attached, still same problem, just now tried to add a LED before the strip with no data IO and just power connected in case it has to do with the onboard capacitor on the strip but still no luck, first LED always shows the wrong color, so I'm pretty sure it has something to do with the data line but what doesnt make sense in my eyes is that if the data line is the cause why do the others LEDs work perfectly since the data package gets pass through the first LED
also checked common grounds and with the two LEDs connected the current should be pretty low too.
Thank you so much btw, I'm really quite desperate with this whole thing :smiley:

When the whole ledstrip is powered with 5V, and the data signal from the ESP is only between 0V and 3.3V, then the first led gets a signal that is too low.
The first led passes that signal on and makes it a signal between 0V and 5V, so the rest is okay.

Yes it does, but to fair the data signal does not get any physical modification other than the first 3 bytes being muted. In truth and first chip receives all the data, a passes the data on (minus the 3 bytes). If it can read all the other bytes correctly, it should be able to read the first 3. But 3.3v is not enough for a WS2812b logic HIGH or way to close to the limit.
There is still the possibility of a software error, we haven't seen your code, we should at least confirm that it can be eliminated as a cause.
But add a TTL chip. I don't think the logic level shifter that you have is the proper one for the job. It is meant for high power level shifting, not for speed.
The WS2812b is responding to the edges of the logic level switching. If the edges are not sharp, timing issues can occur. It is possible that the level change from LOW to HIGH is not read accurately but the change from HIGH to LOW is.

Maybe, but I doubt this is the issue. Firstly, it would mean more data corruption than just the first 3 bytes. Secondly, I doubt that a 2n7002-based shifter as OP uses wouldn't work in this application. Here's a quick sim of one running at 1MHz with 50% duty cycle (0.5us pulse width):

Let me put it this way, if the WS2812 won't trigger on those edges, it's a piece of ***...

Edit: my apologies, I was plain wrong. The observant reader will notice I ran the simulation for the case where a 5V signal is downshifted to 3V3, in which case performance of the shifter is OK. It's not OK when shifting up from 3V to 5V at speeds in the range of 800kHz as used by the WS2812. At those speeds, it essentially does no level shifting at all (its rise time is much slower) and could just as well be left out of the circuit. My bad!

Yes i would expect so as well, but if it would be that just the start bit gets sc%#$%ed up and you lose the first byte accurately then that does change the color of the first LED, and the next LED will receive the correct data of what remains.

I though about that too, but cannot figure out why corruption would occur in the first 3 bytes and not just the first one or two bits or so.
So far the most plausible cause would be a software issue IMO.

The OP hasn't provided details on the code, nor on the color.

Completely inappropriate level shifter for this purpose. It is for an entirely different application - I²C bus interfacing.

Not for "high power level shifting" at all. Very much the opposite.

A 74HCT14 with two gates cascaded will do just fine. A 74AHCT125 is theoretically perfect, but may not be as readily available and cheap.

I went with this approach because I had everythin I needed laying around and it works quite well. Just had to add this LED in the code. Only thing is the first LED now blinks red when the data for the rest of the strip changes. This isn't the big of a problem for me since I printed a small cap for the LED (ca. 9mm x 11mm x 5mm) and glued it on top of the LED. Could heat be a problem here on the long run? The whole thing will run 24/7 since it's part of a clock. Thanks so much for your help!

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.