Parts

WS2812B addressable LED: pinout, timing, current and 3.3 V data

By Bulan Sarkar

The WS2812B pinout, top view with the lens up, is 1 VDD top left, 2 DOUT bottom left, 3 VSS (ground) bottom right at the cut corner and 4 DIN top right. Data goes in at DIN and leaves at DOUT for the next LED.

Each one is a red, green and blue LED with its own controller in a 5 × 5 mm package, and a strip is just a long chain of them on one data wire. This page covers the timing, how much current a strip draws and why a 3.3 V board drives it without a guarantee. Every figure comes from Worldsemi's own datasheet, the only maker datasheet for the part.

Datasheet: Worldsemi WS2812B-V5/W Intelligent control LED integrated light source (PDF)Ask Datasheet Guru about the WS2812B

Advertisement

Pinout by package

WS2812B-V5 5050 · Worldsemi1=VDD 2=DOUT 3=VSS 4=DIN
top view, lens up, cut corner bottom right1VDD2DOUT3VSS4DIN

Top view, lens up: VDD top left, DOUT bottom left, VSS bottom right at the cut corner, DIN top right.

The cut corner on the top marks pin 3, ground.

Source: Worldsemi WS2812B-V5/W Intelligent control LED integrated light source, p. 2 (pin configuration drawing and pin function table: 1 VDD, 2 DOUT, 3 VSS, 4 DIN); Worldsemi WS2812B-V5/W Intelligent control LED integrated light source, p. 2 (mechanical drawing: 5.0 × 5.4 × 1.57 mm, pads 0.9 mm)

Which one do you have?

The current part is the WS2812B-V5, and its datasheet is the one this page reads. The package is 5.0 × 5.4 × 1.57 mm with four pads, one at each corner. The cut corner on the top marks pin 3, ground.

Strips, rings and matrix boards are sold as "WS2812B" or under the NeoPixel name. Some carry look-alike chips from other makers, which have datasheets and limits of their own. If a strip misbehaves where the numbers below say it should work, the chip may not be a WS2812B at all.

Ratings

The supply range is narrow: 3.7 V to 5.3 V. That is 5 V with a little room either side, so a 5 V adapter is right and a 12 V one is far outside it. The data input may go from −0.3 V to 0.7 V above VDD, which matters when the controller and the strip are powered separately: data must not arrive before the strip has power.

Absolute maximum ratings, Worldsemi WS2812B-V5 datasheet, page 2
ParameterWS2812B-V55050
Supply voltage VDD3.7 to 5.3 V
Logic input voltage VI−0.3 V to VDD + 0.7 V
Operating temperature Topt−40 to 65 °C
Storage temperature Tstg−40 to 85 °C
Moisture sensitivity levelMSL 5a: 24 hours out of the bag

The operating range stops at 65 °C. Each LED at full white turns about 180 mW into heat, so check the temperature of a bright strip inside a closed channel.

Timing, data threshold and current

At 25 °C and VDD = 5 V, as printed on pages 1 and 3
ParameterWS2812B-V55050
Input high voltage VIHVDD = 5 V, 25 °C0.63 VDD min
Input low voltage VIL0.7 V max
Input current II±1 µA max
Input capacitance CI15 pF max
DIN to DOUT delay tPLZCL 15 pF, RL 10 kΩ300 ns max
Current per colourLED test condition12 mA
Quiescent current0.6 mA (centre value)
Brightness, red / green / blue IV12 mA310 / 780 / 215 mcd typ
Wavelength, red / green / blue λd621 / 520 / 471 nm typ
0 code: high, then low T0H, T0L220 to 380 ns, 580 ns to 1 µs
1 code: high, then low T1H, T1L580 ns to 1 µs, 580 ns to 1 µs
Reset (latch) low time RESmore than 280 µs
Data rate800 kbit/s
Colour orderG, R, B, highest bit first

Each bit is a high pulse followed by a low one. A short high (220 to 380 ns) is a 0 and a long high (580 ns to 1 µs) is a 1. At 800 kbit/s a bit takes 1.25 µs. A low lasting more than 280 µs ends the frame: each LED then shows the colour it was sent.

0 codehigh 220–380 nslow 580–1000 ns1 codehigh 580–1000 nslow 580–1000 nsReset: low for more than 280 µs latches the frame
Figure 1. The 0 and 1 codes, drawn at the middle of each window. The red bar over each high pulse is the range the datasheet allows.

The first LED keeps the first 24 bits it sees and passes everything after them on, reshaped, through DOUT. So the second LED gets the second 24 bits, and so on down the chain. Within each 24 bits the order is green, red, blue, highest bit first. Sending red first swaps red and green on the strip.

G7G0R7R0B7B0first bit sentlast bitgreenredblue24 bits per pixel, highest bit of each colour first
Figure 2. One pixel's data. Green goes first, not red.

3.3 V data: why it works on the bench and fails later

The datasheet says a high must reach 0.63 × VDD. At 5 V that is 3.15 V, and at 5.3 V it is 3.34 V. An ESP32 drives its pins to about 3.3 V with a light load, which clears 3.15 V by 150 mV. That is why a strip often works straight from one.

The guaranteed figure is lower. Espressif promises only 0.8 × 3.3 V = 2.64 V for a high, 510 mV short of what the LED needs at 5 V. A long wire or a supply a little above 5 V can tip it over, and the first LED reads garbage. The two lines in Figure 3 cross at 4.19 V: only below that supply is the ESP32's guaranteed high enough.

2.02.42.83.23.63.74.14.54.95.3supply VDD (V)3.3 V, typical output2.64 V, ESP32 guaranteedneeded: 0.63 × VDD4.19 V
Figure 3. What the data input needs against supply voltage. At 5 V only the typical 3.3 V output clears it, by 150 mV.

The fix that costs least is a 74AHCT125 buffer powered from 5 V between the board and DIN. Its input counts anything over 2.0 V as a high and its output swings to the 5 V rail. Tie its enable pin to ground. Our 3.3 V to 5 V level shifter guide compares it with the other options; it keeps the BSS138 module for I²C, not LED data.

What it is good for

  • Strips, rings and matrices where every LED needs its own colour, from one data pin.
  • Status lights on a board: one WS2812B gives any colour from one pin, with no resistors.
  • Long chains: the sheet promises at least 1024 pixels at 30 frames a second, and up to 5 m between two LEDs without extra parts.

It is the wrong part for plain white lighting. A 12 V LED strip on a MOSFET does that job with no controller and no data line. For a single LED on a pin, see LED circuits.

Worked example: a 5 m strip at 60 LEDs per metre

Take the common strip: 60 LEDs per metre, 5 m, so 300 LEDs on 5 V. The datasheet tests each colour at 12 mA and gives a quiescent current of 0.6 mA.

1. One LED at full white. 3 × 12 mA + 0.6 mA = 36.6 mA.

2. The whole strip at full white. 300 × 36.6 mA = 11 A, or 54.9 W at 5 V.

3. The strip with every LED off. 300 × 0.6 mA = 180 mA, 900 mW spent on doing nothing.

4. One frame. 300 × 24 bits × 1.25 µs = 9 ms, plus the 280 µs reset: 9.28 ms. That allows at most 108 frames a second.

5. Check against the sheet. 1024 pixels take 31 ms per frame, so 32.3 frames a second: the datasheet's "30 fps at 1024 pixels" holds.

all off0.6 mAone colour12.6 mAtwo colours24.6 mAfull white36.6 mA
Figure 4. Current per LED, from the datasheet's 12 mA per colour and 0.6 mA quiescent. Multiply by the LED count for the supply.
5 V supply, 11 A or moreGND, shared by all3.3 VboardGPIO5V in74AHCT125LED 1DINDOLED 2DINDO5 V data
Figure 5. The strip, the buffer and the board on one 5 V supply with a shared ground. Data goes in at DIN, never at DO.

A supply of at least 11 A covers the worst case. Most effects never light every LED white at full brightness, so a smaller supply often runs; if you choose one, cap the brightness in software to match it. The power dissipation lesson covers where those 55 W end up.

Worked example in numbers

One LED, full white
36.6 mA
300 LEDs, full white
11 A
Data high needed at 5 V
3.15 V
Fastest refresh, 300 LEDs
108 fps
Advertisement

Tips and checks

  • Feed data into the DIN end. Most strips print an arrow showing the direction; data sent into DO goes nowhere.
  • Join the ground of the controller to the ground of the strip supply. Without it the data line has no reference and the colours flicker at random.
  • Power the strip before or with the controller, never after. The data pin must stay within 0.7 V of VDD, and a live data line into an unpowered strip breaks that.
  • Send green, red, blue. If red and green come out swapped, the library is set to RGB order.
  • Budget 36.6 mA per LED at full white and pick the supply and wire for it, or limit the brightness in code.
  • Keep the strip under 65 °C, the top of its operating range. Touch-check a bright strip inside a closed channel after ten minutes.

Substitutes

We list no drop-in substitute. Other chips sold for the same job, from Worldsemi and from other makers, change the timing, the supply range or the pin order, and we have not checked their datasheets for this page. Look for the chip's own datasheet before you mix two types in one chain.

A bench check

  1. Power the strip alone from 5 V, data unconnected. Nothing should light, and the current should be about 0.6 mA per LED.
  2. Join the grounds, connect the data line to DIN of the first LED and send one LED at dim red. If the wrong LED lights, or the colour is wrong, check the colour order and which end you are feeding.
  3. Light the whole strip white at a low brightness and measure the voltage at the far end. A large drop there means the strip needs power fed in at both ends.
  4. If the first LED flickers or shows random colours from a 3.3 V board, put a 74AHCT125 in the data line before you change anything else.

The common mistakes: data fed into the DO end, no shared ground, a 12 V adapter, a supply sized for one LED instead of the strip, and red and green sent in the wrong order.

What we'd do

Run the strip from a 5 V supply sized for 36.6 mA per LED, or cap the brightness to the supply you have. From a 3.3 V board, put a 74AHCT125 on 5 V in the data line from the start rather than hoping the bare pin is enough. Join the grounds, feed DIN, and send green first.

Questions people ask

What is the WS2812B pinout?

Top view, lens up: 1 VDD top left, 2 DOUT bottom left, 3 VSS (ground) bottom right at the cut corner, 4 DIN top right.

What voltage does a WS2812B need?

3.7 V to 5.3 V on VDD, so 5 V in practice. Its data input needs a high of at least 0.63 × VDD, 3.15 V at 5 V.

Can an ESP32 drive a WS2812B directly?

Often, but not by the datasheets. A typical 3.3 V output clears the 3.15 V threshold by 150 mV; the guaranteed 2.64 V does not. A 74AHCT125 buffer makes it reliable.

How much current does a WS2812B strip draw?

About 36.6 mA per LED at full white, so 11 A for 300 LEDs, and 0.6 mA per LED even when they are all off.

What colour order does the WS2812B use?

Green, red, blue, 8 bits each, highest bit first: 24 bits per LED.

Is a NeoPixel the same as a WS2812B?

NeoPixel is a product name used for strips and boards built on the WS2812B and similar chips. Check which chip a given product uses before relying on these numbers.

Buying the WS2812B in India

WS2812B strips sell by the metre at 30, 60 and 144 LEDs per metre, and as rings, single boards and loose 5050 LEDs. Some listings say WS2812B over a clone chip, so buy from a seller who names the maker, and run the bench check above on arrival. Our guide to buying electronic components in India compares ten online sellers and covers how to spot fakes.

Advertisement

One email a month from the bench

New circuits, lessons, part guides and calculators, on the first Sunday of each month.

We'll send one email to confirm. Every email has a one-click unsubscribe. Privacy policy

Used in these lessons

Lessons that go deeper

Datasheets this page was checked against

Makers revise datasheets. If the copy you download has a newer revision and a number here disagrees with it, the datasheet wins, and we would like to hear about it.