LEDCtl (WS2812b LED Controller)
LED strips and panels based on some form of the WS2812 RGB LEDs have gained an enormous popularity the past couple of years with the price of the individual LEDs dropping well below 10 cent each. These LEDS contain 3 individual LEDs: one red, one green and one blue and the intensity of each of these can be set at 256 different levels.
Overall Design Parameters
The "device" should be able to drive 2-4 strings of up to 1000 leds on each string and the length and type of each string should be configurable.
The "device" will offer multiple ways of controlling LEDS:
- USB/CDC (emulated Serial over USB)
- Serial rx/tx lines
- I2C
- SPI
Picking the CPU
It might be possible to find a better CPU in ST's enormous line of processors, but since we've used the STM32F103 on our own Green Pill board, that processor will be the initial choice.
Hayes Like Serial Interface
To control the attached LEDs a simple serial interface is used.
AT Commands
Command | Parameters | Example | Response | Description |
---|---|---|---|---|
&F | AT&F | OK | Factory reset | |
ATLsnnn=rrrgggbbb | s=string nnn=led rrr=3 digit value |
ATL0000=010010010 | Set a specific led on a specific string to a specific value | |
Sx=y | y = value | ATS0=64 | OK | Set register to a certain value. Example will set register 0 to a value of 64 |
Z | ATZ | OK | Reset device |
S Registers
Register | Valid values | Description |
---|---|---|
0 | 0-999 | LEDs on string 0 |
1 | 0-999 | LEDs on string 1 |
2 | 0-99 | "Width" of a zero (percentage) |
3 | 0-99 | "Width of a one (percentage) |