When we're working with LEDs, we often like to control their state (on/off), brightness, and color. There are many, many different ways of going about this, but none are as compact a solution as the WS2812 RGB LED. In its tiny 5mm x 5mm package, the WS2812 includes 3 super bright LEDs (Red, Green, and Blue) and a compact driver circuit (WS2811) that only requires one data input to control the state, brightness, and color of the 3 LEDs.
At the expense of needing only one data line to control 3 LEDs, there comes a demand for highly precise timing in the communication with the WS2811. For this reason, a real-time microcontroller (e.g., AVR, Arduino, PIC) is required. Sadly, a Linux-based microcomputer or an interpreted microcontroller such as the Netduino or Basic Stamp cannot provide the sufficient timing accuracy that is needed. And so, in this Instructable I walk through the process of setting up, and controlling one of these LEDs with an Arduino Uno. Then, I show how easy it is to connect several of them together for an awesome lighting display!
Difficulty level: Beginner
Time to completion: 10-15 Minutes
This wonderful RGB LED comes in a 5050 (5mm x 5mm) package with 6 pads that are fairly easy to solder onto a breakout board. As the only additional component needed is a de-coupling capacitor, the WS2812 honestly offers the best solution for controlling color and brightness of an RGB LED. The embedded constant-current LED driver (WS2811) is remarkably useful for two reasons:
- A constant current of ~18mA will drive each LED even if the voltage varies.
- There is no need to add current-limiting resistors (a.k.a choke resistors) between the power supply and the LEDs.
All we need is a very simple design to provide Power, Ground, and 1 Control Input in order to create an awesome lighting display consisting of not one, but a whole array of RGB LEDs. That's right! By connecting the Data Out pin of one of these LEDs, to the Data In pin of another, we can drive them both independently with the same Control Input! If it's not obvious how to do this, do not be troubled, by the end of this Instructable you'll be well on your way to adding WS2812 to any project you want!
For this Instructable here's a what we'll be using:
3 x WS2812 RGB LEDs (pre-soldered onto a tiny breakout board)
1 x Solderless Breadboard
Solid Core Wire (assorted colors; 28 AWG)
1 x Arduino Uno R3
1 x Break-away Pin Connector, 0.1" Pitch, 8-Pin Male (Right-Angle)
1 x Pin Connector, 0.1" Pitch, 8-Pin Female (Right-Angle)
1 x Breakaway Pin Connector, 0.1" Pitch, 8-Pin Male
USB A/B Cable
Depending on your project, the WS2812 RGB LEDs are also available without a breakout board for about $0.40 each, but the convenience of the pre-soldered option is attractive for simple applications.