WS2812B Problem

Hi, I have 60 WS2812B neopixels ring.
When I test it with an arduino micro and the adafruit neopixels lib, everything is fine. Even when I power the ring of the arduino micro 3.3V pin.
When I try to use it with the april breakout (powered of USB), I get very strange patterns after the 8th pixel.
I have the ring connected to VIN and GND, so it gets 5V.
I’m using the default ws2812.device.nut but I’ve change the test function to:
function test(d = null) { pixelStrip.clearFrame(); if (currentPixel >= NUMPIXELS-1) pAdd = -1; if (currentPixel <= 0) pAdd = 1; currentPixel += pAdd; pixelStrip.writePixel(currentPixel,[ 25,g,b]); pixelStrip.writeFrame(); imp.wakeup(DELAY, test); }
This should run a dimmed red back and forth.

Did anyone get a WS2812B strip working?
Is it the 800kHz that’s causing the problem?


@hugo I’ve tried that. One 1 pixel is lit at any time.

How about if you write dim red pixels to 26, is 27 still an issue? Just trying to rule out power issues.

I’ve used them quite a bit, though when working with the new code, I did notice something with the clearFrame() function… doesn’t seems to work. I wrote my own which just iterates through the number of pixels and sets them all to 0’s… which is what the clearFrame function should be doing. Perhaps @beardedinventor can shed some light?

Other than that I’ve been using it fine with various length rings and strips.

We have been playing quite extensively with NeoPixels in the office (both the 2812, and the 2812B version).

tl;dr: You probably need to step up your data line to the VDD level, or step down VDD to 4.8V-5V (you’ll lose lots of power this way, but it’s really simple).

We have found that there is some variance between what voltages USB is supposed to supply, and what voltages are actually supplied. Specifically, we’ve seen USB power supplies provide anywhere from 4.8V-5.2V when powered off USB.

Not a big deal, right, WS2812B is supposed to be happy with VDD between 3.5V and 5.3V, which is certainly is. The problem is actually not on the low end, it’s on the high end. If you read the datasheet, you’ll notice that Vhigh (ie the voltage level required to trigger a ‘high’ signal on the data line) is .7VDD.

This means that if VDD is exactly 5V, VHigh is 3.5V (slightly above what we can provide, but we’ve found it to be well within the NeoPixels tollerance). If that already almost out of range 5V is bumped up to 5.2V, Vhigh suddenly becomes 3.7V - and at this voltage we’ve found the NeoPixels to be extremely unreliable. They seem to “kind of” work, but glitch a lot more frequently, and sometimes simply don’t work.

There are two solutions:

  1. Make sure VDD is at 5V (or even better, somewhere between 3.5 and 4.8V). You can do this a voltage regulator, or even just by putting a diode in line (which will drop about .6V). This is not a great solution since you’re going to be bleeding a LOT of power. If VDD is 5.2V, and you’re dropping it to 5V, you’re looking at a total loss of .260n mW (where n is the number of pixels you have).

  2. Step up the data line. This is preferred solution. To do this, you’ll need a logic level translator, or a FET

I’m going to ping @Tom on this thread since he’s the brilliant person who discovered this, and should probably fact check what I just wrote :slight_smile:

@jwehr thank you. I’ve tried your suggestion. Now everything works ok till pixel 26. From 27 on, it’s just random colors and jumping back and forth.

@beardedinventor thank you for the explanation. I’ve added the logic level translator (Sparkfun BOB-12009) you’ve suggested. Still no luck. Everything is fine up to pixel 26, then …

Here’s my wiring:

It’s not the right neopixel strip in the image. I’m using this one.

Any ideas what could be the issue?
The USB power supply?

@mezelve - it’s possible you have a bad pixel? Because of how the chaining works, if one pixel’s processor breaks, nothing beyond it will work.

Can you try:

  1. Hooking your imp up to pixel 10 and see if goes to pixel 26 (which would indicate pixel 26 is the issue) or to 36 (which would indicate a more consistent issue with power, or signal loss, or something of the sort).
  2. Hook your imp up to pixel 26 and see if you can write to it.
  3. Hook your imp up to pixel 27 and see if you can write to the end of the string.

@beardedinventor the ring works without any problem on an arduino micro. Even when I power it from the 3.3V or 5V pin on the arduino. That doesn’t seem to bother the signal pin.
Maybe I need to add a resistor on pin 7 like they suggest in most arduino guides?
I noticed that there’re are some capacitors and resistors on the 60 pixel ring from Adafruit. Mine is just populated with LEDs.

So I’ve made some progress.
The current ws2812.device.nut in the electric imp github account, doesn’t work for me.
This older one by @beardedinventor works, but it’s slow.

The one that works and is (probably) as fast as the official one, is neopixel.device.nut by @tom.

My wiring:
VIN (5V) to 5V

That’s really strange as the neopixels re-generate timing at every pixel… the timing at pixel 2 is generated by pixel 1, not by the imp.

When I have a look at the current ws2812.device.nut and the older one of @tom, I notice that the main difference is the bits array. The new Neopixels class has BYTESPERPIXEL = 24 and the older ones have BYTESPERPIXEL = 27.
Could that be the issue? @beardedinventor & @tom?
Did anyone of you test the current class with more than 24 pixels?

I’ve seen some glitching with even as few as 24 pixels. It appears that the neopixels are more finicky about their power supply and signal voltages than the spec says. Adding capacitors along the tape may help.

We have tried reverting to 27 bytes per pixel, but didn’t see a difference in performance. I haven’t totally figured this one out yet, but you’re doing all the things I usually suggest, short of adding caps.

Like I said, this code works almost fine. I do see some glitches from time to time.
Here’s a cheesy video. (the neopixels are only at 1/10 of their maximum brightness in this video)

I’ve committed a fix to the electric imp repo to stop the glitching.

I haven’t had it glitch once since making these changes and using a dedicated PSU.

Huge props to @kgleeson for finding our bug!

We’ve merged it into our GitHub repo - so the most up to date, and seemingly bomb-proof code is here:

Unfortunately this didn’t solve the issue with my ring.
I’m using the same PSU as @kgleeson.
My adafruit 60 pixels ring arrives tomorrow. I’ll keep you guys posted.

I want to also use WS2812B, got some WS2812B strip at home and I will test from which power it can work, because if it does not work at 3.3V but works at 3.8V (lipo) it could be fine, I really need to test this point.If it is 5V only, it’s not a good news until we can find 5V Lipo battery (because step up converter will be too short to drive 500+ LED, consumption will be too high).

I have got some sk6812wwa led strip,which declare it can acheive the white color cct from 1800k to 6500k in one smd led.
but I how to control it to mix the different white cct as I want,such as 2500k,3500k,4000k and so on.
by the way,the ic they use it SK6812 ,which is similar to ws2812.
anyone can help will be grateful.thanks