FreeJoy icon indicating copy to clipboard operation
FreeJoy copied to clipboard

WS2811/WS2812B Individually Addressable RGB LED Control?

Open jrsteensen opened this issue 3 years ago • 1 comments

Could we add WS2811 and WS2812 control to Freejoy?

Using WS2811/WS2812 really opens up LED backlighting options to us. Powerwise, we would need to interface it with a transistor circuit, then provide a single PWM pin from the microcontroller. Since the LEDs are individually addressable, we can have different LEDs or sets of LEDs have different colors or brightness from each other. Ideally we would be able to cycle colors of an assigned group (with the potential for multiple groups per pin) with a button/encoder input and adjust brightness with a encoder or pot (users choice).

WS2811 Datasheet: https://cdn-shop.adafruit.com/datasheets/WS2811.pdf WS2812B Datasheet: https://cdn-shop.adafruit.com/datasheets/WS2812B.pdf

The WS2811 is an IC that lets you convert any RGB LED (like RGB pushbuttons) to a individually controlled LED. WS2812B is a 5mm RGB LED that has a WS2811 equivalent built in. There is also a electrically identical 3mm LED that would be able to be used as well (The WS2812B-Mini).

jrsteensen avatar Mar 20 '21 02:03 jrsteensen

Adding support for addressable LEDs like WS2811/12/23, SK6812 or other is possible but I dont like it very much for this project. Data interface require "polling" with exact timings for 0 or 1 bits. According to WS2812 datasheet it takes about 1.2us to send 1 bit of information. One LED needs 24bits of data (32 bits for SK6812). Simple calculations says that we spend 24*1.2=29us on writting one LED and only 10 LEDs will require almost 300us of MCU time. FreeJoy supports a lot of periphery working together, e.g. 4 SPI sensors + 4 ADC channels + 128 buttons. Reading sensors, ADC, buttons and some logic related to takes some MCU time (we have 2ms sensors cycle). So I wont be able to guarantee that axes or buttons will work correctly in some cases when addressable LEDs are used. Maybe I will add test support for these LEDs later but it is not a high priority task.

vostrenkov avatar Mar 28 '21 15:03 vostrenkov