WS2812b showing garbage

Hi guys, I'm working on a custom project and having some issues with driving LED strips.

I'm using a custom board, which has an ESP32 and a level shifter (NXS0108PWJ).

The board takes 5V from a 6A supply, and has an onboard 3V3 regulator which powers the ESP. The level shifter gets both 3V3 and 5V of course. There is a Molex KK396 connector which has 5V, GND, and a data pin from the level shifter, which I am using to drive the WS2812b LED strip.

For the software I am running WLED.

The problem is: when I connect a LED strip, the correct number of LEDs light up (as configured in WLED), however they display random bright colours. The LED strip is connected via a cable I have crafted myself (crimped) with KK396 at one end, and JST-SM at the other (which matches what the strip is delivered with).

I have also crafted a short "test strip", which has wires soldered directly to it with a molex KK396 connector at the end. When I plug that in, IT WORKS. I have tried many other things, including crafting a few more molex<->jst cables, however the result is always the same.

I have also tried adding a couple caps to my 5V rail on the board, and a 220R resistors on the data line, strip side.

Using my scope to inspect the signal and power rail at the LED strip end, I see this (zoomed in) - red is VCC, blue is DIN, ~125ns/div:

Which honestly doesn't look very nice :frowning:

I am thinking that I need more caps as it looks like the power supply is rippling pretty badly. But I don't understand why the ripple starts ~500ns sooner than the actual signal rising edge?

Any help and pointers much appreciated, with thanks.

because your scope trigger is set to capture 500ns before the event?

My scope captures well before that - in the screenshot above I have zoomed into one pulse from the capture, but all data pulses look similar.

Edit: to illustrate, here is a more "zoomed-out" view:

Any chance of a link to this, I have never come across it before.

Any chance of posting your code as well?

It is looking like the WLED does something just before outputting a pulse, like enabling the output pin.

Sure, it's a popular project with a large community: GitHub - Aircoookie/WLED: Control WS2812B and many more types of digital RGB LEDs with an ESP8266 or ESP32 over WiFi!

I don't have any code written myself (yet!) - everything is configurable from the WLED web interface.

Interesting - possibly that would be confusing things? I can dig into the WLED code and try to find out more...

So can you show us how that is configured?

It is fine you saying it is configured correctly but as you are clearly having problems then it seems you have something wrong or the WLED system is a pile of crap.

Give us something to go on here.

You make a good point that trying another (simpler) software would be a good experiment.

The reason I don't suspect the software at this time is that I have another strip which does work (different cabling), so I am suspecting some electrical interference.

In this photo, the short strip with the molex pigtail works, whereas the longer one with the extra JST connectors, doesn't. This is from the same physical port on the board, i.e. the software doesn't know any difference.

In any case, here is a screenshot of the WLED configuration (I've configured a few different output pins, but the result is the same on all of them):

Or the other strip you have is not the same as the strip that does work.
Interference is very unlikely to be a factor here.

Great user interface grey letters on a very slightly different grey background. Given your symptoms I am leaning towards a different colour order on your strip that is not behaving.

Bathroom? :grin:

Could be kitchen, anyway no one stands any chance of seeing where those wires go to comparer them.

I have found in the past, this happens to WS2812 strips when they have been over subject to over voltage. I accentually plugged a 12V power supply into a socket that was meant to have a 5V power supply attached, and that hapend to them. Any idea if this sort of accident befell your strip.

Have they ever worked correctly?

That would be a decoupling capacitor connected between 5V and ground. A coupling capacitor would be in series between an input and output.

Or maybe he meant a "couple" as two or perhaps more. :grin:

I am trying with the same strip, which has 2 lead soldered to it: JST and Molex. If I plug the molex lead directly things work. If I plug the JST lead to a JST<->Molex cable, it doesn't work (random rainbow colours). See video below.

I should have said "signal integrity" rather than interference. But maybe that's not the problem indeed...

I've uploaded a video of the problem. Based on that, it clearly seems like the cables are the problem. It's worth noting that I've crimped these myself and I'm no expert - I did take care to ensure that the crimp looked good, and added some solder to one of them for good measure. And the fact that the strip lights up at all suggests that 2/3 of the cable does work.

The oscilloscope measurements above were taken with one of these cables, from the strip between the first and second LEDs.

OK first off there is a golden rule when plating with electronics and it is that you never rewire a circuit with the circuit powered up.

So your cavalier pulling out of sockets and attaching them when powered up was quite painful to see. In the past I have damaged ws2812 strips by doing this. My excuse was I was working on a
Raspberry Pi and it takes at least a minute to power it down and up again and I wanted a quick test. I got one and fried the short strip. This then proceeded to behave in a similar way with random lights going on and off. In the trade connecting stuff while a circuit is powered up is known as hot plugging, and to do it you need at least special plugs and sockets.

Take a look at the USB connector, this is designed to be hot plugged. The connector strips going into a socket are different lengths. The longest one is ground, the next longest is +ve power and the shortest are the two signal wires. This insures when plugging it in the ground connects first followed by the power and finally the signals. In your video this could be being connected in any order. The result of this could be damage to the circuits due to what is known as latch up.

Or rather, bad measure. The big advantage of crimping is that there is no sudden stress point that will cause metal fatigue and snap the wire when it is flexed. You get this in a soldered joint where the solid solder changes to a flexible wire.

Sorry but I can’t see from the video or still pictures what the construction of those connectors are. Is there any chance of drawing a labelled diagram of the two sorts? Is there any danger of getting the connectors into your board swapped over?