Difference between revisions of "STM32 WS2812B"
Line 4: | Line 4: | ||
The [[WS2812B]] LED contains 3 LEDS: red, green and blue and each of these LEDS can be set at 256 different brightness levels. These levels are controlled with a bit stream running at 800 kHz and multiple LEDS (up to 1000-ish) can be chained after each other. | The [[WS2812B]] LED contains 3 LEDS: red, green and blue and each of these LEDS can be set at 256 different brightness levels. These levels are controlled with a bit stream running at 800 kHz and multiple LEDS (up to 1000-ish) can be chained after each other. | ||
+ | |||
+ | Searching the Internet there are a '''lot''' of suggestions and implementations dealing with the ws2812 LEDs, so obviously I decided to take a different approach. This approach is described on this page. | ||
+ | |||
+ | == Protocol Analysis == | ||
+ | |||
+ | WS2812 LEDs are daisy chained together like this: | ||
+ | |||
+ | [[File:WS2812B Chain.png|800px]] | ||
+ | |||
+ | When sending data each LED need 24 bit - 8 bit for each color. The first LED in the chain will "use" the first 24 bit and then pass any following bit to the next LED in the chain and so forth: | ||
+ | |||
+ | [[File:WS2812B Data Transmission Method.png|600px]] | ||
Line 12: | Line 24: | ||
[https://github.com/lbthomsen/stm32-ws2812b https://github.com/lbthomsen/stm32-ws2812b] | [https://github.com/lbthomsen/stm32-ws2812b https://github.com/lbthomsen/stm32-ws2812b] | ||
+ | |||
+ | == Links == | ||
+ | |||
+ | * [https://ipfs-pin.com/ipfs/Qmc1osaeY9SUg8wkktzkSach2ANuuSSJe6Ejd1kibvmPSD/Worldsemi-WS2812B-B_C114586.pdf WS2812B Datasheet V5] |
Revision as of 02:31, 22 April 2021
When developing the STM32Dev board a WS2812B RGB LED was including connected to the PC6 GPIO.
The WS2812B LED contains 3 LEDS: red, green and blue and each of these LEDS can be set at 256 different brightness levels. These levels are controlled with a bit stream running at 800 kHz and multiple LEDS (up to 1000-ish) can be chained after each other.
Searching the Internet there are a lot of suggestions and implementations dealing with the ws2812 LEDs, so obviously I decided to take a different approach. This approach is described on this page.
Protocol Analysis
WS2812 LEDs are daisy chained together like this:
When sending data each LED need 24 bit - 8 bit for each color. The first LED in the chain will "use" the first 24 bit and then pass any following bit to the next LED in the chain and so forth:
Library on Github
The library is available on Github:
https://github.com/lbthomsen/stm32-ws2812b