WS2812b PWM led devices - AEtHeLsYn/hyperion GitHub Wiki

The "ws2812b" driver only works for the Raspberry Pi 1 (A and B model).

The newly merged "ws281x" driver works for Raspberry Pi 1,2 and 3

Configuration

You can use the special driver for Ws2812b to run compatible leds. Config Tool is available: HyperCon The device-config for the original led device should look like this:

"device" :
{
	"name"       : "MyPi",
	"type"       : "ws2812b",
	"colorOrder" : "rgb"
},

The device-config for the NEW led device that support RPi 1,2,3 should look like this:

"device" :
{
	"name"       : "MyPi",
	"type"       : "ws281x",
	"colorOrder" : "grb",
	"leds"       : 107
},

Additional device parameters

In addition to "colorOrder" and "leds", the "ws281x" device has the following parameters (listed here with their defaults):

	"gpio"       : 18,
	"dmanum"     : 5,
	"freq"       : 800000,
	"pwmchannel" : 0,

The RPi 2 and 3 both have three pins capable of PWM, BCM 18 (default, channel 0), BCM 12 (channel 0) and BCM 13 (channel 1). All three pins have been verified to work with WS2812B LEDs and with the ws281x driver. However, both PWM channels are used by the Pi's on-board analog audio, so you have the problem outlined below no matter which pin you choose.

Hardware setup

Raspberry Pi 2 40 Pin Connection to ws2812b WS2812B.png

Connect the data line of the leds to the pin 12 (GPIO 18) of your raspberry pi, most people put a resistor (R* in the graphic) (100-300 Ohm) between the leds and the pi for less ringing.

This simple wiring isn't guaranteed to work for everyone. The ws2812b specifications state that the logic "high" signal needs to be > 0.7*VCC which is 3.5v. The Pi's GPIO pins will only output 3.3v so this will be close enough for some users, but is not guaranteed. To do it properly, you should use a level shifter on the data line or drop the LED strip's VCC to 4.7V.

Known problems

These drivers uses the same hardware (PWM channels) as the analog audio out of the RPi, they can not work at the same time since the share the same output data line! If you don't direct the audio to the HDMI port or otherwise disable the analog audio, you'll get random nonsense on your LEDs.

If you want to use a ws2812 without tying up a USB port you may want to consider a SPI to ws2812 converter. Arduino (atmega328) sketch here: https://github.com/penfold42/stuff/blob/master/WS2801_to_2812_josh.ino

More information

All RPi pin configurations, depending on your version: Link

Pin Configuration of the RPi / RPi2 40 pin header with nice printout: 40 pin 'Hat'.

More info