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

khairnardm
Posts: 4
Joined: Fri Feb 16, 2018 5:45 am

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

Postby khairnardm » Tue Oct 27, 2020 7:22 pm

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.
Last edited by khairnardm on Thu Nov 05, 2020 4:50 pm, edited 1 time in total.

ESP_Sprite
Posts: 9724
Joined: Thu Nov 26, 2015 4:08 am

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

Postby ESP_Sprite » Wed Oct 28, 2020 8:18 am

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.

khairnardm
Posts: 4
Joined: Fri Feb 16, 2018 5:45 am

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

Postby khairnardm » Sun Nov 01, 2020 3:05 pm

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().

ESP_Sprite
Posts: 9724
Joined: Thu Nov 26, 2015 4:08 am

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

Postby ESP_Sprite » Mon Nov 02, 2020 1:13 am

...why would it not be? Have you tried?

khairnardm
Posts: 4
Joined: Fri Feb 16, 2018 5:45 am

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

Postby khairnardm » Mon Nov 02, 2020 4:22 pm

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.

Who is online

Users browsing this forum: Google [Bot] and 115 guests