LED Strip Bricklet 2.0

Features

  • Controls up to 2048 RGB or 1536 RGBW LEDs
  • All LEDs can be switched independently
  • Update rate of up to 100Hz for each LED possible

Description

The LED Strip Bricklet 2.0 can be used to control LED strips and LED pixels that are equipped with the WS2801, WS2811, WS2812/SK6812 (NeoPixel RGB), SK6812RGBW (NeoPixel RGBW), LPD8806 or APA102 (DotStar) LED driver. It is possible to independently control 2048 RGB or 1536 RGBW LEDs (6144 individual LEDs) over the connected Brick.

The API allows to change all LEDs at the same time with a fixed update rate of up to 100Hz. A possible application can be found in the Starter Kit: Blinken Lights: Video

Note

The maximum update rate depends on type and number of attached LEDs (see here).

Technical Specifications

Property Value
Supported LED Drivers
WS2801, WS2811, WS2812/SK6812 (NeoPixel RGB), WS2813, WS2815,
SK6812RGBW (NeoPixel RGBW), LPD8806 and APA102 (DotStar)
Current Consumption 64mW (12.8mA at 5V)
   
Resolution 8bit per LED
Maximum Number of LEDs 6144 (2048 RGB or 1536 RGBW LEDs)
Maximum Update Rate 100 updates per second
   
Dimensions (W x D x H) 30 x 30 x 12mm (1.18 x 1.18 x 0.47")
Weight 8.1g

Resources

Test your LED Strip Bricklet 2.0

To test a LED Strip Bricklet 2.0 you need to have Brick Daemon and Brick Viewer installed. Brick Daemon acts as a proxy between the USB interface of the Bricks and the API bindings. Brick Viewer connects to Brick Daemon. It helps to figure out basic information about the connected Bricks and Bricklets and allows to test them.

Connect the LED Strip Bricklet 2.0 to a Brick with a Bricklet Cable. After that connect a LED strip or bunch of pixels to the Bricklet as described below.

If you connect the Brick to the PC over USB, you should see a new tab named "LED Strip Bricklet 2.0" in the Brick Viewer after a moment. Select this tab. If everything went as expected you can now control a LED strip.

LED Strip Bricklet 2.0 in Brick Viewer

After this test you can go on with writing your own application. See the Programming Interface section for the API of the LED Strip Bricklet 2.0 and examples in different programming languages.

Supported LEDs

The LED Strip Bricklet 2.0 supports LED strips and pixels equipped with the WS2801, WS2811 or WS2812, SK6812 (NeoPixel RGB), SK6812RGBW (NeoPixel RGBW), LPD8806 and APA102 (DotStar) driver ICs. Driver ICs refers to any of these chips.

You have to configure which of this driver chips you want to use with the Brick Viewer or the set_chip_type() function of the LED Strip Bricklet 2.0.

The driver ICs can control up to four LEDs independently. Typically a RGB(W) LED combined in one package is used. It is controlled over a three or two wire chained data bus with clock, data signal and ground as voltage reference (daisy chain). Each Driver has a bus input connected to a controlling device such as the LED Strip Bricklet 2.0 or to a driver predecessor and a bus output which can be connected to a subsequent LED driver. Since it is a chained bus, a single bus output has to be connected only to a single bus input. The bus is indexed beginning with the first LED driver on the LED Strip Bricklet 2.0 (API index 0).

LED Strip with WS2801

The above picture depicts a typical WS2801 LED strip. You can see each module equipped with one WS2801 chip and a connected RGB LED. Recognize the signal labels for input (IN) and output (OUT): 5V, CK (clock), SD (serial data) and GND. In contrast to the WS2801, the WS2811 and WS2812 driver chips don't have a clock signal.

Connectivity

The following image depicts the interfaces of the LED Strip Bricklet 2.0.

LED Strip Bricklet 2.0 Interface Description

As described in the Supported LEDs section above, the Bricklet supports LED strips and pixels with WS2801, WS2811, WS2812, SK6812 (NeoPixel RGB), SK6812RGBW (NeoPixel RGBW), LPD8806 and APA102 (DotStar) driver. The terminal labeled with "Output" has to be connected with the input of the first LED driver.

The output terminal consists of four signals:

  • "DAT" is the data signal line to the LED driver chip. It has to be connected to the data input of the first driver chip. Unfortunately there is no general label on LED pixels or on LED strips for this input. Sometimes the signal is marked with SD (Serial Data) or DI (Data Input). It is also possible that the input of the pixel or strip is not marked, but the output is marked (DO, Data Output). If the output is marked, the non marked other side has to be the input.

  • "CLK" is the clock signal line to the driver chip. It has to be connected with the clock input of the first LED driver chip. This input is typically labeled with CLK, CK or CI (Clock Input). If only the output is labeled it can be labeled with CO (Clock Output).

    The WS2811, WS2812 and SK6812 chips don't have a clock signal, leave the "CLK" terminal unconnected form them.

  • "-" is the ground signal line. Ground is necessary to give a reference for the DAT and CLK signals.

  • "+" is the supply voltage output. It is connected to the "+" signal of the "Input" terminal and should not be used to power LED Strips or pixels. Leave it unconnected and power the connected strip or pixels directly from your supply.

The input terminal consisting of two signals:

  • "+" voltage supply input. It can be connected to the power supply for the LEDs to measure the supplied voltage. If you don't need this feature you can leave it unconnected.
  • "-" is the ground input. It is internally connected with the "-" ground of the "OUTPUT" terminal.

LED Strips without Clock Signal (e.g. WS2812B)

There is no general color code for LED strips. Especially sometimes the color codes are against any agreements. In this WS2812B LED strip example the red wire is 5V, green is data the white wire is ground.

Connect data of the first strip to the LED Strip Bricklet 2.0 and connect ground of your power supply to it. Pay attention to connect the data input of the first strip to the data output of the LED Strip Bricklet 2.0.

If you want to measure your supply voltage connect 5V to the Bricklet, too. You can connect more LED strips to the first strip in series.

It is not sufficient to power the LED strips only at one point. We recommend to feed power to the strip at least every two meters. This can be done by connecting a cable between the strip and the power supply for each supply point. This will reduce the resistance and minimize the conduction losses. See the following image as an example for it.

LED Strip Bricklet 2.0 wiring for WS2812B LED Strip

LED Strips with Clock signal (e.g. WS2801)

There is no general color code for LED strips. Especially sometimes the color codes are against any agreements. In this WS2801 LED strip example the black wire is 5V, green is clock, red is data and the blue wire is ground.

Connect clock and data of the first strip to the LED Strip Bricklet 2.0 and connect ground of your power supply to it. Pay attention to connect the clock and data input of the first strip to the clock and data output of the LED Strip Bricklet 2.0.

If you want to measure your supply voltage connect 5V to the Bricklet, too. You can connect more LED strips to the first strip in series.

It is not sufficient to power the LED strips only at one point. We recommend to feed power to the strip at least every two meters. This can be done by connecting a cable between the strip and the power supply for each supply point. This will reduce the resistance and minimize the conduction losses. See the following image as an example for it.

LED Strip Bricklet 2.0 wiring for WS2801 LED Strip

LED Pixels

The connection of LED pixels to the LED Strip Bricklet 2.0 is similar to the connection of LED strips. There is no general color code for LED pixels. In the following example the red wire is 5V, blue is ground, clock (WS2801 only) is green and data is the white wire.

Connect clock (WS2801 only) and data of the first bunch of pixels to the LED Strip Bricklet 2.0 and connect ground to it. Pay attention to connect the clock (WS2801 only) and data input of the first pixel to the clock (WS2801 only) and data output of the LED Strip Bricklet 2.0. If you want to measure the voltage of your power supply connect 5V to the Bricklet, too. You can connect more bunches of LED pixel to the first bunch in series.

Typically each bunch has power supply wires at the beginning and the end of the bunch. Connect these over additional wires to the power supply. You can unite nearby wires. This will reduce the resistance and minimize the conduction losses.

LED Strip Bricklet 2.0 wiring for Pixel

Fixed Frame Rate

To achieve a smooth animation a fixed frame rate is desirable. A fixed frame rate is easy to achieve with a properly configured frame duration and the FrameStarted callback. The frame duration configures the amount of time between each frame in ms. The FrameStarted callback is triggered when a new frame transfer to the LEDs is started (the data is double-buffered).

For example, if you want to have an animation with 20 frames per second, you should set the frame duration to 50ms. After the frame duration is set you need to send the first frame (i.e. you need to set all RGB values), wait until the FrameStarted callback is triggered, write the next frame and so on.

Control LEDs with fixed frame rate

If you receive a FrameStarted callback before all LEDs are set, your frame rate is too high.

The maximum frame rate depends on the type and number of attached LEDs. For example SK6812 LEDs allow a maximum data rate of about 800 kbit/s (or 100 kByte/s). As one LED requires 4 bytes of data (RGBW), this means, that only 25000 LEDs can be set per second. Also the LEDs require a reset time of 80 µs between frames. The maximum frame rate can then be calculated as follows: Divide the number of attached LEDs by 25000. This yields the duration of one frame (e.g. 0.02s for 500 attached LEDs). Add the reset time of 80µs and take the inverse: 1 / (0.02s + 0.0008s) ~ 48 Hz. Note that this is a theoretical maximum.

Another factor to keep in mind is the communication between your PC and the Bricklet. Depending on the setup, the communication is typically limited to around 1000 messages per second. One message contains 60 bytes of LED data, so when using RGBW LEDs, you can transfer up to 15000 RGBW values per second (assuming responses from the Bricklet are disabled). Assuming 500 LEDs (as per the example above), it is possible to transfer 30 complete images per second to the Bricklet. The Bricklet's API allows to refresh parts of the image, so if you don't need to change the complete image every frame, a lot of optimization is possible here: For example when updating only half the image per frame, 60 updates per second are possible.

Case

A laser-cut case for the LED Strip Bricklet 2.0 is available.

Case for LED Strip Bricklet

The assembly is easiest if you follow the following steps:

  • Screw spacers to the Bricklet,
  • screw bottom plate to bottom spacers,
  • build up side plates,
  • plug side plates into bottom plate and
  • screw top plate to top spacers.

Below you can see an exploded assembly drawing of the LED Strip Bricklet 2.0 case:

Exploded assembly drawing for LED Strip Bricklet

Hint: There is a protective film on both sides of the plates, you have to remove it before assembly.

Programming Interface

See Programming Interface for a detailed description.

Language API Examples Installation
C/C++ API Examples Installation
C/C++ for Microcontrollers API Examples Installation
C# API Examples Installation
Delphi/Lazarus API Examples Installation
Go API Examples Installation
Java API Examples Installation
JavaScript API Examples Installation
LabVIEW API   Installation
Mathematica API Examples Installation
MATLAB/Octave API Examples Installation
MQTT API Examples Installation
openHAB API Examples Installation
Perl API Examples Installation
PHP API Examples Installation
Python API Examples Installation
Ruby API Examples Installation
Rust API Examples Installation
Shell API Examples Installation
Visual Basic .NET API Examples Installation
TCP/IP API    
Modbus API