Retired WS2812 breakout board's pinout. WS2812B breakout board's pinout.
Four unique pins are broken out:
"5V" - The input voltage will can vary based on the IC version's specifications:
WS2812 -- This should be a regulated supply voltage between 5V and about 7V. More than that
could harm the LED, less than 5V will either reduce brightness, or it just won't turn on.
WS2812B -- This should be a regulated supply voltage between 3.3V and about 5V.
GND -- The common, ground, 0V reference supply voltage.
DI -- Data from a microcontroller (or another WS2812/WS2812B pixel) comes into this pin.
DO -- Data is shifted out of this pin, to be connected to the input of another pixel or left floating if it is the last
link in the chain.
We recommend matching the input voltage with the logic level for the data lines (DI and DO). So if you are
powering the WS2812B breakout board with 5V, you will be connecting DI and DO with a logic level of 5V.
Data Transmission Interface
Note: This stuff is ugly, and not critical to understand if you just want to use the breakout board. (That's what
libraries are for, right?!) It's interesting to talk about, because the interface is so unique.
The communication interface between a microcontroller and the WS2812 is weird. It's one wire, but it's not like a
standard, UART serial interface. This interface is very time-specific. Both a logic 0 and a logic 1 require a square
pulse, and it's the length of the pulse that defines which it is.
Timing diagram for a single bit of value 0 or 1.
The data is sent in a sequence containing 24 of those bits -- 8 bits for each color -- followed by a low "reset" pulse
of at least 50µs.
A sequence of 24 timed-bits sets the color for each channel. 8-bits per channel. Green first, then red, then blue.
The larger the value of a specific color is, the brighter it will be. If every color is set to 0, the LED will be off. If every
color is set to max -- 255 -- the LED will be as bright and white as can be.
This is all to say that the interface is very time-specific. To run the LEDs you'll need a real-time processor, like an
Arduino; microprocessors like those on the Raspberry Pi or pcDuino can't give you a reliably-timed pulse. Even if
one bit is less than a microsecond off, that could mean the difference between purple and maroon.
LilyPad Pixel