New Product — WS2812B LED Strip

 New Prod WS2812-Weatherproof-obl-400

 

WS2812 LEDs are particularly popular in microcontroller projects. It make a lot of sense. Your first project with a microcontroller is “Blink LED”, so it only makes sense to blink LEDs in a more interesting way!
 
This is why I am really excited about this particular product, our WS2812 LEDs with the WS2812 demo library!
 
WS2812 LEDs, also known as Rainbow Bits or NeoPixels, are available in many places. You will find many variations across the board, but they all operate basically the exact same way.  You can get these either as stand-alone chips in different lengths, densities, or combinations. For example, you can get them 72 pixels to a strip, 60 pixels, or 30 pixels. If you buy them from Adafruit you can get them in ring shapes, individual pixels, or even in huge arrays. No matter where you get them, they are all perfect companions with our chipKIT microcontrollers!

www.macetech.com uses WS2812 LEDs on shutter shades to do amazing patterns.
Macetech uses WS2812 LEDs on shutter shades to do amazing patterns.

The ones that we sell on our website were chosen to get you started.
 
These are a 1M long, waterproof, pre-wired strip of 30 LEDs!

 

How do I know I have a WS281x LED?

Because there are so many versions out there in the wild, you will need to be able to identify the LEDs, even if they are marked differently.

You can buy these either loose or put on a strip for use.
You can either buy these loose or put them on a strip for use.

Most of the time you will find these LEDs in strip form (attached to a flexible PCB). You can get these LED strips in black PCBs or white PCBs, with or without a waterproof coating.
 
Ours are white.
 

The flexible PCB comes in either white or black. Doesn't have any real difference when the LEDs are turned on, but if you are worried about what they look like when they are off, you may have a preference.
The flexible PCB comes in either white or black. Doesn’t make a real difference when the LEDs are turned on, but if you are worried about what they look like when they are off, you may have a preference.

There are two ways for the LEDs to be waterproofed — either with a plastic sleeve or an epoxy coating you scrape off. Ours have a plastic sheath over the strip.

The one of the right has a water proofing coating that you scrape away to connect. The one of the left is bare and is the type you will get from Digilent.
The one on the right has a water proofing coating that you scrape away to connect. The one of the left is bare and is the type you will get from Digilent.

These LEDs look similar to the RGB LEDs (used in the Basic I/O Shield product highlight), which you can also use a microcontroller to change to whatever color/ brightness/ intensity you wish. However, the entire strip changes together, as opposed to being able to have multiple colors on one strip (you can still achieve really neat effects this way, and oftentimes the RGB LEDs are a good deal cheaper than the WS281x ones). If you haven’t used the RGB strips before, I would recommend you to learn how to use those before moving to these LEDs.

 

How can I tell the difference?

 
You can tell the difference between these two types of LEDs in a few ways (just check that you bought the right ones!).
 
1. WS281x LEDs will have break off points between every LED versus the RBG LED strip has break off points at every three LEDs.

2. There are also three lines (power, data, ground) for the WS2812, whereas the RGB LED strip has four  (power, R, G, B, and ground)

the top strip is a RGB strip the bottom two are WS281x strips
The top strip is a RGB strip the bottom two are WS281x strips

3. If you get close to the actual LED pixel, you will see that there is a small square dot in the center of the WS281x LED and not in the RGB one. This little square dot is the semiconductor chip that is wire-bonded to the individual LED segments. It’s this chip that makes the LED addressable.

WS281x-difference-between-Analog

 
If you see a strip of LEDs where break off points are at every LED (instead of every three) and there are three input/ouput lines and looks to have a small chip in the center of the pixel… then you probably have a WS281x LED.

4. If you notice I keep using an x at the end of the WS281x… it’s because there is a possibility for a tiny variation. If you get a strip that the pixel has six leads off of it instead of four, you have the older version, the WS2811 or a WS2812A. Previously, these strips had an additional ground for every pixel, but since no one seemed to be using them, the manufacturer simplified it and made only 4 pins.

The strips from Digilent are on the left hand side (4 Pins) versus the right (6 Pins WS2811 version).
The strips from Digilent are on the left hand side (4 pins) versus the right (6 pins WS2811 version).

The strips you will buy from Digilent will be the WS2812B,  but all of the information and tutorials should work with any other WS281x strips as well.
 

What makes these LEDs work?

 
If you geek out on knowing how something works, then this section is for you. If you want just want to get to using the LEDs, skip ahead to the next section.
 
The best place to learn about these LEDs is to read the data sheet.

From the DataSheet- WS2812 internal circuitry
From the data sheet — WS2812 internal circuitry.

I got this particular data sheet from Sparkfun.com, and it seems to be the very best one. However, I have a tiny modification — the data sheet explains the 6-pin WS2812A LEDs, but all of the data is the same except the absence of VDD (power supply for the individual LED).
 
Some high level things from the data sheet I found important:
 
Each pixel is a small system . 
 
There are lots of functions crammed onto one chip. Inside of the SMD (surface mount) 5050 package are several things:

  • an internal oscillator for timing and changing states
  • a signal reshaping and amplification circuit to make sure the signal is passed to the next LED in the chain
  • a data latch — this holds the state of the particular LED
  • 3 channel programmable constant output drives (constant current) to control each of the LEDs (red, blue, and green)
  • 2 digital ports/serial in and serial out to receive and transmit information.

 
Color mixing and controlling brightness:
 
Like the RGB LEDs, each package contains three LEDs packed closely together. You can turn on each of these colors by selecting a value between 0 (off) to 255 (full on).  It’s the combination of these three LEDs (in relation to each other) that mixes color. It’s how high the value is that determines how brightly the LED shines.

Mixing RGB colors to make most of the colors in the spectrum.

Example: You can mix neon green by assigning the values of R= 57 , G= 255, B=20.
Red is about 22% of Green
Blue is about 8% of Green
 
So…
 
Now, you can make this mix a little less bright by making sure the same % of color is present.
Neon green (less bright): R= 29 , G=128, B=10
Neon green (minimally bright): R=14, G=63, B=5
 

To Mix Neon Green As long as the ratio of colors stays the same the color stays the same
As long as the ratio of colors stays the same, the color stays the same.

The human eye isn’t that discerning to know the difference between 1/2 brightness and 1/5 brightness, so this is useful when you need to think about power concerns.
 
Powering the LEDs: 
 
The LED strip requires a constant (steady) 5V power supply, which should easily be supplied by any USB device.
 
However, the current portion of the power requirement for these LEDs varies depending largely on the pattern the LED is running and how long each of the pixels is on.
 
A rotating pattern where each LED is on for only 250 milliseconds will consume less power than a fade pattern where every LED is on, but varies in intensity.  Full brightness– and WHITE (using all RGB at max values) — will consume 60mA per pixel (number of pixels in a string, 15 if you are using our strip which is about 1Amp current draw for all 15 pixels).  If you plan on powering the strip off of the chipKIT, you will need to keep an eye out for this current draw.

 

Communication protocol: 
 
To make each pixel addressable a very simple communication protocol that is dependent on timing is used.
Every pixel needs to have a R, G, and B value and then command (stay the same, change, shift, etc), and multiply the number of pixels.
Then, using pulses between HIGH and LOW these values are communicated. Very similar to morse code where the length of time between the High versus Low can communicate different things.
 

Transmitting a 1:
Time for the signal to remain high (T1H): 0.8μs
Time for the signal to remain low (T1L): 0.45μs

Transmitting a 0:
Time for the signal to remain high (T0H): 0.4μs
Time for the signal to remain low (T0L): 0.85μs
(a great detailed explanation from acrobatic speaks in greater detail).

 
This means that the timing of the data is very precise!
 
Running the LEDs on chipKIT:
 
The timing requirements for these LEDs is fairly resource intensive and many projects using these LEDs use an entire Arduino dedicated to managing the routines of the LED.
 
We had two chipKIT community members work on getting libraries written for these strips.
 
The first is a port Adafruit’s Neopixel Library by Marshall Wingerson. This works with the chipKIT Uno32 or UC32. This technique is known as “bit banging”, but Marshall covers the details in his Instructables post.

The second is a complete re-write that uses the DMA (direct memory access) of the PIC32 processor to queue up patterns in the SPI port. Since these LEDs need precise timing, a chipKIT that has a processor with fast enough SPI and the DMA peripheral is needed. Today, these kits are the WF32 and the Max32. It’s a much more advanced routine, but is wonderful if you want to use the chipKIT to run other resource intensive programs (rather than only the LEDs). You can get that library on my instructable post here.

 

A really excellent guide to these LEDs already exists, the Ultimate NeoPixel Guide by Phillip Burgess. I learned a great deal about how to work with these LEDs from that guide and I would encourage you to read it yourself.
 
Another really good guide comes from acrobatic on Instructables.com— he does a really good job of walking through the differences between the version of LEDs.
 

Examples of these LEDs in action!

 
We brought these LEDs with us to MakerFaire 2014 and showed them off with our WF32 server example. Combined with some LED mastery by Brian Thompson (a local LED enthusiast), we were able to really show off some fun routines.
 
And then there was also Norm’s LED Ghost for our Halloween Competition!

So go and check them out and make sure to share your projects or ideas on our Project Vault on the new Digilent Forum!

Be the 1st to vote.

About Larissa Swanland

I'm a bit of an electronics-education evangelist. After all, Education is how we learn about the world. Electronics make the world better. Engineers change the world. So more engineers that know how to design and create electronics? That's the kind of world I want to help create.

View all posts by Larissa Swanland →

One Comment on “New Product — WS2812B LED Strip”

Leave a Reply

Your email address will not be published. Required fields are marked *