Introduction: Getting Started With NeoPixel / WS2812 RGB LED
In this Instructable, we will explore about the addressable RGB LED (WS2812 ) or popularly known as Adafruit NeoPixel. NeoPixel is a family of rings, strips, boards & sticks of pulsing, colourful miniature LEDs. These are chainable from one to the next so you can power and program a long line of NeoPixels together to form an endless string of LEDs. You can use these LED strips to add complex lighting effects to any of your project.
You can find all of my projects on : https://www.opengreenenergy.com/
They comes with tiny 5050 ( 5mm x 5mm ) surface-mount package which includes three bright LEDs (Red, Green, and Blue) and a integrated driver chip (WS2811). It requires only one data input to control the state, brightness, and colour of all the three LEDs. By connecting the data output pin to the data input pin of the next strips, it is possible to daisy chain the LEDs to theoretically arbitrary length.
With combinations of RGB values ( 0 - 255 ) you can reproduce just about any colour, so in a sense a controllable RGB LED is a universal LED.
Step 1: Parts and Tools Used
Step 2: Type of RGB LED Strip
There are 2 major types of RGB LED strip : Analog strip and Digital Strip
1. Analog strip :
All the LEDs in the strips are connected in parallel, so it acts like single huge tri-color LED.You can sets a particular colour to the entire strips / strings.They are very easy to use and inexpensive but the limitation in this type of LED strips is that you can't control the individual LED's colours.
On each of these strips you’ll see (from left to right) first the LED , followed by an SMD resistor.
2. Digital strip :
A digital strip is that you address each LED individually and work in a different way. They have a chip for each LED, to use the strip you have to send digitally coded data to the chips. Because of the extra complexity of the chip, they are more expensive.
Notice the arrows indicating Data direction.If you connect the strip in reverse direction it will not work.
Step 3: Types of Addressable RGB LED Strip
Addressable LED come with different model numbers like WS2801, WS2811, WS2812 or WS2812B. If you are new to this type of LED, you may confused among them.So lets identify them first . Basically WS2801 and WS2811 are the name of the IC which can control maximum 3 LEDs. However WS2812 is an improved version in which a WS2811 IC is integrated directly into a 5050 RGB LED package. The most recent model is WS2812B.
In this tutorial we will use the latest model WS2812B.
Image Source : Adafruit, Sparkfun, Polou
Step 4: WS2801 and WS2811 / WS2812 Pins
WS2801 model have 4 input pins ( Vcc,GND,Data,Clock ) whereas WS2811 and WS2812 model have only 3 pins
( Vcc,GND and Data )
PIN ---> WS2801
5V -> Power (+5V)
CI ->Clock signal Input
CO -> Clock signal Output
DI -> Data Input
DO -> Data Output
GND -> Ground
PIN --> WS2812
5V -> Power (+5V)
CI -> N/A
CO - >N/A
DI ->Data Input
DO ->Data Output
GND -> Ground
Step 5: Power Supply
Before you start any LED strip project, the first thing you will need to think about is Power Supply.One of these RGB LED contains 3 LEDs ( Red,Blue and Green ). We know a single LED draw approximately 20mA current at its highest brightness.So a single WS2812 LED can draw 3 x 20mA = 60mA at maximum brightness - white.
Can I run directly by Arduino ?
The answer is simply NO. As the amount of current required for the entire strip will be way more than your Arduino can handle.
You need a separate regulated power supply for it.The power supply must provide the correct voltage, and able to supply sufficient current. In most of the WS2812 strips, the operating voltage is 5 volts DC.
Example : For WS2812 8 x 8 matrix ( 64 LEDs ) you need 64 x 60mA = 3840 mA ( 3.84 A ) at all the LEDs set to its maximum brightness ( White Colour ). But its not advisable , keep the brightness lower to get maximum life.
I can recommend to set the brightness below 50 %. So you need 3.84 x 0.5 = 1.92A
So by taking some margin the recommended power supply is 5V / 2A .
Step 6: Preparing the Power Supply
It is very easy to control WS2812B LED strip without extra circuitry and discrete components. If you have an Arduino , 5V power supply and few jumper wires then you can play with it.
Preparing The Power Supply :
I used a 5V/2A regulated power supply for running the NeoPixel LEDs.
We need two GND connection : one to the LED strip and other to the Arduino.
So I soldered two wires to the negative terminal and one wire to the positive terminal of the DC jack.
Arduino Connection :
The Arduino Connection is very easy.
LED Strip DIN -> Arduino D6
Power Supply GND -> Arduino GND
If you are using the external power supply to powering both the LED strip and Arduino, then you must connect the 5V supply to the Arduino 5V pin.
Good Practices as per Adafruit :
1. Adding a large capacitor (1000 µF, 6.3V or higher) across the + and – terminals. This prevents the initial onrush of current from damaging the pixels.
2. Adding a 300 to 500 Ohm resistor between your microcontroller's data pin and the data input on the first NeoPixel can help prevent voltage spikes that might otherwise damage your first pixel. Please add one between your micro and NeoPixels.
3. When connecting NeoPixels to any live power source or microcontroller, ALWAYS CONNECT GROUND (–) BEFORE ANYTHING ELSE. Conversely, disconnect ground last when separating.
Step 7: Driving a 8x8 Neo Matrix
The LED matrix contains 64 RGB LEDs which use the WS8211 driver. Each pixel is individually addressable and you will require only one Arduino pin to control all the LEDs.
In the back side of the matrix there are two ports : Input ( 3pins ) and Output ( 3pins ).
The input port is connected to the Arduino and 5V external Power supply.The connection is follows
Matrix --> Arduino
DIN --> D6
GND --> GND
Matrix --> Power Supply
5V---> 5V
GND-->GND
Note : You shouldn't forget to connect the GND of both the power supply and Arduino.
Now power up the circuit and upload the code to watch few animations. I have set the brightness of the LEDs to about 30%.
Arduino Code :
The code and libraries are attached in the zip file.Download it.You can watch the video to know how to use the Software.
Attachments
Step 8: Driving a Flexible 8X32 WS2812 RGB MATRIX
The 8x32 Flexible matrix is pretty cool.I ordered it from Sparkfun. You can create animations, games, or even incorporate them into a fun e-textiles project. On top of all that, thanks to its flexible backing, this LED Matrix can be bent and bowed to fit onto almost any curvy surface.
The connection with arduino is similar to the other NeoPixel LED matrix / Strip.
The Matrix come with terminal wires, so no need to solder.
Yellow : GND
Red : +5V
Green : Data
If you enjoyed this article, don’t forget to pass it along!
Follow me for more DIY projects and ideas. Thank you !!!

Participated in the
Rainbow Contest 2016
26 Comments
4 years ago
HI! I built a 10x10 matrix using the adafruit matrix sample script and it scrolls "Howdy" 3 times in different colors, as expected.
But if I change the text (I just typed 1234567890) it stops half the 8th letter and restarts with the 1st in the next color.
Whats the problem?
Reply 1 year ago
I had that same problem. There is a value that I have discovered that controls how many words are displayed. You can play with it to figure it out.
Question 1 year ago on Step 8
Hi, I would like to use the 8x8 matrix to display non scrooling number, say: 0 to 9
Any examples on that?
Thanks
Question 2 years ago
Bonjour
J'ai 2 matrice rvb 32x8 WS2812 flexible que je voudrais mettre en série. J'arrive à les piloter séparement. Mais une fois les 2 connectées, je n'arrive pas à les faire fonctionner. Juste pour afficher Hello sur les deux ensemble. Merci de m'aider.
2 years ago
Very nice tutorial.
3 years ago
Will this work with an Arduino nano?
4 years ago
https://makerfab.blogspot.com/2018/09/w-hy-ws2812sk6812-failures-after-smt.html
REPLY
Question 5 years ago
I want to ask
Which Package of ws2811 is used inside of strip LED which is soo small in size
can we get that IC only?
instead of LED package
Because SMD ws2811 is 6mm in width and here that total package is 5mmx5mm so package in this LED strip pixel should be too small
Thank you in advance
5 years ago
Greetings friend!
I have 5 meters RGB LED strip WS2812 and would like to make a strip of this 8X32; How do I make the connections? Is it the end of one at the beginning of the other, as in zig-zag? Thank you
6 years ago
Is there any interface to input directly images, texts or something like?
6 years ago
fantastic.
is it able to make matrix from strips?
6 years ago
Does anyone have a timing diagram of the signals required? (Otherwise, I am forced to reverse engineer it from the code.) I assume that the signals are of high frequency (in the millions of bits per second), as these ICs demand at least 24 bits per pixel per update. How is this high-speed data stream gotten from the Arduino, which only has a 16MHz clock? Are the core routines written in assembly, or is there some sort of peripheral processing?
Regarding the comments about noise concern, keep one thing in mind. Each IC in the chain re-processes and cleans up the signal before sending it to the next IC. So there can be a lot of ground noise in the system, as long as it is not concentrated between 2 adjacently-connected LED ICs. So I would avoid breaking up the power buss as explained in some of the comments. For long busses, put feeders every so often, but do not break up the continuous power rail. Yes, there will be ground loops, but this noise will be distributed, and will not disrupt the signal.
Reply 6 years ago
Hi, I've been using these for a couple of months and went crazy trying to make them work with C AVR code without using the libraries.
This guy helped a lot https://wp.josh.com/2014/05/13/ws2812-neopixels-ar...
The signal is less than 1.3us per bit with a 16MHz crystal you'll be fine.
6 years ago
Is there a version of these strips that is powered by 12 volt? So you have less voltage drop on the power lines and better efficiency?
Reply 6 years ago
No because the 12vdc leds have three leds in series , however, with these addressable leds, it is normal to connect power at different points along the line. I usually connect pos and neg wires at every metre to combat voltage drop.
Reply 6 years ago
When you inject power along the line you can cause electrical noise and circulating current loops. To prevent this cut / isolate the power of each sections so their only getting power from one point.
Reply 6 years ago
That heavily depends on your power supply design and EMI suppression measures. Even the way your wiring is done makes a huge difference if you wish to bring up that argument. And in either case you don't want 12V for these things or you're going to burn up a lot of extra heat in the driver unless you manage to increase the forward voltage of the LED's junction.
Reply 6 years ago
Oops, I should have mentioned that
Reply 6 years ago
Thanks for the tips!
Reply 6 years ago
There are 12V pixels available, like these on Amazon, but they are usually the big plastic-domed ones and not the strips or matrices that are (quite nicely) described here. All the strips that I can recall seeing are 5V so if you have a long run, adding a separate 5V and ground line of heavier gauge wire and injecting power every meter or so is a good idea. The thin PCB traces on the cheaper strips have too much resistance for long runs. There are strips (much more expensive) designed for professional stage or entertainment venue use that have much heavier +5/gnd traces.