Overview
Close up of an APA102C, with the red, green, and blue LEDs on at a low brightness. |
---|
These flexible RGB LED panels are an easy way to add complex lighting effects to a project. Each APA102C LED has an integrated driver that allows you to control the color and brightness of each LED independently. The panels can be chained together and can be chained to other APA102C-based products such as our APA102C-Based LED Strips.
In contrast to the WS2812B used in some of our other LED products, which uses a specialized one-wire control interface and requires strict timing, the APA102C uses a standard SPI interface for control (with separate data and clock signals) and has no specific timing requirements, making it much easier to control. Another useful feature of the APA102C is an additional 5-bit brightness control register that allows the brightness of each pixel to be adjusted independently of its color.
We offer APA102C LED panels in three different sizes:
We also have these LEDs available in strips.
Warning: These LED panels can draw a lot of current and overheat if they are operated at full brightness, so we recommend limiting the brightness. See the “Current draw and heat” section below for more information.
While these LED panels are flexible, they should not be bent too sharply, and they are not recommended for use in applications where they will be subjected to repeated flexing.
Details for item #2533
This flexible LED matrix contains 256 RGB LEDs arranged in an 16×16 grid. The panel can draw as much as 15 A at full brightness, but it can overheat at currents well below this. To avoid overheating, we recommend using the panel in a way that keeps the current draw under 5.5 A, which should generally keep the temperature of the LEDs below their 70°C maximum rating (see the recommendations in the “Current draw and heat” section below).
Features and specifications
- Individually addressable RGB LEDs
- 24-bit color control (8-bit PWM per channel); 16.8 million colors per pixel
- Additional color-independent brightness control (5-bit PWM); 32 brightness steps per pixel
- SPI control interface
- 5 V operating voltage
- Each RGB LED draws approximately 60 mA at 5 V with red, green, and blue at full brightness
- 1.0 cm spacing between LED centers
- Black panel color
- Power/data connectors for easy chaining, and additional power and ground wires for alternate power connections
- Example code available for Arduino
Addressable RGB 8×32-LED Flexible Panel, 5V, 10mm Grid (APA102C or SK9822) showing an animated rainbow. |
---|
Using the LED panel
The connectors and power wires for our SK9822 and APA102C LED panels. From left to right: output connector, auxiliary power wires, input connector. |
---|
Each LED panel has three connection points: the input connector, the auxiliary power wires, and the output connector. These can be seen in the adjacent picture.
The input connector has four male pins inside of a plastic connector shroud, each separated by about 0.1″. The black wire is ground, the green wire is the data signal input (DIN), the yellow wire is the clock signal input (CIN), and the red wire is the power line.
The auxiliary power wires consist of stripped black and red wires. The black wire is ground, and the red wire is the power line. This provides an alternate (and possibly more convenient) connection point for LED matrix power.
The output connector is designed to mate with the input connector of another APA102C LED product to allow the panel to be chained to it. The black wire is ground, the green wire is the data output (DOU), the yellow wire is the clock output (COU), and the red wire is the power line.
All three black ground wires are electrically connected, and all three red power wires are electrically connected.
Connecting the LED panel
To control the LED panel from a microcontroller, three wires from the input connector should be connected to your microcontroller. The LED panel’s ground (black) should be connected to ground on the microcontroller, and the LED panel’s data input line (green) and clock input line (yellow) should each be connected to one of the microcontroller’s I/O lines. The male pins inside the input connector fit the female terminations on our premium jumper wires and wires with pre-crimped terminals. If you are connecting the LED panel to a breadboard or a typical Arduino with female headers, you would want to use male-female wires.
We generally recommend powering the LED panel using the auxiliary power wires. Our 5 V wall power adapters work well for powering these LED panels and a DC Barrel Jack to 2-Pin Terminal Block Adapter can help you make the connection between the adapter and the panel. However, you might need a wire stripper to strip off some more insulation from the power wires.
It is convenient that the power wires are duplicated on the input side because you can connect the auxiliary power wires to your 5 V power supply and then the power will be available on the data input connector and can be used to power the microcontroller that is controlling the LED panel. This means you can power the microcontroller and LED panel from a single supply without having to make branching power connections.
Current draw and heat
The APA102C LEDs have a maximum operating temperature of 70°C. These LED panels can draw a significant amount of current and overheat if they are operated at their full brightness. To avoid overheating and reduce the maximum potential current draw, we recommend that you set the APA102C 5-bit brightness setting to a value of 12 (out of 31) or lower. If the software you are using does not support changing the 5-bit brightness setting, then we recommend limiting the red, green, and blue color values for each pixel to 99 (out of 255) or lower. At this reduced brightness level, each RGB LED has a maximum possible current draw of around 21 mA, which in turn should keep the current draw under 1.5 A for the 8×8 panel and under 5.5 A for the 16×16 and 8×32 panels.
If you don’t want to use a reduced brightness level, you can take other measures to reduce the power drawn by the LED panel. For example, limiting the number of LEDs that are on at the same time, limiting how long the LEDs are on, and lowering the color values of the LEDs can all help reduce the power drawn and keep the panel from overheating.
LED panel layout
The LEDs in the panel are connected in a “serpentine” or “boustrophedon” layout, meaning that the direction of the data signals in each row alternates. The signals in each row go in the direction that is the opposite of the row before it. The top side of the LED panel has white arrows to indicate which direction the signals propagate.
An addressable RGB 16×16-LED panel with a plastic diffuser (not included) showing the Pololu logo. |
---|
Making a custom cable
If you do not want to use our premium jumper wires to connect to the LED panel’s input, it is possible to make a custom cable.
One option for making a custom cable is to cut off the unused output connector from the last LED strip or panel in your chain. This can then be plugged into the input connector of the first LED strip or panel. The wires on the output and input connectors are 20 AWG, which is too thick to easily use with our crimp pins and housings, but you could solder the wires to header pins.
Alternatively, you can get your own JST SM connectors and make a custom cable using those. The parts you would need to get are the SMP-04V-BC and the SHF-001T-0.8BS, which are described in the SM Connector datasheet from JST. These can be purchased from several places, including Heilind. You will also need some 22–28 AWG stranded wire and a wire stripper. We do not know of a great way to crimp wires onto the JST crimp pins, but we were able to successfully do it using our narrower crimping tool and pliers. (With the wider crimping tool, it is hard to avoid crimping parts of the pin that should not be crimped.) Before crimping, use pliers to bend the outer set of tabs a little bit so that they can hold on to the insulation of the wire. This makes it easier to position the crimp pin and the wire. Next, you should be able to follow the instructions on the crimping tool product page to crimp the wire. After that, you will probably need to squeeze the crimp pin with pliers to get it to fit into the JST plug housing. On the other end of the cable you could make a custom connector using our crimp pins and crimp connector housings, which will allow you to plug it directly into a breadboard or 0.1″ header pins.
Protocol
These LED panels are controlled through an SPI protocol on the data and clock input lines. The protocol is documented in the APA102C datasheet (1MB pdf), but we describe it below with some modifications that we have found to work better.
The default, idle state of the clock signal line is low, and the data signal is read on each rising edge of the clock. To update the LED colors, you need to toggle the clock line while driving the data line with the value of each bit to send; this can be done through software (bit-banging), or it can be handled by a hardware SPI peripheral in a microcontroller. There is no minimum clock frequency, although using a lower frequency means that it will take longer to update the entire sequence of LEDs, so you will probably want to use the fastest practical clock speed to get the best update rate.
Control signal timing diagram for the SK9822 and APA102C. |
---|
The data for each LED is encoded as a sequence of 32 bits (4 bytes) called an LED frame. The first three bits of the LED frame should be ‘1’. The next 5 bits are a “global”, color-independent brightness value (0–31) that is applied equally to all three color channels. The remaining 24 bits are the color values, in BGR (blue-green-red) order. Each color value uses 8 bits (0–255). The most significant bit of each value is transmitted first.
To update all the LEDs in the panel, you should send a “start frame” of 32 ‘0’ bits, then a 32-bit “LED frame” for each LED, and finally an “end frame”.
The APA102 datasheet recommends that the end frame be composed of 32 ‘1’ bits, but we have found this does not work reliably in certain situations and can sometimes lead to glitches. This can be avoided by using an end frame that consists of at least ``(n – 1)`` extra clock edges, where ``n`` is the number of LEDs, with ‘0’ on the data line. It is often easiest to round up to a multiple of 16 clock edges so that you are counting bytes instead (there are 2 clock edges in a bit and 8 bits in a byte); you would therefore send ``((n – 1) // 16)`` bytes (rounded up to the next whole number). For a more detailed explanation, see the comments in the source code of our APA102 Arduino library, discussed below.
Data format for the SK9822 and APA102C. |
---|
For example, to update all 256 LEDs on a 16×16 panel, you should send a 32-bit start frame, then 256 32-bit LED frames, and a 128-bit end frame, for a total of 8352 bits (1044 bytes).
Each RGB LED receives data on its data input line and passes data on to the next LED using its data output line. The update rate is generally limited only by the speed of the controller; our Arduino library below can update 60 LEDs in about 1.43 milliseconds, so it is possible to update nearly 700 LEDs at 60 Hz. However, constant updates are not necessary; the LED panel can hold its state indefinitely as long as power remains connected.
Note: The minimum logic high threshold for the data and clock signals is 3.5 V, so you should use level-shifters if you want to control these strips from 3.3 V systems. It might be possible to control them with 3.3 V signals directly, but using the LEDs out of spec like this could lead to unexpected problems.
Sample code
To help you get started quickly, we provide an APA102 Arduino library (it also works with our Arduino-compatible A-Star modules).
Additionally, the DotStar Arduino library and Raspberry Pi Python module from Adafruit should work with these panels since the DotStars are based on the APA102. The FastLED Arduino library is another option that focuses on performance and provides advanced functionality like color correction.