A XIAO ESP32S3 can drive hundreds of WS2812B LEDs; what it can’t do is power them. Send data from D1 through 330 Ω, and give the strip its own 5 V adapter with the grounds joined.
The sketch runs a rainbow at about 25 % brightness.
Wiring
| XIAO ESP32S3 | WS2812B addressable RGB LED strip (NeoPixel) | Wire | Notes |
|---|---|---|---|
| D1 | DIN | green | Via 330 Ω |
| 5 V 2 A adapter · +5V | 5V | red | 1000 µF capacitor across 5V/GND at the strip. |
| 5 V 2 A adapter · GND | GND | black | |
| GND | GND | black | Common ground with the XIAO. |
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
- The XIAO S3’s 5V pin is USB VBUS — fine for a few LEDs, but it reads 0 V on battery and feeding 5 V back into it needs a diode. A separate supply avoids both problems.
- D1 (GPIO2) has no boot role. On the Sense board avoid D8–D10, which the SD-card slot shares.
- The XIAO S3 has no on-board RGB LED, only the orange user LED on GPIO21.
Code
// WS2812B strip on a Seeed XIAO ESP32S3.
// DIN → D1 (GPIO2) through 330 Ω. Strip 5V/GND → its own 5 V supply; supply GND → XIAO GND.
#include <Adafruit_NeoPixel.h>
constexpr uint16_t COUNT = 30;
Adafruit_NeoPixel strip(COUNT, D1, 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();
Serial.printf("WS2812B: %u LEDs on D1\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();
hue += 256;
delay(20);
}// WS2812B strip on a Seeed XIAO ESP32S3.
// DIN → D1 (GPIO2) through 330 Ω. Strip 5V/GND → its own 5 V supply; supply GND → XIAO GND.
#include <Adafruit_NeoPixel.h>
constexpr uint16_t COUNT = 30;
Adafruit_NeoPixel strip(COUNT, D1, 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();
Serial.printf("WS2812B: %u LEDs on D1\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();
hue += 256;
delay(20);
}Library: Adafruit NeoPixel (Adafruit) — compiled with Adafruit NeoPixel 1.15.5.
Expected serial output
WS2812B: 30 LEDs on D1WS2812B: 30 LEDs on D1
Common errors
Nothing lights
Missing common GND, or data into DOUT. The arrows on the strip point away from DIN.
XIAO resets at full brightness
The strip is sharing the XIAO’s supply. Brownout fix.