Funny Colors

Funny Colors

As others have observed with the neopixel library on #Arduino, I also had issues with wrong colors showing up with my Atrium software and my own WS2812b driver. Interestingly, the behavior was not consistent: the wrong color show showed up most of the time on the first LED, but sometimes on others as well. Above you can see that the first LED is green instead of red - that is not really what I wanted to see.

Digging a bit deeper, the behavior showed an interaction, with parallel running activity on the ESP. The protocol for the WS2812b is pretty timing sensitive - it requires correct timing in the sub microsecond range.

No alt text provided for this image


So I wondered, it it might be related to timing, and decided to force the timing sensitive routine into the IRAM of the controller. That way the code gets highest possible performance and much less jitter regarding the execution time. Usually code runs from an external flash ROM on ESP8266 that is attached via SPI and only the currently executed part is being cached in IRAM.

With that change all odd colors disappeared. That was more than a year ago. Only recently, I gave it another look, with an oscilloscope that I did not have at that time.

No alt text provided for this image

As you can see in the picture above the timing is incorrect for the first bits, when the code is executed from flash ROM. Forcing the code into IRAM made the timing highly accurate using an internal cyclic counter of the ESP8266.

No alt text provided for this image

The timing requirement for the high level of a zero bit is 400ns with a tolerance of plus/minus 150ns. Zooming into the measurement above shows that the timing created with the Atrium code on an ESP8266 is highly accurate.

No alt text provided for this image

By the way - in this example the 8 LEDs were run with a supply voltage of 3.3V, which is below the spec of 3.5V. Even with lower voltages the colors showed up correctly, only the intensity of the individual LEDs dropped below the expected brightness.

So from my experience the voltage does not matter. And some controllers are just less prone to timing problems. So, if funny colors show up on your WS2812b LEDs, check the timing of your software.

Happy hacking!

要查看或添加评论,请登录

Thomas Maier-Komor的更多文章

  • Vintage technology meets IoT

    Vintage technology meets IoT

    Having a boy, who caught interest in a model railroad, my wife started looking for a ready-to-use layout of a model…

    2 条评论
  • Missed Anniversary

    Missed Anniversary

    Today I received an e-mail from a happy user regarding mbuffer, which is a UNIX tool that improves performance for…

  • Home Server Alternatives

    Home Server Alternatives

    A home server can cover several gaps left open by the typical networking gear that everybody has anyways. About three…

  • A DC-load for home labs

    A DC-load for home labs

    For testing power supplies or some kind of custom high-side/low-side power MOSFET electronics, a DC load is a handy…

社区洞察

其他会员也浏览了