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 Arduino Nano ESP32

Drive a WS2812B strip from D6 of an Arduino Nano ESP32: 330 Ω, own 5 V supply, and the Pin Numbering setting Adafruit NeoPixel needs on this board.

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

Community draft — report a mistake

A WS2812B strip on the Nano ESP32 uses the same Adafruit NeoPixel code as a classic Nano. Data goes from D6 through 330 Ω; power comes from a separate 5 V adapter, with the grounds joined.

One Nano ESP32 setting matters here: switch Tools → Pin Numbering to “By GPIO number (legacy)”, or the NeoPixel library fails to link. The sketch runs a rainbow at about 25 % brightness and prints which GPIO D6 is.

Wiring

Arduino Nano ESP32Only the pins used are shown · 3.3 V logic5 V 2 A adapterWS2812B addressable RGB LED strip (NeoPixel)330 Ω+5VGNDGNDD6DIN5VGNDDOUT (not connected)
Also needed: 330 Ω resistor, 1000 µF / 10 V capacitor, 5 V 2 A adapter.
Every connection
Arduino Nano ESP32WS2812B addressable RGB LED strip (NeoPixel)WireNotes
D6DINgreenVia 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 Nano.

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

  • There is no 5V pin on the Nano ESP32, and VBUS is raw USB power. A strip needs its own 5 V supply; join only the grounds.
  • Set Tools → Pin Numbering → “By GPIO number (legacy)” for this sketch. In the default “By Arduino pin” mode, Adafruit NeoPixel 1.15.5 fails to link with undefined reference to digitalPinToGPIONumber: its ESP32 driver is a C file and can’t call the core’s C++ pin-remap function.
  • Keep writing D6 in code: in GPIO mode the D6 name still points at the D6 pad (it becomes GPIO9). Only bare numbers change meaning, so 6 would then be GPIO6 = the pad labelled D3.
  • The data signal is 3.3 V — fine for a short wire into a 5 V strip. For long runs add a 74AHCT125 buffer.
  • Don’t confuse the strip with the board’s own RGB LED: that one is a plain common-anode LED on LED_RED/GREEN/BLUE, not a WS2812.

Code

ws2812b-nanoesp32.inoArduino C++Open in PlaygroundOpen in Playground
// WS2812B strip on an Arduino Nano ESP32.
// DIN → D6 through 330 Ω. Strip 5V/GND → its own 5 V supply; supply GND → Nano GND.
// Needs Tools → Pin Numbering → "By GPIO number (legacy)" (set in this sketch's profile):
// Adafruit NeoPixel's ESP32 driver is plain C and can't link to the core's pin-remap function,
// so the default "By Arduino pin" mode fails with "undefined reference to digitalPinToGPIONumber".
// Keep writing D6: in GPIO mode the D6 name still means the D6 pad (GPIO9).
#include <Adafruit_NeoPixel.h>

constexpr uint16_t COUNT = 30;
Adafruit_NeoPixel strip(COUNT, D6, 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 D6 (GPIO%u)\n", COUNT, D6);
}

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

Serial Monitor · 115200Output
WS2812B: 30 LEDs on D6 (GPIO9)

Common errors

“undefined reference to digitalPinToGPIONumber” when compiling

Pin Numbering is still “By Arduino pin”. Switch Tools → Pin Numbering to “By GPIO number (legacy)” and compile again.

Nothing lights

No common GND, or data into DOUT.

Board resets

Strip powered from VBUS. Brownout fix.

↑↓ to move · Enter to open