Preview build — page text is a draft awaiting human review. Code badges come from real compiles. The flasher is real but not yet hardware-tested; the Playground is still a preview.

WS2812B LED strip with LOLIN S2 Mini

Drive a WS2812B strip from GPIO5 of a LOLIN S2 Mini through 330 Ω, with the strip on its own 5 V supply, a common ground and the blue LED as a heartbeat.

Arduino C++Verified — core esp32 3.3.12, Adafruit NeoPixel 1.15.5, 3 Nov 2026Compile-only

Community draft — report a mistake

WS2812B strips need 5 V power and one data line. On the S2 Mini send data from GPIO5 through 330 Ω and run the strip from a separate 5 V adapter with a common ground.

The sketch runs a rainbow at about 25 % brightness and blinks the S2 Mini’s blue LED (GPIO15) slowly so you know the code is running.

Wiring

LOLIN S2 MiniOnly the pins used are shown · 3.3 V logic5 V 2 A adapterWS2812B addressable RGB LED strip (NeoPixel)330 Ω+5VGND5 · 5GNDDIN5VGNDDOUT (not connected)
Also needed: 330 Ω resistor, 1000 µF / 10 V capacitor, 5 V 2 A adapter.
Every connection
LOLIN S2 MiniWS2812B addressable RGB LED strip (NeoPixel)WireNotes
5DINgreenVia 330 Ω
5 V 2 A adapter · +5V5Vred1000 µF capacitor across 5V/GND at the strip.
5 V 2 A adapter · GNDGNDblack
GNDGNDblackCommon ground with the S2 Mini.

5 V (about 60 mA per LED at full white) part, 3.3 V board. The strip expects a data HIGH of about 3.5 V at 5 V supply. From ESP32 or Pico the 3.3 V signal often works with short wires, but to be safe drive DIN through a 74AHCT125 (or 74HCT125) powered from 5 V.

Board quirks

  • Don’t feed 5 V into VBUS while USB is plugged in: the S2 Mini has no reverse-current diode there. With the strip on its own supply and only GND shared, that problem never comes up.
  • GPIO5 (D1 mini D0 position) has no boot role. The WS2812 D1 mini shield uses a different position — check its jumper and change STRIP_PIN to match.
  • The S2’s 3.3 V data usually drives a strip on a short wire; if the first LED flickers, add a 74AHCT125 buffer.

Code

ws2812b-s2mini.inoArduino C++Open in PlaygroundOpen in PlaygroundFlash
// WS2812B strip on a LOLIN S2 Mini.
// DIN → GPIO5 through 330 Ω. Strip 5V/GND → its own 5 V supply; supply GND → S2 Mini GND.
#include <Adafruit_NeoPixel.h>

constexpr uint8_t STRIP_PIN = 5;
constexpr uint16_t COUNT = 30;
Adafruit_NeoPixel strip(COUNT, STRIP_PIN, NEO_GRB + NEO_KHZ800);

void setup() {
  Serial.begin(115200);
  uint32_t t0 = millis();
  while (!Serial && millis() - t0 < 3000) {}
  strip.begin();
  strip.setBrightness(60);
  strip.show();
  pinMode(LED_BUILTIN, OUTPUT);  // blue LED on GPIO15
  Serial.printf("WS2812B: %u LEDs on GPIO5\n", COUNT);
}

void loop() {
  static uint16_t hue = 0;
  for (uint16_t i = 0; i < COUNT; i++) {
    strip.setPixelColor(i, strip.gamma32(strip.ColorHSV(hue + i * 65536UL / COUNT)));
  }
  strip.show();
  digitalWrite(LED_BUILTIN, (hue >> 14) & 1);  // slow heartbeat on the blue LED
  hue += 256;
  delay(20);
}

Library: Adafruit NeoPixel (Adafruit) — compiled with Adafruit NeoPixel 1.15.5.

Expected serial output

Serial Monitor · 115200Output
WS2812B: 30 LEDs on GPIO5

Common errors

Strip lights random colours at power-up, then works

Normal before the sketch starts. The 330 Ω resistor and the capacitor reduce it.

S2 Mini resets when the strip goes white

Strip is drawing from the board. Use its own supply. Brownout fix.

↑↓ to move · Enter to open