Skip to content

Driver

WS2812_RMT Driver

A C++20 driver for single-wire addressable RGB and RGBW LEDs (WS2812, SK6812 and compatible), sent as a timed bit stream through a small port class.

Quickstart API guide Source on GitHub

The core is platform-free: it keeps the pixels, encodes the byte stream and works out the waveform from the datasheet windows and the tick rate your port really runs at. The port sends the bytes. On ESP32 that is the RMT transmitter, and the repository ships that port as an example.

MCU-bound through the port

The driver needs a peripheral that can send a timed bit stream (bus: pio in driver.yml). On ESP32 that is the RMT transmitter. On another MCU you write a port over its own peripheral: Porting.

Addressable LED WS2812B Worldsemi (and the SK6812 family of Opsco)
Interface
One data line, 800 kbit/s: the length of each high pulse is the bit, 24 bits per pixel (32 on SK6812RGBW)
Supply
3.7 V to 5.3 V (WS2812B V5, absolute maximum); see Hardware for each part
Timing
Four windows, each from the datasheet, and a reset above 280 µs (V5): see Timing

What you get

  • One object per strip, with a fixed capacity and no heap. No I/O until EnsureInitialized(). See API guide.
  • The right waveform for your part. A named variant per datasheet generation, or your own windows with Custom. A waveform outside the windows cannot reach the wire. See Timing.
  • Errors you can act on: Result<T> with an Error. See Contract.
  • Colour order, brightness and gamma as data, not code. See Colour.
  • Tested without hardware against a model written from the datasheets. See Testing and CI.

Datasheet

Document Revision Get it
Datasheet: WS2812 (6 pin) (Worldsemi WS2812) undated, 2012-10 mirror
Datasheet: WS2812S (6 pin) (Worldsemi WS2812S) undated, 2013-12 mirror
Datasheet: WS2812B (Worldsemi WS2812B) undated, 2013-05 mirror
Datasheet: WS2812B (Chinese-language edition) (Worldsemi WS2812B) undated, 2013-12 mirror
Datasheet: WS2812B (Worldsemi WS2812B) Mar-2017, 2017-03 mirror
Datasheet: WS2812B Ver. No. V5 (Worldsemi WS2812B-V5) V5.0, 2019-03 mirror
Datasheet: WS2812B Ver. No. V5 (Watterott copy, revision V6.1) (Worldsemi WS2812B-V5) V6.1, 2022-09 mirror
Datasheet: WS2812B-V5/W (Hestore copy, revision V6.0) (Worldsemi WS2812B-V5/W) V6.0, 2021-12 no mirror recorded
Datasheet: WS2812B-1313-V6 (1313 package) (Worldsemi WS2812B-1313-V6) V1.0, 2025-10 no mirror recorded
Datasheet: WS2812B-V6 (Worldsemi WS2812B-V6) V1.1, 2025-10 mirror
Datasheet: WS2812B-2020 (Worldsemi WS2812B-2020) V1.2, 2018-12 mirror
Datasheet: WS2812C (5050, 5 mA) (Worldsemi WS2812C) V1.0, 2017-05 mirror
Datasheet: Document headed WS2812C, body text WS2812B (Worldsemi WS2812C) V1.4, 2018-07 mirror
Datasheet: WS2812C-2020 (Worldsemi WS2812C-2020) V1.0, 2019-03 mirror
Datasheet: WS2812-2020 (Worldsemi WS2812-2020) V1.0, 2018-05 mirror
Datasheet: WS2812D-F8 15 mA (8 mm round) (Worldsemi WS2812D-F8) V1.1, 2018-04 mirror
Datasheet: SK6812 (RGB, 5050) (Opsco SK6812) Rev. 01, 2015-05 mirror
Datasheet: SK6812RGBW (Opsco SK6812RGBW) Rev. 01, 2015-07 mirror
Datasheet: SK6812RGBX-XX (RGBW) (Opsco SK6812RGBX-XX) Rev. 03, 2018-07 mirror
Datasheet: SK6812RGBX-XX (Opsco SK6812RGBX-XX) Rev. 07, 2019-01 mirror
Datasheet: SK6812MINI-E (Opsco SK6812MINI-E) Rev. 02, 2019-01 mirror
Datasheet: SK6812MINIRGBX-XX (mini RGBW) (Opsco SK6812MINIRGBX-XX) Rev. 01, undated, 2022-11 mirror

Written against these revisions; the SHA-256 of each file is in docs/datasheets.yml. Where each part of the driver is in the datasheet: Datasheet map.