Jump to content

Component: RGB LED WS2801 (LEDs): Difference between revisions

From Flowcode Help
No edit summary
No edit summary
Line 103: Line 103:
{{Fcfile|AnimLightCascade.fcfx|AnimatedLightCascade}}
{{Fcfile|AnimLightCascade.fcfx|AnimatedLightCascade}}
[[File:AnimLight2.jpg]]
[[File:AnimLight2.jpg]]




Line 108: Line 110:
==Macro reference==
==Macro reference==


===SetBrightness===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
|-
Line 126: Line 129:




===GetLEDColour===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
|-
Line 149: Line 153:




===SetBrightnessByte===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
|-
Line 167: Line 172:




===DrawLine2D===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
|-
Line 215: Line 221:




===SetLEDColour===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
|-
Line 248: Line 255:




===SetAllLEDColour===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
|-
Line 276: Line 284:




===Refresh===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
|-
Line 289: Line 298:




===ShiftLEDs1D===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
|-
Line 312: Line 322:




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




===GetLEDIndex2D===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
|-
Line 393: Line 405:




===DrawRectangle2D===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
|-
Line 446: Line 459:




===ShiftLEDs2D===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
|-
Line 474: Line 488:




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




===DrawCuboid3D===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
|-
Line 565: Line 581:




===Initialise===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
|-
Line 578: Line 595:




===ShiftLEDs3D===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
|-

Revision as of 11:51, 3 February 2023

Author Matrix TSL
Version 2.0
Category LEDs


RGB LED WS2801 component

A simple chained RGB LED controller IC allowing multiple LEDs to be controlled using a serial data stream. Allows RGB LEDs to be driven with full 24-bit colour depth. Allows single chains, 2D arrays and 3D cube formations to be simulated. Supports Bit Banged or SPI peripheral based data modes.

Component Source Code

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

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

Detailed description

1D Configuration

In the 1D configuration each LED simply follows on from the last in a chain.


2D Configuration

In the 2D configuration each LED follows on from the last in a chain which travels back and forth through the columns a row at a time.


3D Configuration

In the 3D configuration each layer follows the 2D configuration with each layer then following on by mirroring the layer below. First layer connections are shown in Red and second layer connections are shown in Blue.


3V3 Microcontrollers

Note you may have to voltage shift the micro controller control pins to meet the 0.8 * VDD minimum requirement. E.g. if VDD is 5V then the input voltage needs to be at least 4V.

A simple buffer IC could be used to do the voltage shifting.


Examples

RGB Mood Light

A simple example using three potentiometers to set the individual Red, Green and Blue channels of the LED colour. MoodLight


Animated Light

A simple example which picks a random colour assigns it to the first LED, then shifts and repeats. AnimatedLightStrip


Animated Light Cascade

A simple example which picks a random colour assigns it to the first LED, then shifts and repeats. AnimatedLightCascade



Macro reference

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


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 = R, 1 = G, 2 = B 
- BYTE 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


DrawLine2D

DrawLine2D
Draws a line on a 2D array of LEDs 
- UINT X1
 
- UINT Y1
 
- UINT X2
 
- UINT Y2
 
- BYTE R
 
- BYTE G
 
- BYTE B
 
- 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
 
- BYTE G
 
- BYTE B
 
- VOID Return


SetAllLEDColour

SetAllLEDColour
Sets the colour of all the LEDs in RAM 
- BYTE R
 
- BYTE G
 
- BYTE B
 
- VOID Return


Refresh

Refresh
Clocks out the current colour data to the LEDs from the values stored in RAM 
- 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


DrawLine3D

DrawLine3D
Draws a line on a 3D array of LEDs 
- UINT X1
 
- UINT Y1
 
- UINT Z1
 
- UINT X2
 
- UINT Y2
 
- UINT Z2
 
- BYTE R
 
- BYTE G
 
- BYTE B
 
- VOID 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


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
 
- 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


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


DrawCuboid3D

DrawCuboid3D
Draws a basic 3D cuboid onto the LEDs 
- BYTE X1
 
- BYTE Y1
 
- BYTE Z1
 
- BYTE X2
 
- BYTE Y2
 
- BYTE Z2
 
- BYTE DrawStyle
Sets the draw style - 0=Soild, 1=Edge, 2=Corners 
- BYTE R
 
- BYTE G
 
- BYTE B
 
- VOID Return


Initialise

Initialise
Inisialises the RGB colour RAM to 0,0,0 = LED Off and clocks out the data to initialise all the WS2801 ICs in the chain. 
- 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
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 
LED Columns
Number of horizontal LEDs - X axis 
Column Spacing
X Spacing Between LEDs on the Panel 
LED Rows
Number of vertical LEDs - Y axis 
Row Spacing
Y Spacing Between LEDs on the Panel 
LED Layers
Number of LED layers - Z axis 
Layer Spacing
Z Spacing Between LEDs on the Panel 
Flip X
Flips the X axis if the LEDs are wired from the right hand side of the display. 
Flip Y
Flips the Y axis if the LEDs are wired from the bottom side of the display. 
Flip Z
Flips the Z axis if the LEDs are wired from the upper most side of the display. 
Arrangement
LEDs will likely be arranged in one of two ways. Parallel = Each row of LEDs run from left to right - easier to address but harder to wire. Alternating = Each row of LEDs runs in an alternating direction - harder to address but easier to wire. 
Connections
Output Mode
Sets the output mode used to drive the data to the LEDs Bit Banged Mode = Allows Any I/O Pin but may be slower SPI Mode = Fixed SPI Peripheral Pins but may be faster - Note that the SPI MISO pin will not be available for general I/O  
Connection Properties
Data Pin
LED Data Pin - Connected to the Data In pin of the first WS8201 IC. 
Clock Pin
LED Clock Pin - Connected to the Clock In pin of the first WS8201 IC. 
Scope Traces
Selects if the scope traces are automatically generated or not 
Console Data
Selects if the console data is automatically generated or not 
API