meta data for this page
LamaPLC: RGB / RGBW addressable LEDs
The WS28xx (WorldSemi) series consists of addressable RGB LEDs that integrate a driver IC and LED chips into a single package or circuit. These LEDs allow for individual control of color and brightness through a single-wire digital signal, making them popular for custom lighting projects.
The SK6812 is an individually addressable LED driver IC often considered the direct successor or “upgraded version” of the WS2812B. While it shares the same single-wire control protocol, it introduces a dedicated fourth channel for true white light (RGBW) and operates at a higher PWM frequency for smoother dimming.
Code Compatibility
If you swap a WS2812B (RGB) strip for an SK6812 (RGBW) strip, you must update your code. The controller needs to send 32 bits instead of 24. If you don't, the colors will “shift” down the line, appearing as static or incorrect.
Popular WS28xx Models
The series uses a common communication protocol, but models vary in voltage, control accuracy, and reliability.
- WorldSemi WS2812B (Standard 5V): The most common model, with the IC embedded directly within the 5050 LED package. It runs on 5V DC, enabling high pixel density since each LED is individually addressable. However, it lacks a backup data line; if an LED fails, the signal can't pass through to the rest of the strip.
- WorldSemi WS2811 (External IC 12V/24V): This model employs an external driver chip, usually mounted on the PCB rather than inside the LED. In strips, it typically controls groups of three LEDs as a single pixel, reducing detail in complex animations but offering a cost-effective solution for large displays.
- WorldSemi WS2813 (Reliable 5V): An improved version of the WS2812B, featuring a dual-signal data line. Its “breakpoint resume” function ensures the strip continues working if one LED fails (except when two consecutive LEDs fail). It also has a higher PWM frequency (2kHz versus 400Hz) for smoother dimming.
- WorldSemi WS2815 (Reliable 12V): Similar to the WS2813 but operates on 12V DC. This higher voltage greatly minimizes “voltage drop,” allowing longer runs (up to 5 meters) without requiring power injection at multiple points. It also includes a backup data line, like the WS2813.
Technical Comparison
| Feature | WS2811 | WS2812B | WS2813 | WS2815 | SK6812 |
|---|---|---|---|---|---|
| Voltage | 12V / 24V | 5V | 5V | 12V | 5V (mostly) |
| Color Channels | 3 (RGB) | 3 (RGB) | 3 (RGB) | 3 (RGB) | 4 (RGB + White) |
| Data Length | 24-bit per pixel | 24-bit per pixel | 24-bit per pixel | 24-bit per pixel | 32-bit per pixel |
| PWM Frequency | ~400 Hz | ~400 Hz | ~2.0 kHz | ~2.0 kHz | ~1.2 kHz |
| Addressability | 3-LED segments | Individual | Individual | Individual | Individual |
| Backup Data | No | No | Yes (Dual signal) | Yes (Dual signal) | No |
| White Quality | Mixed (Blue-ish) | Mixed (Blue-ish) | Mixed (Blue-ish) | Mixed (Blue-ish) | Pure (Dedicated chip) |
| IC Location | External | Built-in | Built-in | Built-in | Built-in |
Selection Guide
Choosing the right model depends on the scale and complexity of your project:
- For high-density, short runs: Use WS2812B for its low cost and individual control.
- For long-distance installations: Use WS2815 to minimize voltage drop and increase reliability with its backup data line.
- For large-scale budget lighting: Use WS2811 (12V) when individual control of every LED is not required.
- For critical failure prevention: Use WS2813 (5V) or WS2815 (12V) so a single dead LED doesn't break the entire animation.
- The WS2813 and WS2815 are superior for permanent installations because of their dual data lines. If one LED dies, the signal jumps to the next.
- SK6812 wins if you need high-quality white light. Because it has a dedicated white phosphor chip, you can achieve “Warm White” or “Natural White” that looks like a real light bulb.
If you'd like to support the development of the site with the price of a coffee — or a few — please do so here.
Here's a handy tip: you can quickly save this page as a PDF by clicking “export to PDF” in the menu on the right side of the screen.
LEDs Addressing
The WS28xx series uses a daisy-chain addressing mechanism where each LED (or group of LEDs) has no fixed hardware address. Instead, they are indexed by their physical position in the chain.
The communication follows a “data-stripping” or “self-addressing” protocol:
- Data Packet Intake: The first LED in the series receives a long stream of data from the controller. It “takes” the first 24 bits (8 bits each for Green, Red, and Blue) and applies that color to itself.
- Signal Forwarding: After consuming its 24 bits, the first LED reshapes the remaining signal and passes it to the next LED via its Data Out (DOUT) pin.
- Sequential Processing: The second LED now treats the next 24 bits as its own, consumes them, and passes the remaining bits down the line. This process repeats until every LED has received its 24-bit color value.
- Reset Signal: To finalize the update, the controller holds the data line low (typically for > 50 µs), which “latches” the colors and prepares the LEDs for the next frame.
Arduino & Addressable LEDs
Example 1: Arduino & WS2812B
To control WS2812B LEDs with an Arduino, the FastLED and Adafruit NeoPixel Libraries are the most popular options. Both require you to define the data pin, the number of LEDs, and the color order (usually GRB for WS2812B).
FastLED is highly optimized and offers advanced color control features like HSV (Hue, Saturation, Value).
#include <FastLED.h> #define LED_PIN 6 // Pin connected to Din on the strip #define NUM_LEDS 10 // Number of LEDs in your strip #define BRIGHTNESS 50 // Set brightness (0-255) #define LED_TYPE WS2812B // Model type #define COLOR_ORDER GRB // Standard for WS2812B CRGB leds[NUM_LEDS]; // Initialize the LED array void setup() { // Power-up safety delay delay(3000); FastLED.addLeds<LED_TYPE, LED_PIN, COLOR_ORDER>(leds, NUM_LEDS); FastLED.setBrightness(BRIGHTNESS); } void loop() { // Simple "Larson Scanner" effect for(int i = 0; i < NUM_LEDS; i++) { leds[i] = CRGB::Blue; // Set current LED to Blue FastLED.show(); // Update the strip delay(50); leds[i] = CRGB::Black; // Turn it off for the next frame } }
Important Hardware Considerations
- Power: Each LED can draw up to 60mA at full white brightness. For more than 10–15 LEDs, use an external 5V power supply rather than the Arduino's 5V pin to avoid damage.
- Common Ground: If using an external power source, you must connect the power supply's ground (GND) to the Arduino's GND pin.
- Protection: Place a 330–470 Ω resistor between the Arduino data pin and the strip's DIN to prevent signal spikes.
Example 1: Arduino & SK6812
To control SK6812 RGBW LEDs, you must account for the fourth white channel. If you use standard RGB code, the colors will “drift” because the strip expects 32 bits per pixel instead of 24.
The Adafruit NeoPixel Library is the easiest way to handle the extra white channel on Arduino.
This script cycles through Red, Green, Blue, and then the Dedicated White chip.
#include <Adafruit_NeoPixel.h> #define PIN 6 // Data pin #define NUMPIXELS 10 // Number of LEDs // IMPORTANT: Use 'NEO_GRBW' for SK6812 RGBW models Adafruit_NeoPixel strip(NUMPIXELS, PIN, NEO_GRBW + NEO_KHZ800); void setup() { strip.begin(); strip.setBrightness(50); // Set brightness (0-255) strip.show(); // Initialize all pixels to 'off' } void loop() { // 1. Pure Red colorWipe(strip.Color(255, 0, 0, 0), 50); // 2. Pure Green colorWipe(strip.Color(0, 255, 0, 0), 50); // 3. Pure Blue colorWipe(strip.Color(0, 0, 255, 0), 50); // 4. Pure White (Using the dedicated 4th channel) colorWipe(strip.Color(0, 0, 0, 255), 50); // 5. Warm Mix (RGB + White) colorWipe(strip.Color(100, 50, 0, 200), 50); } // Function to fill dots one after the other with a color void colorWipe(uint32_t color, int wait) { for(int i=0; i<strip.numPixels(); i++) { strip.setPixelColor(i, color); strip.show(); delay(wait); } }
Key Differences in SK6812 Code:
- The Flag: You must use NEO_GRBW in the setup. If your LEDs are the “Warm White” or “Cool White” specific version, the order might occasionally be NEO_WRGB, but NEO_GRBW is the industry standard for SK6812 Datasheet specifications.
- The Color Command: strip.Color(R, G, B, W) now accepts a fourth parameter.
- strip.Color(0, 0, 0, 255) turns on only the white element (most efficient).
- strip.Color(255, 255, 255, 0) mixes RGB to make white (less accurate, uses more power).
Hardware Tip for SK6812
Since SK6812 strips have four emitters per pixel, they draw more current than WS2812B strips. Ensure your 5V power supply can handle roughly 80 mA per pixel if you plan to run both RGB and white channels at full brightness simultaneously.
Sensor topics on lamaPLC
This page has been accessed for: Today: 2, Until now: 4
