How-to · Intermediate · 3 min read
WS2812B Addressable LEDs (NeoPixel)
Power, Wiring and Code
By Geekobot Learning Team · Updated 24 Oct 2026
On this page
WS2812B LEDs (often called NeoPixels) contain a red, green and blue LED plus a tiny controller, so each LED on a strip can be set to any colour from one data pin. They run on 5 V and each can draw up to about 60 mA at full white, so a 60-LED strip needs a 5 V 4 A supply. Add a 330 Ω data resistor and a 1000 µF capacitor.
Key specs at a glance
- Supply
- 5 V (3.5 to 5.3 V)
- Current per LED
- Up to about 60 mA at full white; about 20 mA per colour
- Data
- Single wire, 800 kHz, 24-bit GRB colour
- Data high threshold
- 0.7 x VDD (3.5 V at 5 V)
- Common densities
- 30, 60, 144 LEDs per metre
- Libraries
- FastLED, Adafruit NeoPixel
How addressable LEDs work
Each WS2812B reads the first 24 bits of colour data it receives, keeps them, and passes the rest along to the next LED. Sending 60 x 24 bits sets a 60-LED strip. Because the data path runs one way, data must enter at the DIN end, marked with arrows on the strip.
How much power does a WS2812B strip need?
Worst case (all LEDs full white): LEDs x 60 mA. Real animations average 20 to 30% of that, but size the supply for at least the worst case you will allow in code.
| Strip | Max current | Suggested 5 V supply |
|---|---|---|
| 8-LED stick or ring | 0.5 A | USB or board 5 V for testing |
| 30 LEDs (0.5 m at 60/m) | 1.8 A | 5 V 2 A |
| 60 LEDs (1 m at 60/m) | 3.6 A | 5 V 4 A |
| 150 LEDs (5 m at 30/m) | 9 A | 5 V 10 A, inject power |
| 300 LEDs (5 m at 60/m) | 18 A | 5 V 20 A, inject every 1 to 1.5 m |
- 8-LED stick or ring
- Max current:
- 0.5 A
- Suggested 5 V supply:
- USB or board 5 V for testing
- 30 LEDs (0.5 m at 60/m)
- Max current:
- 1.8 A
- Suggested 5 V supply:
- 5 V 2 A
- 60 LEDs (1 m at 60/m)
- Max current:
- 3.6 A
- Suggested 5 V supply:
- 5 V 4 A
- 150 LEDs (5 m at 30/m)
- Max current:
- 9 A
- Suggested 5 V supply:
- 5 V 10 A, inject power
- 300 LEDs (5 m at 60/m)
- Max current:
- 18 A
- Suggested 5 V supply:
- 5 V 20 A, inject every 1 to 1.5 m
Wiring WS2812B the reliable way
- 1Power: connect the strip's 5V and GND directly to a 5 V supply, not through the microcontroller.
- 2Capacitor: put a 1000 µF, 6.3 V or higher electrolytic across 5V and GND at the strip's input.
- 3Data resistor: put a 300 to 500 Ω resistor in series between the data pin and DIN, close to the strip.
- 4Common ground: connect the supply ground to the microcontroller ground.
- 5Power injection: on long strips, run extra 5V and GND wires to every 1 to 2 m so the far end does not turn orange or dim.
ESP32 and Pico: their 3.3 V data is below the 3.5 V the LEDs expect. It often works on short leads, but for reliability add a 74AHCT125 level shifter powered from 5 V.
FastLED example
#include <FastLED.h>
#define DATA_PIN 6
#define NUM_LEDS 60
CRGB leds[NUM_LEDS];
void setup() {
FastLED.addLeds<WS2812B, DATA_PIN, GRB>(leds, NUM_LEDS);
FastLED.setMaxPowerInVoltsAndMilliamps(5, 2000); // cap at 2 A
FastLED.setBrightness(80);
}
void loop() {
static uint8_t hue = 0;
fill_rainbow(leds, NUM_LEDS, hue++, 255 / NUM_LEDS);
FastLED.show();
delay(20);
}WS2812B vs WS2811 vs SK6812 vs WS2815
| Type | Voltage | Difference | Choose it for |
|---|---|---|---|
| WS2812B | 5 V | Controller inside each LED | Most projects, rings, matrices |
| WS2811 | 12 V | One controller per 3 LEDs | Long runs, building outlines |
| SK6812 RGBW | 5 V | Adds a true white LED | Better whites and room lighting |
| WS2815 | 12 V | Backup data line keeps strip working if one LED fails | Long installations |
- WS2812B
- Voltage:
- 5 V
- Difference:
- Controller inside each LED
- Choose it for:
- Most projects, rings, matrices
- WS2811
- Voltage:
- 12 V
- Difference:
- One controller per 3 LEDs
- Choose it for:
- Long runs, building outlines
- SK6812 RGBW
- Voltage:
- 5 V
- Difference:
- Adds a true white LED
- Choose it for:
- Better whites and room lighting
- WS2815
- Voltage:
- 12 V
- Difference:
- Backup data line keeps strip working if one LED fails
- Choose it for:
- Long installations
Try it: LED strip power calculator
Change the values and the diagram and results update as you type.
Common mistakes to avoid
- Powering more than a few LEDs from the Arduino or ESP32 5 V pin.
- Feeding data into the DOUT end of the strip.
- Skipping the common ground between the supply and the microcontroller.
- Leaving out the input capacitor; the first LED often dies from power-on spikes.
- Running long strips from one end only, so the colours drift and wires overheat.
Frequently asked questions
How much power does a WS2812B LED strip use?
Up to about 60 mA per LED at full white, so 60 LEDs need up to 3.6 A at 5 V. Typical animations use far less; you can cap power in FastLED.
Can I power WS2812B LEDs from Arduino?
Only a handful of LEDs at low brightness for testing. Use a separate 5 V supply for strips, with a shared ground.
Do WS2812B LEDs work with ESP32?
Yes, and short runs often work directly from 3.3 V data. For reliable results, add a 74AHCT125 level shifter, and use the FastLED or NeoPixelBus library with RMT support.
Why are my LEDs flickering or showing wrong colours?
Common causes: no common ground, missing data resistor, 3.3 V data level, a long data wire, or the wrong colour order (use GRB for WS2812B).
What is the difference between WS2812 and WS2812B?
The WS2812B is the improved version with four pins instead of six, better heat handling and reverse-polarity protection. Code and libraries treat them the same.
Parts for this guide
Calculators
Terms in this guide
Projects that use it
Put this into practice: 78 step-by-step builds in our project library use parts from this guide.
Keep learning
Sources
- WS2812B intelligent control LED datasheet (Worldsemi)
- SK6812 datasheet (Opsco)
- Adafruit NeoPixel Uberguide
- FastLED library documentation
Written by the Geekobot team from manufacturer datasheets. Always check the datasheet for the exact part and variant you buy.




