Difference between revisions of "Component: LED WS2801 (Outputs: LEDs)"
(XML import BR) |
|||
(10 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
+ | |||
+ | |||
{| width="50%" | {| width="50%" | ||
|- | |- | ||
Line 5: | Line 7: | ||
|- | |- | ||
| width="20%" style="color: gray;" | Version | | width="20%" style="color: gray;" | Version | ||
− | | 1. | + | | 1.1 (Release) |
|- | |- | ||
| width="20%" style="color: gray;" | Category | | width="20%" style="color: gray;" | Category | ||
Line 18: | Line 20: | ||
Allows single chains, 2D arrays and 3D cube formations to be simulated. | Allows single chains, 2D arrays and 3D cube formations to be simulated. | ||
Supports Bit Banged or SPI peripheral based data modes. | Supports Bit Banged or SPI peripheral based data modes. | ||
+ | |||
+ | ==Detailed description== | ||
+ | |||
+ | ===1D Configuration=== | ||
+ | |||
+ | In the 1D configuration each LED simply follows on from the last in a chain. | ||
+ | |||
+ | [[File:LED_1D.png]] | ||
+ | |||
+ | |||
+ | ===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. | ||
+ | |||
+ | [[File:LED_2D.png]] | ||
+ | |||
+ | |||
+ | ===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. | ||
+ | |||
+ | [[File:LED_3D.png]] | ||
+ | |||
+ | |||
+ | ===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== | ==Examples== | ||
− | |||
===RGB Mood Light=== | ===RGB Mood Light=== | ||
A simple example using three potentiometers to set the individual Red, Green and Blue channels of the LED colour. | A simple example using three potentiometers to set the individual Red, Green and Blue channels of the LED colour. | ||
− | |||
{{Fcfile|MoodLightStrip.fcfx|MoodLight}} | {{Fcfile|MoodLightStrip.fcfx|MoodLight}} | ||
− | |||
[[File:MoodLight.jpg]] | [[File:MoodLight.jpg]] | ||
Line 33: | Line 61: | ||
A simple example which picks a random colour assigns it to the first LED, then shifts and repeats. | A simple example which picks a random colour assigns it to the first LED, then shifts and repeats. | ||
+ | {{Fcfile|AnimLightStrip.fcfx|AnimatedLightStrip}} | ||
+ | [[File:AnimLight.jpg]] | ||
+ | |||
+ | |||
+ | ===Animated Light Cascade=== | ||
+ | |||
+ | A simple example which picks a random colour assigns it to the first LED, then shifts and repeats. | ||
+ | {{Fcfile|AnimLightCascade.fcfx|AnimatedLightCascade}} | ||
+ | [[File:AnimLight2.jpg]] | ||
+ | |||
+ | ==Downloadable macro reference== | ||
+ | |||
+ | ===<span style="font-weight: normal;"><u><tt>SetBrightness</tt></u></span>=== | ||
+ | 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. | ||
+ | |||
+ | '''Parameters''' | ||
+ | |||
+ | :[[Variable Types|FLOAT]] ''Scaler'' | ||
+ | ::Range: 0.0 to 1.0 Default: 1.0, 0 = Off, 0.5 = Half Brightness, 1.0 = Full Brightness | ||
+ | |||
+ | |||
+ | '''Return value''' | ||
+ | |||
+ | :''This call does not return a value'' | ||
+ | |||
+ | |||
+ | ===<span style="font-weight: normal;"><u><tt>GetLEDColour</tt></u></span>=== | ||
+ | Sets the colour of a single LED in RAM as a 1D array. | ||
+ | |||
+ | '''Parameters''' | ||
+ | |||
+ | :[[Variable Types|UINT]] ''LED'' | ||
+ | ::LED to change the colour / Range: 0 to (LED Count - 1) | ||
− | + | :[[Variable Types|BYTE]] ''ColIdx'' | |
+ | ::0 = R, 1 = G, 2 = B | ||
− | |||
+ | '''Return value''' | ||
+ | :[[Variable Types|BYTE]] | ||
− | |||
===<span style="font-weight: normal;"><u><tt>DrawLine2D</tt></u></span>=== | ===<span style="font-weight: normal;"><u><tt>DrawLine2D</tt></u></span>=== | ||
Line 110: | Line 172: | ||
:''This macro has no parameters'' | :''This macro has no parameters'' | ||
+ | |||
+ | |||
+ | '''Return value''' | ||
+ | |||
+ | :''This call does not return a value'' | ||
+ | |||
+ | |||
+ | ===<span style="font-weight: normal;"><u><tt>ShiftLEDs1D</tt></u></span>=== | ||
+ | Shifts the LED colours in 1D and wraps | ||
+ | |||
+ | '''Parameters''' | ||
+ | |||
+ | :[[Variable Types|BYTE]] ''Direction'' | ||
+ | ::0 = Forwards, 1 = Backwards | ||
+ | |||
+ | :[[Variable Types|BYTE]] ''DataMode'' | ||
+ | ::0=ResetToZero, 1=WrapAroundDisplay, 2=Smear | ||
Line 146: | Line 225: | ||
− | ===<span style="font-weight: normal;"><u><tt> | + | ===<span style="font-weight: normal;"><u><tt>GetLEDIndex2D</tt></u></span>=== |
− | Sets the | + | Sets the index of a single LED in RAM as a 2D array. |
'''Parameters''' | '''Parameters''' | ||
− | :[[Variable Types|UINT]] '' | + | :[[Variable Types|UINT]] ''X'' |
::LED Column to change the colour / Range: 0 to (LED Column - 1) | ::LED Column to change the colour / Range: 0 to (LED Column - 1) | ||
− | :[[Variable Types|UINT]] '' | + | :[[Variable Types|UINT]] ''Y'' |
::LED Row to change the colour / Range: 0 to (LED Row - 1) | ::LED Row to change the colour / Range: 0 to (LED Row - 1) | ||
+ | |||
+ | |||
+ | '''Return value''' | ||
+ | |||
+ | :[[Variable Types|UINT]] | ||
+ | |||
+ | |||
+ | ===<span style="font-weight: normal;"><u><tt>DrawRectangle2D</tt></u></span>=== | ||
+ | Draws a basic 2D rectangle onto the LEDs | ||
+ | |||
+ | '''Parameters''' | ||
+ | |||
+ | :[[Variable Types|BYTE]] ''X1'' | ||
+ | |||
+ | :[[Variable Types|BYTE]] ''Y1'' | ||
+ | |||
+ | :[[Variable Types|BYTE]] ''X2'' | ||
+ | |||
+ | :[[Variable Types|BYTE]] ''Y2'' | ||
+ | |||
+ | :[[Variable Types|BYTE]] ''DrawStyle'' | ||
+ | ::Sets the draw style - 0=Soild, 1=Edge, 2=Corners | ||
:[[Variable Types|BYTE]] ''R'' | :[[Variable Types|BYTE]] ''R'' | ||
Line 169: | Line 270: | ||
− | ===<span style="font-weight: normal;"><u><tt> | + | ===<span style="font-weight: normal;"><u><tt>ShiftLEDs2D</tt></u></span>=== |
− | + | Shifts the contents of the display by the number of vertices specified | |
+ | |||
+ | ***Please Note that Wrap mode is currently unavailable*** | ||
'''Parameters''' | '''Parameters''' | ||
− | :[[Variable Types|UINT]] '' | + | :[[Variable Types|INT]] ''X'' |
+ | ::Number of pixels to shift the display -1 to 1 / 0 = No Shift | ||
+ | |||
+ | :[[Variable Types|INT]] ''Y'' | ||
+ | ::Number of pixels to shift the display -1 to 1 / 0 = No Shift | ||
+ | |||
+ | :[[Variable Types|BYTE]] ''DataMode'' | ||
+ | ::0=ResetToZero, 1=WrapAroundDisplay, 2=Smear | ||
+ | |||
+ | |||
+ | '''Return value''' | ||
+ | |||
+ | :''This call does not return a value'' | ||
+ | |||
+ | |||
+ | ===<span style="font-weight: normal;"><u><tt>GetLEDIndex3D</tt></u></span>=== | ||
+ | Gets the index of a single LED in RAM as a 3D array. | ||
+ | |||
+ | '''Parameters''' | ||
+ | |||
+ | :[[Variable Types|UINT]] ''X'' | ||
::LED Column to change the colour / Range: 0 to (LED Column - 1) | ::LED Column to change the colour / Range: 0 to (LED Column - 1) | ||
− | :[[Variable Types|UINT]] '' | + | :[[Variable Types|UINT]] ''Y'' |
::LED Row to change the colour / Range: 0 to (LED Row - 1) | ::LED Row to change the colour / Range: 0 to (LED Row - 1) | ||
− | :[[Variable Types|UINT]] '' | + | :[[Variable Types|UINT]] ''Z'' |
::LED Layer to change the colour / Range: 0 to (LED Layer - 1) | ::LED Layer to change the colour / Range: 0 to (LED Layer - 1) | ||
+ | |||
+ | |||
+ | '''Return value''' | ||
+ | |||
+ | :[[Variable Types|UINT]] | ||
+ | |||
+ | |||
+ | ===<span style="font-weight: normal;"><u><tt>DrawCuboid3D</tt></u></span>=== | ||
+ | Draws a basic 3D cuboid onto the LEDs | ||
+ | |||
+ | '''Parameters''' | ||
+ | |||
+ | :[[Variable Types|BYTE]] ''X1'' | ||
+ | |||
+ | :[[Variable Types|BYTE]] ''Y1'' | ||
+ | |||
+ | :[[Variable Types|BYTE]] ''Z1'' | ||
+ | |||
+ | :[[Variable Types|BYTE]] ''X2'' | ||
+ | |||
+ | :[[Variable Types|BYTE]] ''Y2'' | ||
+ | |||
+ | :[[Variable Types|BYTE]] ''Z2'' | ||
+ | |||
+ | :[[Variable Types|BYTE]] ''DrawStyle'' | ||
+ | ::Sets the draw style - 0=Soild, 1=Edge, 2=Corners | ||
:[[Variable Types|BYTE]] ''R'' | :[[Variable Types|BYTE]] ''R'' | ||
Line 203: | Line 352: | ||
:''This macro has no parameters'' | :''This macro has no parameters'' | ||
+ | |||
+ | |||
+ | '''Return value''' | ||
+ | |||
+ | :''This call does not return a value'' | ||
+ | |||
+ | |||
+ | ===<span style="font-weight: normal;"><u><tt>ShiftLEDs3D</tt></u></span>=== | ||
+ | Shifts the contents of the display by the number of vertices specified | ||
+ | |||
+ | ***Please Note that Wrap mode is currently unavailable*** | ||
+ | |||
+ | '''Parameters''' | ||
+ | |||
+ | :[[Variable Types|INT]] ''X'' | ||
+ | ::Number of pixels to shift the display -1 to 1 / 0 = No Shift | ||
+ | |||
+ | :[[Variable Types|INT]] ''Y'' | ||
+ | ::Number of pixels to shift the display -1 to 1 / 0 = No Shift | ||
+ | |||
+ | :[[Variable Types|INT]] ''Z'' | ||
+ | ::Number of pixels to shift the display -1 to 1 / 0 = No Shift | ||
+ | |||
+ | :[[Variable Types|BYTE]] ''DataMode'' | ||
+ | ::0=ResetToZero, 1=WrapAroundDisplay, 2=Smear | ||
Line 242: | Line 416: | ||
Number of horizontal LEDs - X axis | Number of horizontal LEDs - X axis | ||
+ | |||
+ | <span style="font-weight: normal;"><u>Column Spacing</u></span> | ||
+ | |||
+ | This property is of type ''Floating point'' and can be referenced with the variable name ''x_spacing''. | ||
+ | |||
+ | X Spacing Between LEDs on the Panel | ||
<span style="font-weight: normal;"><u>LED Rows</u></span> | <span style="font-weight: normal;"><u>LED Rows</u></span> | ||
Line 249: | Line 429: | ||
Number of vertical LEDs - Y axis | Number of vertical LEDs - Y axis | ||
− | <span style="font-weight: normal;"><u> | + | <span style="font-weight: normal;"><u>Row Spacing</u></span> |
+ | |||
+ | This property is of type ''Floating point'' and can be referenced with the variable name ''y_spacing''. | ||
+ | |||
+ | Y Spacing Between LEDs on the Panel | ||
+ | |||
+ | <span style="font-weight: normal;"><u>Flip X</u></span> | ||
+ | |||
+ | This property is of type ''True or false'' and can be referenced with the variable name ''FlipX''. | ||
+ | |||
+ | Flips the X axis if the LEDs are wired from the right hand side of the display. | ||
+ | |||
+ | <span style="font-weight: normal;"><u>Flip Y</u></span> | ||
− | This property is of type '' | + | This property is of type ''True or false'' and can be referenced with the variable name ''FlipY''. |
− | + | Flips the Y axis if the LEDs are wired from the bottom side of the display. | |
<span style="font-weight: normal;"><u>Output Mode</u></span> | <span style="font-weight: normal;"><u>Output Mode</u></span> |
Latest revision as of 15:46, 16 February 2017
Author | Matrix TSL |
Version | 1.1 (Release) |
Category | Outputs: LEDs |
Contents
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.
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
Downloadable macro reference
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.
Parameters
- FLOAT Scaler
- Range: 0.0 to 1.0 Default: 1.0, 0 = Off, 0.5 = Half Brightness, 1.0 = Full Brightness
Return value
- This call does not return a value
GetLEDColour
Sets the colour of a single LED in RAM as a 1D array.
Parameters
- UINT LED
- LED to change the colour / Range: 0 to (LED Count - 1)
- BYTE ColIdx
- 0 = R, 1 = G, 2 = B
Return value
DrawLine2D
Draws a line on a 2D array of LEDs
Parameters
- UINT X1
- UINT Y1
- UINT X2
- UINT Y2
- BYTE R
- BYTE G
- BYTE B
Return value
- This call does not return a value
SetAllLEDColour
Sets the colour of all the LEDs in RAM
Parameters
- BYTE R
- BYTE G
- BYTE B
Return value
- This call does not return a value
SetLEDColour
Sets the colour of a single LED in RAM as a 1D array.
Parameters
- UINT LED
- LED to change the colour / Range: 0 to (LED Count - 1)
- BYTE R
- BYTE G
- BYTE B
Return value
- This call does not return a value
Refresh
Clocks out the current colour data to the LEDs from the values stored in RAM
Parameters
- This macro has no parameters
Return value
- This call does not return a value
ShiftLEDs1D
Shifts the LED colours in 1D and wraps
Parameters
- BYTE Direction
- 0 = Forwards, 1 = Backwards
- BYTE DataMode
- 0=ResetToZero, 1=WrapAroundDisplay, 2=Smear
Return value
- This call does not return a value
DrawLine3D
Draws a line on a 3D array of LEDs
Parameters
- UINT X1
- UINT Y1
- UINT Z1
- UINT X2
- UINT Y2
- UINT Z2
- BYTE R
- BYTE G
- BYTE B
Return value
- This call does not return a value
GetLEDIndex2D
Sets the index of a single LED in RAM as a 2D array.
Parameters
- 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)
Return value
DrawRectangle2D
Draws a basic 2D rectangle onto the LEDs
Parameters
- 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
Return value
- This call does not return a value
ShiftLEDs2D
Shifts the contents of the display by the number of vertices specified
- Please Note that Wrap mode is currently unavailable***
Parameters
- 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
Return value
- This call does not return a value
GetLEDIndex3D
Gets the index of a single LED in RAM as a 3D array.
Parameters
- 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)
Return value
DrawCuboid3D
Draws a basic 3D cuboid onto the LEDs
Parameters
- 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
Return value
- This call does not return a value
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.
Parameters
- This macro has no parameters
Return value
- This call does not return a value
ShiftLEDs3D
Shifts the contents of the display by the number of vertices specified
- Please Note that Wrap mode is currently unavailable***
Parameters
- 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
Return value
- This call does not return a value
Simulation macro reference
This component does not contain any simulation macros
Property reference
LED Arrangement
This property is of type Fixed list of ints and can be referenced with the variable name 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
This property is of type Unsigned integer and can be referenced with the variable name LED_Count.
Total number of LEDs in the design
LED Columns
This property is of type Unsigned integer and can be referenced with the variable name LED_Cols.
Number of horizontal LEDs - X axis
Column Spacing
This property is of type Floating point and can be referenced with the variable name x_spacing.
X Spacing Between LEDs on the Panel
LED Rows
This property is of type Unsigned integer and can be referenced with the variable name LED_Rows.
Number of vertical LEDs - Y axis
Row Spacing
This property is of type Floating point and can be referenced with the variable name y_spacing.
Y Spacing Between LEDs on the Panel
Flip X
This property is of type True or false and can be referenced with the variable name FlipX.
Flips the X axis if the LEDs are wired from the right hand side of the display.
Flip Y
This property is of type True or false and can be referenced with the variable name FlipY.
Flips the Y axis if the LEDs are wired from the bottom side of the display.
Output Mode
This property is of type Fixed list of ints and can be referenced with the variable name 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
Data Pin
This property is of type Single digital pin and can be referenced with the variable name MOSI.
LED Data Pin - Connected to the Data In pin of the first WS8201 IC.
Clock Pin
This property is of type Single digital pin and can be referenced with the variable name CLK.
LED Clock Pin - Connected to the Clock In pin of the first WS8201 IC.