• A NeoPixel also known as the WS2812 has an ultra specific set of timing criteria ... see for example:

    https://www.adafruit.com/datasheets/WS28­12.pdf

    We need a signal length of 0.35us to represent low and 0.7us to represent high. These have tolerances of +/- 150ns. The overall period of 1 bit is about 1.3us. As such, timing is absolutely critical. The AdaFruit sample code for an ESP8266 can be found here which uses assembly to access the ESP8266 special register called "ccount" which uses the 80MHz/160MHz clock cycle counter for this level of precision:

    https://github.com/adafruit/Adafruit_Neo­Pixel/blob/master/esp8266.c

    The equivalent Adruino code seems to be mostly written in assembler ... see:

    https://github.com/adafruit/Adafruit_Neo­Pixel/blob/master/Adafruit_NeoPixel.cpp

    Using these as references, we see both an API and an implementation that has been demonstrated to work. If it is possible to drive reliable signals at these rates using SPI, I'm afraid I personally don't know how to do that. We are also stuck on hardware SPI support on the ESP8266 and that has been an outstanding issue for a while now with no obvious resolution.

    If we can achieve NeoPixel driving with hardware SPI, that would be fantastic ... but in the interim, this story talks about a potential code fragment that works today using the recipes that others (Adafruit) are advocating ... as opposed to SPI techniques. If it is possible to drive NeoPixels using hardware SPI on an ESP8266, that may indeed be a breakthrough that even folks like AdaFruit would be interested in hearing about.

About

Avatar for Kolban @Kolban started