Skip to content
displays / ws2812b.md

WS2812B / NeoPixel

A 5050-package RGB LED with built-in IC. One data pin daisy-chains hundreds of LEDs — each gets a 24-bit colour sent over a strict 800 kHz one-wire timing.

In stock Worldsemi 1 files · 347 KB

Specs

Spec Value
Supply 5 V (3.3 V works at reduced brightness; not in spec)
Current per LED up to 60 mA @ full white
Data rate 800 kHz, strict timing
Bits per LED 24 (G8 R8 B8)
Logic level 5 V (3.3 V often works but is out-of-spec)

Power planning

  • 60 mA per LED at full white. 30 LEDs × 60 mA ≈ 1.8 A.
  • For strips > ~30 LEDs, inject 5 V every 1–2 m to avoid voltage drop.
  • Add a 1000 µF cap across V+/GND at the strip input.
  • Add a 300–500 Ω resistor in series with the DATA line.

Wiring (Arduino Uno, short strip)

Strip Arduino / supply
5V (+) external 5 V supply (+)
GND external 5 V supply (–) and Arduino GND (common!)
DIN D6 through 470 Ω

Level shifting

From a 3.3 V MCU (Pi Pico, ESP32) the WS2812B may not latch reliably. Use a 74HCT245 / 74AHCT125 level shifter, or power the first LED at 4.5 V.

Code (FastLED)

#include <FastLED.h>
#define DATA_PIN 6
#define NUM_LEDS 16
CRGB leds[NUM_LEDS];

void setup() {
  FastLED.addLeds<WS2812B, DATA_PIN, GRB>(leds, NUM_LEDS);
  FastLED.setBrightness(40);
}

void loop() {
  for (int i = 0; i < NUM_LEDS; i++) {
    leds[i] = CHSV((i * 16 + millis() / 20) & 0xFF, 255, 255);
  }
  FastLED.show();
  delay(20);
}

Schematic

Each WS2812B contains the LED dies + driver IC. Internal block diagram + timing on page 4 of the datasheet PDF.

Last updated: 2026-05-13 · Source on GitHub