Jump to content

Component: RGB LED SK6812 RGBW (LEDs): Difference between revisions

From Flowcode Help
No edit summary
No edit summary
 
(9 intermediate revisions by the same user not shown)
Line 15: Line 15:
A simple chained RGBW LED controller IC allowing multiple LEDs to be controlled using a serial data stream. Compatible with the SK6812 RGBW Type Controller ICs. Allows RGBW LEDs to be driven with full 24-bit colour depth plus 8-bit white channel. Allows single chains, 2D arrays and 3D cube formations to be simulated. Requires a high speed microcontroller to generate the critical timings to drive the device.
A simple chained RGBW LED controller IC allowing multiple LEDs to be controlled using a serial data stream. Compatible with the SK6812 RGBW Type Controller ICs. Allows RGBW LEDs to be driven with full 24-bit colour depth plus 8-bit white channel. Allows single chains, 2D arrays and 3D cube formations to be simulated. Requires a high speed microcontroller to generate the critical timings to drive the device.


==Component Source Code==
==Detailed description==
 
 
 
 
 
 
 
 


Please click here for the component source code: [https://www.flowcode.co.uk/wikicopy/componentsource/FC_Comp_Source_LED_SK6812RGBW.fcfx FC_Comp_Source_LED_SK6812RGBW.fcfx]


==Detailed description==




Line 38: Line 44:


==Examples==
==Examples==




Line 72: Line 88:
[http://led.linear1.org/1led.wiz LED Resistor Calculator Tool]
[http://led.linear1.org/1led.wiz LED Resistor Calculator Tool]


==Downloadable macro reference==


{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetBrightness'''
|-
| colspan="2" | Allows the output colour brightness of the LEDs to be scaled down. For example to save current usage or to reduce brightness in dark environments.  
|-
|-
| width="10%" align="center" | [[File:Fc9-f32-icon.png]] - FLOAT
| width="90%" | Scaler
|-
| colspan="2" | Range: 0.0 to 1.0 Default: 1.0, 0 = Off, 0.5 = Half Brightness, 1.0 = Full Brightness 
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}




{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetLEDColour'''
|-
| colspan="2" | Sets the colour of a single LED in RAM as a 1D array. 
|-
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | LED
|-
| colspan="2" | LED to change the colour / Range: 0 to (LED Count - 1) 
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | ColIdx
|-
| colspan="2" | 0 = Red, 1 = Green, 2 = Blue, 3 = White 
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}




{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''OutputLow'''
|-
| colspan="2" |  
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}




==Macro reference==
===Delay_T0H===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetBrightnessByte'''
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Delay_T0H'''
|-
|-
| colspan="2" | Allows the output colour brightness of the LEDs to be scaled down. For example to save current usage or to reduce brightness in dark environments.  
| colspan="2" |  
|-
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Scaler
|-
| colspan="2" | Range: 0 to 255 Default: 255, 0 = Off, 128 = Half Brightness, 255 = Full Brightness 
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
Line 146: Line 114:




===Delay_T0L===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
|-
Line 159: Line 128:




===Delay_T1H===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''DrawLine2D'''
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Delay_T1H'''
|-
| colspan="2" | Draws a line on a 2D array of LEDs 
|-
|-
| colspan="2" |  
|-
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | X1
|-
| colspan="2" | Start X Coordinate 
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | Y1
|-
| colspan="2" | Start Y Coordinate 
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | X2
|-
| colspan="2" | End X Coordinate 
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | Y2
|-
| colspan="2" | End Y Coordinate 
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | R
|-
| colspan="2" | Red colour channel 
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | G
|-
| colspan="2" | Green colour channel 
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | B
|-
| colspan="2" | Blue colour channel 
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | W
|-
| colspan="2" | White colour channel 
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
Line 212: Line 142:




===Delay_T1L===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''OutputHigh'''
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Delay_T1L'''
|-
|-
| colspan="2" |  
| colspan="2" |  
Line 225: Line 156:




===DrawCuboid3D===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetLEDColour'''
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''DrawCuboid3D'''
|-
|-
| colspan="2" | Sets the colour of a single LED in RAM as a 1D array. 
| colspan="2" | Draws a basic 3D cuboid onto the LEDs 
|-
|-
|-
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | LED
| width="90%" | X1
|-
|-
| colspan="2" | LED to change the colour / Range: 0 to (LED Count - 1) 
| colspan="2" | Start X pixel coordinate 
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | R
| width="90%" | Y1
|-
|-
| colspan="2" | Red Colour Channel 
| colspan="2" | Start Y pixel coordinate 
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | G
| width="90%" | Z1
|-
|-
| colspan="2" | Green Colour Channel 
| colspan="2" | Start Z pixel coordinate 
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | B
| width="90%" | X2
|-
|-
| colspan="2" | Blue Colour Channel 
| colspan="2" | End X pixel coordinate 
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | W
| width="90%" | Y2
|-
|-
| colspan="2" | White Colour Channel 
| colspan="2" | End Y pixel coordinate 
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" style="border-top: 2px solid #000;" | ''Return''
| width="90%" | Z2
|}
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| colspan="2" | End Z pixel coordinate 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetAllLEDColour'''
|-
|-
| colspan="2" | Sets the colour of all the LEDs in RAM 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | DrawStyle
|-
|-
| colspan="2" | Sets the draw style - 0=Soild, 1=Edge, 2=Corners 
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
Line 284: Line 213:
| width="90%" | B
| width="90%" | B
|-
|-
| colspan="2" | Blue Colour Channel 
| colspan="2" | White Colour Channel 
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | W
| width="90%" | W
|-
|-
| colspan="2" | White colour channel 
| colspan="2" | White Colour Channel 
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
Line 296: Line 225:




===DrawLine2D===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Delay_T0H'''
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''DrawLine2D'''
|-
|-
| colspan="2" |  
| colspan="2" | Draws a line on a 2D array of LEDs 
|-
|-
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" style="border-top: 2px solid #000;" | ''Return''
| width="90%" | X1
|}
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| colspan="2" | Start X Coordinate 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Delay_T1L'''
|-
|-
| colspan="2" |  
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | Y1
|-
|-
| colspan="2" | Start Y Coordinate 
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" style="border-top: 2px solid #000;" | ''Return''
| width="90%" | X2
|}
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| colspan="2" | End X Coordinate 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Refresh'''
|-
|-
| colspan="2" | Clocks out the current colour data to the LEDs from the values stored in RAM 
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | Y2
|-
|-
| colspan="2" | End Y Coordinate 
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" style="border-top: 2px solid #000;" | ''Return''
| width="90%" | R
|}
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| colspan="2" | Red colour channel 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ShiftLEDs1D'''
|-
|-
| colspan="2" | Shifts the LED colours in 1D and wraps  
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | G
|-
|-
| colspan="2" | Green colour channel 
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Direction
| width="90%" | B
|-
|-
| colspan="2" | 0 = Forwards, 1 = Backwards 
| colspan="2" | Blue colour channel 
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | DataMode
| width="90%" | W
|-
|-
| colspan="2" | 0=ResetToZero, 1=WrapAroundDisplay, 2=Smear 
| colspan="2" | White colour channel 
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
Line 358: Line 279:




===DrawLine3D===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
|-
Line 421: Line 343:




{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
===DrawRectangle2D===
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Delay_T1H'''
|-
| colspan="2" |  
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetLEDIndex2D'''
|-
| colspan="2" | Sets the index of a single LED in RAM as a 2D array. 
|-
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | X
|-
| colspan="2" | LED Column to change the colour / Range: 0 to (LED Column - 1) 
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | Y
|-
| colspan="2" | LED Row to change the colour / Range: 0 to (LED Row - 1) 
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
|-
Line 515: Line 402:




===GetLEDColour===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ShiftLEDs2D'''
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetLEDColour'''
|-
| colspan="2" | Sets the colour of a single LED in RAM as a 1D array. 
|-
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | LED
|-
| colspan="2" | LED to change the colour / Range: 0 to (LED Count - 1) 
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | ColIdx
|-
| colspan="2" | 0 = Red, 1 = Green, 2 = Blue, 3 = White 
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
 
 
===GetLEDIndex2D===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetLEDIndex2D'''
|-
|-
| colspan="2" | Shifts the contents of the display by the number of vertices specified ***Please Note that Wrap mode is currently unavailable*** 
| colspan="2" | Sets the index of a single LED in RAM as a 2D array. 
|-
|-
|-
|-
| width="10%" align="center" | [[File:Fc9-s16-icon.png]] - INT
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | X
| width="90%" | X
|-
|-
| colspan="2" | Number of pixels to shift the display -1 to 1 / 0 = No Shift 
| colspan="2" | LED Column to change the colour / Range: 0 to (LED Column - 1) 
|-
|-
| width="10%" align="center" | [[File:Fc9-s16-icon.png]] - INT
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | Y
| width="90%" | Y
|-
|-
| colspan="2" | Number of pixels to shift the display -1 to 1 / 0 = No Shift 
| colspan="2" | LED Row to change the colour / Range: 0 to (LED Row - 1) 
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | DataMode
|-
| colspan="2" | 0=ResetToZero, 1=WrapAroundDisplay, 2=Smear 
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="90%" style="border-top: 2px solid #000;" | ''Return''
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
|}




===GetLEDIndex3D===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
|-
Line 571: Line 479:




===Initialise===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Initialise'''
|-
| colspan="2" | Inisialises the RGB colour RAM to 0,0,0 = LED Off and clocks out the data to  initialise all the LED ICs in the chain. 
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
===OutputHigh===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''OutputHigh'''
|-
| colspan="2" |  
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
===OutputLow===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''OutputLow'''
|-
| colspan="2" |  
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
===Refresh===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Refresh'''
|-
| colspan="2" | Clocks out the current colour data to the LEDs from the values stored in RAM 
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
===SetAllLEDColour===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''DrawCuboid3D'''
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetAllLEDColour'''
|-
|-
| colspan="2" | Draws a basic 3D cuboid onto the LEDs 
| colspan="2" | Sets the colour of all the LEDs in RAM 
|-
|-
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | X1
| width="90%" | R
|-
|-
| colspan="2" | Start X pixel coordinate 
| colspan="2" | Red Colour Channel 
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Y1
| width="90%" | G
|-
|-
| colspan="2" | Start Y pixel coordinate 
| colspan="2" | Green Colour Channel 
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Z1
| width="90%" | B
|-
|-
| colspan="2" | Start Z pixel coordinate 
| colspan="2" | Blue Colour Channel 
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | X2
| width="90%" | W
|-
| colspan="2" | White colour channel 
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
 
 
===SetBrightness===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetBrightness'''
|-
| colspan="2" | Allows the output colour brightness of the LEDs to be scaled down. For example to save current usage or to reduce brightness in dark environments.  
|-
|-
| width="10%" align="center" | [[File:Fc9-f32-icon.png]] - FLOAT
| width="90%" | Scaler
|-
| colspan="2" | Range: 0.0 to 1.0 Default: 1.0, 0 = Off, 0.5 = Half Brightness, 1.0 = Full Brightness 
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
 
 
===SetBrightnessByte===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetBrightnessByte'''
|-
| colspan="2" | Allows the output colour brightness of the LEDs to be scaled down. For example to save current usage or to reduce brightness in dark environments.  
|-
|-
| colspan="2" | End X pixel coordinate 
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Y2
| width="90%" | Scaler
|-
| colspan="2" | Range: 0 to 255 Default: 255, 0 = Off, 128 = Half Brightness, 255 = Full Brightness 
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
 
 
===SetLEDColour===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
|-
| colspan="2" | End Y pixel coordinate 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetLEDColour'''
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| colspan="2" | Sets the colour of a single LED in RAM as a 1D array. 
| width="90%" | Z2
|-
|-
| colspan="2" | End Z pixel coordinate 
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | DrawStyle
| width="90%" | LED
|-
|-
| colspan="2" | Sets the draw style - 0=Soild, 1=Edge, 2=Corners 
| colspan="2" | LED to change the colour / Range: 0 to (LED Count - 1) 
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
Line 627: Line 634:
| width="90%" | B
| width="90%" | B
|-
|-
| colspan="2" | White Colour Channel 
| colspan="2" | Blue Colour Channel 
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
Line 639: Line 646:




===ShiftLEDs1D===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ShiftLEDs1D'''
|-
| colspan="2" | Shifts the LED colours in 1D and wraps  
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Direction
|-
| colspan="2" | 0 = Forwards, 1 = Backwards 
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | DataMode
|-
| colspan="2" | 0=ResetToZero, 1=WrapAroundDisplay, 2=Smear 
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
===ShiftLEDs2D===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Initialise'''
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ShiftLEDs2D'''
|-
| colspan="2" | Shifts the contents of the display by the number of vertices specified ***Please Note that Wrap mode is currently unavailable*** 
|-
|-
| width="10%" align="center" | [[File:Fc9-s16-icon.png]] - INT
| width="90%" | X
|-
| colspan="2" | Number of pixels to shift the display -1 to 1 / 0 = No Shift 
|-
| width="10%" align="center" | [[File:Fc9-s16-icon.png]] - INT
| width="90%" | Y
|-
|-
| colspan="2" | Inisialises the RGB colour RAM to 0,0,0 = LED Off and clocks out the data to  initialise all the LED ICs in the chain. 
| colspan="2" | Number of pixels to shift the display -1 to 1 / 0 = No Shift 
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | DataMode
|-
| colspan="2" | 0=ResetToZero, 1=WrapAroundDisplay, 2=Smear 
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
Line 652: Line 699:




===ShiftLEDs3D===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
|-
Line 683: Line 731:
| width="90%" style="border-top: 2px solid #000;" | ''Return''
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
|}




Line 762: Line 808:
| colspan="2" | LED Data Pin - Connected to the Data In pin of the first WS821x IC. 
| colspan="2" | LED Data Pin - Connected to the Data In pin of the first WS821x IC. 
|}
|}
==Component Source Code==
Please click here to download the component source project: [https://www.flowcode.co.uk/wiki/componentsource/FC_Comp_Source_LED_SK6812RGBW.fcfx FC_Comp_Source_LED_SK6812RGBW.fcfx]
Please click here to view the component source code (Beta): [https://www.flowcode.co.uk/FlowchartView/?wfile=componentsource/FC_Comp_Source_LED_SK6812RGBW.fcfx FC_Comp_Source_LED_SK6812RGBW.fcfx]

Latest revision as of 21:01, 23 December 2025

Author Matrix TSL
Version 1.5
Category LEDs


RGB LED SK6812 RGBW component

A simple chained RGBW LED controller IC allowing multiple LEDs to be controlled using a serial data stream. Compatible with the SK6812 RGBW Type Controller ICs. Allows RGBW LEDs to be driven with full 24-bit colour depth plus 8-bit white channel. Allows single chains, 2D arrays and 3D cube formations to be simulated. Requires a high speed microcontroller to generate the critical timings to drive the device.

Detailed description

No detailed description exists yet for this component

Examples

LEDs can be wired either active high or active low. The LED components should each have a property allowing you to configure which LED type your using.


An active high LED will light when the microcontroller pin is outputting a logic 1 and be off when the microcontroller pin is outputting a logic 0 or in input mode.


An active low LED will light when the microcontroller pin is outputting a logic 0 and be off when the microcontroller pin is outputting a logic 1 or in input mode.


The series resistor can be on either side of the LED and acts to protect the LED from damage due to excess current. The value of resistor used can be changed based on the brightness of the LED and power consumption.


This LED Calculator tool is a good resource for calculating the correct LED series protection resistor.

LED Resistor Calculator Tool






Macro reference

Delay_T0H

Delay_T0H
 
- VOID Return


Delay_T0L

Delay_T0L
 
- VOID Return


Delay_T1H

Delay_T1H
 
- VOID Return


Delay_T1L

Delay_T1L
 
- VOID Return


DrawCuboid3D

DrawCuboid3D
Draws a basic 3D cuboid onto the LEDs 
- BYTE X1
Start X pixel coordinate 
- BYTE Y1
Start Y pixel coordinate 
- BYTE Z1
Start Z pixel coordinate 
- BYTE X2
End X pixel coordinate 
- BYTE Y2
End Y pixel coordinate 
- BYTE Z2
End Z pixel coordinate 
- BYTE DrawStyle
Sets the draw style - 0=Soild, 1=Edge, 2=Corners 
- BYTE R
Red Colour Channel 
- BYTE G
Green Colour Channel 
- BYTE B
White Colour Channel 
- BYTE W
White Colour Channel 
- VOID Return


DrawLine2D

DrawLine2D
Draws a line on a 2D array of LEDs 
- UINT X1
Start X Coordinate 
- UINT Y1
Start Y Coordinate 
- UINT X2
End X Coordinate 
- UINT Y2
End Y Coordinate 
- BYTE R
Red colour channel 
- BYTE G
Green colour channel 
- BYTE B
Blue colour channel 
- BYTE W
White colour channel 
- VOID Return


DrawLine3D

DrawLine3D
Draws a line on a 3D array of LEDs 
- UINT X1
Start X Coordinate 
- UINT Y1
Start Y Coordinate 
- UINT Z1
Start Z Coordinate 
- UINT X2
End X Coordinate 
- UINT Y2
End Y Coordinate 
- UINT Z2
End Z Coordinate 
- BYTE R
Red Colour Channel 
- BYTE G
Green Colour Channel 
- BYTE B
Blue Colour Channel 
- BYTE W
White Colour Channel 
- VOID Return


DrawRectangle2D

DrawRectangle2D
Draws a basic 2D rectangle onto the LEDs 
- BYTE X1
 
- BYTE Y1
 
- BYTE X2
 
- BYTE Y2
 
- BYTE DrawStyle
Sets the draw style - 0=Soild, 1=Edge, 2=Corners 
- BYTE R
 
- BYTE G
 
- BYTE B
 
- BYTE W
White Colour Channel 
- VOID Return


GetLEDColour

GetLEDColour
Sets the colour of a single LED in RAM as a 1D array. 
- UINT LED
LED to change the colour / Range: 0 to (LED Count - 1) 
- BYTE ColIdx
0 = Red, 1 = Green, 2 = Blue, 3 = White 
- BYTE Return


GetLEDIndex2D

GetLEDIndex2D
Sets the index of a single LED in RAM as a 2D array. 
- UINT X
LED Column to change the colour / Range: 0 to (LED Column - 1) 
- UINT Y
LED Row to change the colour / Range: 0 to (LED Row - 1) 
- UINT Return


GetLEDIndex3D

GetLEDIndex3D
Gets the index of a single LED in RAM as a 3D array. 
- UINT X
LED Column to change the colour / Range: 0 to (LED Column - 1) 
- UINT Y
LED Row to change the colour / Range: 0 to (LED Row - 1) 
- UINT Z
LED Layer to change the colour / Range: 0 to (LED Layer - 1) 
- UINT Return


Initialise

Initialise
Inisialises the RGB colour RAM to 0,0,0 = LED Off and clocks out the data to initialise all the LED ICs in the chain. 
- VOID Return


OutputHigh

OutputHigh
 
- VOID Return


OutputLow

OutputLow
 
- VOID Return


Refresh

Refresh
Clocks out the current colour data to the LEDs from the values stored in RAM 
- VOID Return


SetAllLEDColour

SetAllLEDColour
Sets the colour of all the LEDs in RAM 
- BYTE R
Red Colour Channel 
- BYTE G
Green Colour Channel 
- BYTE B
Blue Colour Channel 
- BYTE W
White colour channel 
- VOID Return


SetBrightness

SetBrightness
Allows the output colour brightness of the LEDs to be scaled down. For example to save current usage or to reduce brightness in dark environments.  
- FLOAT Scaler
Range: 0.0 to 1.0 Default: 1.0, 0 = Off, 0.5 = Half Brightness, 1.0 = Full Brightness 
- VOID Return


SetBrightnessByte

SetBrightnessByte
Allows the output colour brightness of the LEDs to be scaled down. For example to save current usage or to reduce brightness in dark environments.  
- BYTE Scaler
Range: 0 to 255 Default: 255, 0 = Off, 128 = Half Brightness, 255 = Full Brightness 
- VOID Return


SetLEDColour

SetLEDColour
Sets the colour of a single LED in RAM as a 1D array. 
- UINT LED
LED to change the colour / Range: 0 to (LED Count - 1) 
- BYTE R
Red Colour Channel 
- BYTE G
Green Colour Channel 
- BYTE B
Blue Colour Channel 
- BYTE W
White Colour Channel 
- VOID Return


ShiftLEDs1D

ShiftLEDs1D
Shifts the LED colours in 1D and wraps  
- BYTE Direction
0 = Forwards, 1 = Backwards 
- BYTE DataMode
0=ResetToZero, 1=WrapAroundDisplay, 2=Smear 
- VOID Return


ShiftLEDs2D

ShiftLEDs2D
Shifts the contents of the display by the number of vertices specified ***Please Note that Wrap mode is currently unavailable*** 
- INT X
Number of pixels to shift the display -1 to 1 / 0 = No Shift 
- INT Y
Number of pixels to shift the display -1 to 1 / 0 = No Shift 
- BYTE DataMode
0=ResetToZero, 1=WrapAroundDisplay, 2=Smear 
- VOID Return


ShiftLEDs3D

ShiftLEDs3D
Shifts the contents of the display by the number of vertices specified ***Please Note that Wrap mode is currently unavailable*** 
- INT X
Number of pixels to shift the display -1 to 1 / 0 = No Shift 
- INT Y
Number of pixels to shift the display -1 to 1 / 0 = No Shift 
- INT Z
Number of pixels to shift the display -1 to 1 / 0 = No Shift 
- BYTE DataMode
0=ResetToZero, 1=WrapAroundDisplay, 2=Smear 
- VOID Return


Property reference

Properties
Controller IC
LED Controller
Allows the user to select which LED controller IC they are using. The different controller ICs all work the same way but have different timing characteristics. 
Data Order
Configures the order the colour data is clocked out to the LEDs 
Reset Time (uS)
Blanking reset period to reset the LED shift chain and start from the beginning 
T0H (uS)
Logic 0 high time in microseconds 
T0L (uS)
Logic 0 low time in microseconds 
T1H (uS)
Logic 1 high time in microseconds 
T1L (uS)
Logic 1 low time in microseconds 
LED Properties
LED Arrangement
Controls the arrangement of the LEDs on the panel. 1D - Creates a straight line of LEDs 2D - Creates an X by Y Array of LEDs 3D - Creates an X by Y by Z Array of LEDs 
LED Count
Total number of LEDs in the design 
Column Spacing
X Spacing Between LEDs on the Panel 
Connections
Data Pin
LED Data Pin - Connected to the Data In pin of the first WS821x IC. 

Component Source Code

Please click here to download the component source project: FC_Comp_Source_LED_SK6812RGBW.fcfx

Please click here to view the component source code (Beta): FC_Comp_Source_LED_SK6812RGBW.fcfx