Skip to main content

NeoPixel (WS2812B) Hookup Guide

What You Will Build

Control individually addressable RGB LEDs with Arduino or ESP32.

Parts List

  • WS2812B LED strip or ring
  • Arduino Uno or ESP32
  • 3× jumper wires
  • 5V power supply (≥ 1A per 60 LEDs)
  • 330–470 ohm resistor (for data line)
  • 1000 µF capacitor (for power rail)

Wiring

Strip PinConnect To
VCC (red)5V power supply
GND (white)Common GND (power + Arduino)
DIN (green)Arduino pin 6 (via 330 ohm resistor)

CRITICAL: GND of the power supply MUST connect to Arduino GND. Otherwise data signal has no reference and LEDs flicker or stay off.

Code

Install Adafruit NeoPixel library: Sketch → Include Library → Manage Libraries → "Adafruit NeoPixel"

#include <Adafruit_NeoPixel.h>
#define PIN 6
#define NUMPIXELS 8
Adafruit_NeoPixel strip(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);

void setup() {
strip.begin();
strip.show();
}

void loop() {
for (int i = 0; i < NUMPIXELS; i++) {
strip.setPixelColor(i, strip.Color(255, 0, 0)); // Red
strip.show(); delay(100);
strip.setPixelColor(i, strip.Color(0, 0, 0)); // Off
}
}

Power Budget

  • 1 LED at full white: ~60 mA
  • 60 LED strip at full white: ~3.6 A
  • 8 LED ring at full color: ~120 mA (OK from Arduino 5V pin)
  • For strips > 10 LEDs: use external 5V supply

Troubleshooting

  • Flicker — Check common GND between power and Arduino
  • Wrong colors — Swap NEO_GRB to NEO_RGB in constructor
  • First LED stuck — Replace the data line resistor, or the first LED may be damaged
  • Brownout — External 5V supply needed for more than ~10 LEDs