Neopixel library too slow?
Posted: Wed Dec 19, 2018 11:19 am
I recently tried to build some POV things with an ESP32, micropython and a WS2812 strip.
In the end I found out that WS2812 itself might be to slow, but something else baffled me.
Even if I don't attach any hardware (and WS2812 doesn't give "feedback" to the microcontroller anyway), setting a LED takes approximately 720µs. So in order to set 12 LEDs it'll take me 8.6 µs with zero code around it.
I made a quick example here:
https://pastebin.com/8ss5CEaS
the code prints the average time it takes for the while loop to run, every 10 loops. Apart from that it just sets the LEDs to an arbitrary color.
Any idea why this is so slow? And is there a way to speed this all up? The alternative for me is to restart the whole project and write it in C++ or Arduino, which would kinda suck.
(Again, i know that there's also the hardware restrictions with PWM being slow and everything, that is something i can basically address by using APA102 instead of Neopixel, but as long as the underlying library seems to be the problem i'm a little lost)
In the end I found out that WS2812 itself might be to slow, but something else baffled me.
Even if I don't attach any hardware (and WS2812 doesn't give "feedback" to the microcontroller anyway), setting a LED takes approximately 720µs. So in order to set 12 LEDs it'll take me 8.6 µs with zero code around it.
I made a quick example here:
https://pastebin.com/8ss5CEaS
the code prints the average time it takes for the while loop to run, every 10 loops. Apart from that it just sets the LEDs to an arbitrary color.
Any idea why this is so slow? And is there a way to speed this all up? The alternative for me is to restart the whole project and write it in C++ or Arduino, which would kinda suck.
(Again, i know that there's also the hardware restrictions with PWM being slow and everything, that is something i can basically address by using APA102 instead of Neopixel, but as long as the underlying library seems to be the problem i'm a little lost)