Page 1 of 1

ESP32 idf library (using i2s or SPI) for ws2812.[Solved]

Posted: Tue Oct 27, 2020 7:22 pm
by khairnardm
Hi, I am looking for an esp32 library that should work on the I2S peripheral for the WS2812 RGB LED. I have tried the library with RMT peripheral but it flickers a lot. I have tried this library https://github.com/vunam/esp32-i2s-ws2812 which works on I2s peripheral but it can only drive 12 LEDs and I don't know to modify it for use 24 led. I there any library which satisfies the following things.
-written in C
-works on I2s or SPI
-don't flicker
-support 24 led

please help with this.

Re: ESP32 idf library (using i2s or SPI) for ws2812.

Posted: Wed Oct 28, 2020 8:18 am
by ESP_Sprite
Where do you get that it only supports 12 LEDs? As far as I can tell, the default setting is 8, and you can change that by changing the line '#define LED_NUMBER 8' in ws2812.h.

Re: ESP32 idf library (using i2s or SPI) for ws2812.

Posted: Sun Nov 01, 2020 3:05 pm
by khairnardm
I have changed that to #define LED_NUMBER 12 and it can control 12 LEDs. But is it possible to control 24 LEDs? I can't find any other library like this. I need just two functions initLED() and setColor().

Re: ESP32 idf library (using i2s or SPI) for ws2812.

Posted: Mon Nov 02, 2020 1:13 am
by ESP_Sprite
...why would it not be? Have you tried?

Re: ESP32 idf library (using i2s or SPI) for ws2812.

Posted: Mon Nov 02, 2020 4:22 pm
by khairnardm
Ok, I found one code for I2S ws2812 which is for Arduino and in CPP. so I ported this code of IDF in C. and it is working fine but got another problem. when there is some BLE operation going its flickers some led. here is the code https://github.com/8-DK/ESP32_I2S_WS2812_idf.
I have also added this code to git https://github.com/8-DK/ESP32_SPI_WS2812_idf. this used SPI and DMA buffer to send ws2812 bit data. This is the flicker-free solution.