WS2812 Breakout Hookup Guide

Pages
Contributors: jimblom
Favorited Favorite 10

Introduction

The addressable WS2812 and WS2812B are unassuming RGB LEDs with an integrated control circuit hidden underneath. We love the simplicity of this little IC/LED combo. It's at the heart of a number of products.

SMD LED - RGB WS2812B (Strip of 50)

COM-16346
1
SMD LED - RGB WS2812B (Whole Reel)

SMD LED - RGB WS2812B (Whole Reel)

COM-16347
$399.95

To name a few, the WS2812B is included in the simple WS2812B Breakout Board.

SparkFun RGB LED Breakout - WS2812B

SparkFun RGB LED Breakout - WS2812B

BOB-13282
$4.50
2

Sewable LEDs

The LilyPad Pixel shares the same circuit as the breakout board, but it comes on a circular, purple LilyPad board. These are perfect for sewing onto clothing or other fabric, and embedding into an e-textiles project.

LilyPad Pixel Board

DEV-13264
Retired

LED Strips

The WS2812B serves as the heart and soul of a variety of LED strips. These strips come in sealed and unsealed: 5 meter sealed, 1m sealed, 5m bare, and 1m bare.

LED RGB Strip - Addressable, Bare (1m)

COM-12025
7 Retired

LED RGB Strip - Addressable, Bare (5m)

COM-12026
2 Retired

LED RGB Strip - Addressable, Sealed (1m)

COM-12027
8 Retired

LED RGB Strip - Addressable, Sealed (5m)

COM-12028
1 Retired

Looking for smaller, higher density strips, or ones that emit on the side of the strip? The WS2812B's can also be manufactured in smaller packages such as the ones listed below.

Skinny LED RGB Strip - Addressable, 1m, 60LEDs (SK6812)

COM-14730
Retired

Skinny Side-Lit LED RGB Strip - Addressable, 1m, 60LEDs (SK6812)

COM-14731
2 Retired

Skinny LED RGB Strip - Addressable, 1m, 144LEDs (SK6812)

COM-14732
3 Retired

Fairy Lights

Fairy lights connect each individual LED with strands of wire. These are more flexible compared to the flexible PCBs that are used in LED strips. These can bend easier and are great for wearable projects if you need to connect a lot of addressable LEDs. Just sew the wire against your fabric to hold down the fairy lights. These are easy to wrap around an object for decor or prop.

Fairy Lights - Addressable RGB (5m)

Fairy Lights - Addressable RGB (5m)

PRT-16792
$21.50
8

Matrices, Rings, and Stick

Depending on the project, they can also be populated on PCBs as a matrix, ring, or stick. These can be useful for marquees or adding unique animations to your project!

NeoPixel Stick - 8 x WS2812 5050 RGB LED

COM-12661
5 Retired

NeoPixel NeoMatrix 8x8 - 64 RGB LED

COM-12662
Retired

NeoPixel Ring - 16 x WS2812 5050 RGB LED

COM-12664
3 Retired

NeoPixel Ring - 24 x WS2812 5050 RGB LED

COM-12665
Retired

Flexible LED Matrix - WS2812B (8x32 Pixel)

COM-13304
6 Retired

Pimoroni Unicorn HAT

DEV-14037
1 Retired

Warm White, Cool White, and Amber

Looking for a more natural white instead of mixing RGB? There are also WS2812's that have warm white, cool white, and amber color. Add ambient or task lighting to your projects with the tri-color strips.!

White Tri-Color LED Strip - Addressable, Sealed (1m)

COM-13898
2 Retired

Through-Hole Packages

Lastly, if you require WS2812B LEDs in through-hole form, they are also available as a through-hole package. The size of the bulb can either be 8mm or 5mm. The LEDs can be diffused or clear depending on how they were manufactured: Diffused 8mm (5 Pack), Diffused 5mm (5 Pack), and Clear 5mm (5 Pack).

LED - RGB Addressable, PTH, 5mm Diffused (5 Pack)

LED - RGB Addressable, PTH, 5mm Diffused (5 Pack)

COM-12986
$3.50
8
LED - RGB Addressable, PTH, 5mm Clear (5 Pack)

LED - RGB Addressable, PTH, 5mm Clear (5 Pack)

COM-12999
$3.50
3
LED - RGB Addressable, PTH, 8mm Diffused (5 Pack)

LED - RGB Addressable, PTH, 8mm Diffused (5 Pack)

COM-12877
$3.50
4

What makes the WS2812B really special is the way its controlled. The IC embedded into the LED communicates via a very unique one-wire interface. With the help of some libraries, they're really very easy to control. Plus they're chain-able -- the output of one LED can be connected to the input of another to create strips of hundreds of LEDs. The more boards you have linked together, the fancier your animations can be!

In this tutorial we're going to get you familiar with the workings of the WS2812 and WS2812B. We'll go over some of the ways you might want to hook up to the breakout board, LilyPad, or strips. And we'll close the tutorial out with some example Arduino code.

Required Materials

WS2812-Based LED Board or Strip

Stating the obvious: you'll need a WS2812-based board or strip. The more the merrier! In the example hookup, we'll be linking together five breakout boards, but the example should be adaptable to the other WS2812-based products. Grab however many you think you'll need for your project, regardless of how many you have, it's not enough.

Microcontroller

Aside from the star of the show, you'll also need a microcontroller. Something that can send the series of 1's and 0's used to control the LEDs. Our go-to is the classic Arduino Uno, but any Arduino board should do.

Arduino Pro Mini 328 - 5V/16MHz

Arduino Pro Mini 328 - 5V/16MHz

DEV-11113
$10.95
140
Pro Micro - 5V/16MHz

Pro Micro - 5V/16MHz

DEV-12640
$19.50
82
Arduino Mega 2560 R3

Arduino Mega 2560 R3

DEV-11061
$48.40
60
Arduino Uno - R3 SMD

Arduino Uno - R3 SMD

DEV-11224
$26.30
26

Or you can try to adapt the example code to your favorite microcontroller. Teensy development boards are an excellent choice when using a large number of WS2812 LEDs.

Teensy LC

DEV-13305
17 Retired

Teensy 3.5

DEV-14055
8 Retired

Teensy 3.6

DEV-14057
15 Retired

Wires

You'll also need some way to connect between the board and an Arduino. You could use a combination of male headers and breadboard (solderless or solderable). Or you could just go with a few pieces of hookup wire or 3-pin JST-SM pigtail connectors.

SparkFun Solder-able Breadboard

SparkFun Solder-able Breadboard

PRT-12070
$5.50
20
LED Strip Pigtail Connector (3-pin)

LED Strip Pigtail Connector (3-pin)

CAB-14575
$1.50
Break Away Headers - Straight

Break Away Headers - Straight

PRT-00116
$1.75
20
Breadboard - Translucent Self-Adhesive (Red)

Breadboard - Translucent Self-Adhesive (Red)

PRT-11317
$5.50
1

Tools

In order to get a good, solid, electrically-sound connection to the breakout boards, you'll need to solder to the pins. That means you'll need at least a basic soldering iron, solder, and general soldering accessories. Check out our how to solder tutorial for help, if this is you first time soldering.

Solder Lead Free - 100-gram Spool

Solder Lead Free - 100-gram Spool

TOL-09325
$9.95
8
Soldering Iron - 30W (US, 110V)

Soldering Iron - 30W (US, 110V)

TOL-09507
$10.95
7

Suggested Reading

These boards aren't too hard to use. If you've done anything with Arduino before, you'll be prepared to work with the WS2812. If you're not exactly sure what this "Arduino" thing is, or if you're not familiar with the topics below, consider reading their tutorials:

How to Solder: Through-Hole Soldering

This tutorial covers everything you need to know about through-hole soldering.

Binary

Binary is the numeral system of electronics and programming...so it must be important to learn. But, what is binary? How does it translate to other numeral systems like decimal?

How to Power a Project

A tutorial to help figure out the power requirements of your project.

How to Use a Breadboard

Welcome to the wonderful world of breadboards. Here we will learn what a breadboard is and how to use one to build your very first circuit.

What is an Arduino?

What is this 'Arduino' thing anyway? This tutorials dives into what an Arduino is and along with Arduino projects and widgets.