One WS2811 pixel: red only

So I just put up my Christmas tree frame again. Everything is working great, except for one of my 135 pixels:

  • red when RGB(1,0,0)
  • off when RGB (0,1,0)
  • off when RGB(0,0,1)
  • red when RGB([0-1],[0-1],[0-1])

So the pixel is always red when it receives just a bit of red.

Pretty sure the problem is in the pixel WS2811 pixel itself, since it happens in any 2D pattern I use.

My suspicion is that this one pixel is just faulty and will need to be replaced.

Can someone confirm my suspicion? Or is there something else I can try in code to fix this?

Yes, that is almost certainly a bad pixel. It can happen if the green and blue elements become damaged or disconnected. With strips there are a number of factors that can cause it, often damage to the clear lens area.

If it is super distracting, you could add a bit of code to keep it black. Something like

export function render(index) {
  if (index == 123) {
    //"bad" pixel
    rgb(0,0,0)
    return;
  }
  // rest of pattern render code...
}

Thanks for your quick reply!

I think my WS2811’s are 7 years old now, and being one and half month outside each year is taking its toll.

And I just remembered that I replaced quite some pixels last year, because they were faulty as well. Luckily it’s just one this season, and it’s in a corner, so not affecting the patterns much.

Thanks for the code! I’ll add that.

Could you explain why you added return at the bottom?

This is so that the normal pattern code beneath it (see “// rest of pattern render code...”_ doesn’t also execute and overwrite the rgb(0,0,0).

Alternately you can put the if (index == 123 at the bottom of render() { and skip the return statement. It will overrule previous calls to rgb() and hsv(). This is a little less efficient though. If I’m disabling larger portions of my pixels than just a few, I at least like reclaiming the compute cycles.

It has the same effect as putting the rest of the code in else {, correct? Is it equally efficient?

I was under the impression that return is only used to return a value of a method, first time I see it used in such a manner.

Thanks for the quick and thorough reply btw:)

Yes! Same effect and equally efficient.

A minor advantage of the return version is that the main portion of the render code isn’t indented and contained within another set of braces. I generally try to avoid code blocks that span longer than a screen worth, because you can lose the context of what you’re nested in.

1 Like

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