loading
Picture of Upgrading Smart RGB LEDs: WS2812B vs. WS2812
ai_ws2812_iso2.jpg
ai_ws2812_iso1.jpg
ai_led00008_iso2.jpg
ai_led00008_iso1.jpg

The sheer number of projects we've seen making use of Smart RGB LEDs—whether it be strips, modules, or custom PCBs—over the past 3 years is quite astonishing.  This outbreak of RGB LED usage has gone hand-in-hand with a significant drop in pricing and an increased ease of use of these electronic devices.  

Amongst LED manufacturers, WorldSemi has seemingly become the de facto standard amongst DIYers, hobbyists, and wearable electronics designers.  The company's WS28XX family of Smart RGB LEDs includes an easy-to-use control protocol, a convenient pinout and footprint, and an incredibly bright luminescence, all within a tiny 5mm x 5mm package.   But, what really has made a difference in the products' DIY market success is the $0.30 to $0.40 unit pricing in small quantities.

In the latest version of these LEDs, the WS2812B, WorldSemi yet again has made significant improvements upon its predecessor, the WS2812.  Since there is very little information out there about this relatively new version, we decided to make a short Instructable to highlight the design upgrades, and advertise some of the already existing features of this nifty device!

Difficulty level: Beginner+ (some familiarity with smart RGB LEDs)
Time to completion: 5-10 Minutes


 
Remove these adsRemove these ads by Signing Up

Step 1: List of Materials

Picture of List of Materials
DSC_0560.jpg
To highlight the features of both the WS2812B and the WS2812 RGB LEDs, we can make use of the following parts:
1 x WS2812 RGB LED (pre-soldered onto a tiny breakout board)
1 x Solderless Breadboard
1 x Breakaway Pin Connector, 0.1" Pitch, 8-Pin Male
1 x Arduino Uno R3
1 x WS2812B Lumina Shield for Arduino
Solid Core Wire (assorted colors; 28 AWG) and Wire Strippers
Power Supply (Optional)

Both the WS2812 and WS2812B carry an embedded constant-current LED driver, as well as 3 individually controlled LEDs; one red, one green, and one blue.  The LED driver comprises:
- An internal oscillator
- A signal reshaping and amplification circuit
- A data latch
- A 3-channel, programmable constant current output drive
- 2 digital ports (serial output/input)

Note: the LED driver itself is also available in a 6-pin Integrated Circuit (IC) form, which we can use to connect directly to 'non-smart' RGB LEDs of our choice; the IC in question is non other than the WS2811.

Step 2: WS2812B VS. WS2812: 4-pin Footprint (✓)

Picture of WS2812B VS. WS2812: 4-pin Footprint (✓)
test2.png
Screen Shot 2014-01-20 at 2.29.27 PM.png
ws2812_ws2812b_pinout-01.png
The most evident new feature of the WS2812B is a reduced number of pins (from 6 to 4), which preserve a nice size for easily soldering them (using a fine-tip soldering iron) to ~2mm x 1mm pads on a PCB.  The 6 pads of the older WS2812 made it a bit difficult to route the DO pin of one module to the DI pin of the next when spacing between the modules was tight.  With the WS2812B, routing the traces on a PCB is a breeze, particularly when designing arrayed configurations as the Arduino Shield shown in this step's images.  

The additional space between the WS2812B pads allows for:
  • Easily routing the 3 necessary signals: Power, Ground, and Data.
  • Using thicker traces to connect Power and Ground, which allows for higher currents to run safely on a PCB
We can see in the images above how easy it becomes to route a 5x8 array for the Lumina Shield for Arduino using these new LEDs—for comparison, we include an old design of a 16x16 array using WS2812s.  The design files for the Lumina Shield can be found on this Github repository.

One important thing to note is that, for reasons we cannot fathom, the layout for the WS2812B has a little notch on the corner of the package indicating pin 3 rather than pin 1!  We need to pay extra attention when soldering these by hand, so that we don't orient the module as we would with typical ICs (or the WS2812, for that matter).

Pin # Symbol Function
*Notch on package indicates this pin.
1 VDD Power supply LED
2 DO Control data signal output
3* VSS Ground
4 DIN Control data signal input

Another detail worth mentioning is that the Power (VDD) and Ground (VSS) pins are diagonally across one another.  Thus, the traces connecting to these pins can be quite thick!  However, if we make the mistake of soldering the module 'backwards', we would short Power and Ground (pin # 1 and 3).  Lucky for us, as we'll see in the next step, WorldSemi has included a reverse polarity protection circuit that will prevent the WS2812B from being damaged by this error—we, of course, recommend avoiding the mistake altogether :)

Step 3: WS2812B VS. WS2812: Brighter LEDS & Improved Color Uniformity (?)

Picture of WS2812B VS. WS2812: Brighter LEDS & Improved Color Uniformity (?)
When the WS2812B was released, WorldSemi emphasized that it had brighter LEDs and better color uniformity than the WS2812.  (Source: WS2812B_vs_WS2812.pdf)

However, inspecting the actual datasheets of the two devices, we can observe that the specifications for the luminance of the LEDs are identical in both:

Color Wavelength (mm) Luminous Intensity (mcd)
Red 620–630 620–630
Green 515–530 1100–1400
Blue 465–475 200–400

The image above shows an Arduino Uno connected to four breakout boards.  Two of them carrying a WS2812B while the other two have a WS2812.  We tried using standard imaging measurements to determine whether or not we could see significant differences in brightness or color uniformity, but the results were inconclusive.  In order to unambiguously determine whether the two modules differ in this respect, we would have to perform some tests using an spectrophotometer.  Given that we didn't have one available at the time of this writing, we can only refer to the info on the products' respective datasheets: WS2812.pdf and WS2812B.pdf

Step 4: WS2812B vs. WS2812: Reverse Polarity Protection Circuit (✓)

Picture of WS2812B vs. WS2812: Reverse Polarity Protection Circuit (✓)
One of the new features that we were able to test in a straight-forward way was the reverse polarity protection circuitry included in the design of the WS2812B.  As the video shows, reversing the Power and Ground pins can sometimes damage the WS2812, but not the WS2812B module.  This feature is very useful when working with strips where we typically use external power supplies with high amperage ratings, and where we've seen most mistakes being made during wiring.


We still recommend double-checking the connections and wiring before applying power to any electronic circuit, but admittedly it's nice to know that in those rare occasions where we make a mistake there is a failsafe mechanism in place to protect our precious devices.

Step 5: WS2812B VS. WS2812: Internal Structure Improved (?)

Picture of WS2812B VS. WS2812: Internal Structure Improved (?)
The last feature that was included in the WS812B is a separation of the two main circuits in the device: control and lighting.  By separating these two, the manufacturer reports an improved heat dissipation and more robust control.  This is by far the more obscure of the new features, as we do not have a good method for testing heat dissipation on a PCB.

For the improved robustness in the communication and data transfer, we didn't find any significant performance differences between the WS2812 and the WS2812B after a few simple tests we ran with the two modules side-by-side.




Step 6: Programming the WS2812B RGB LEDs

Picture of Programming the WS2812B RGB LEDs
Despite all the changes introduced in this latest version of the WS28XX family, the communication protocol needed to control its color and brightness remains unchanged from its predecessor.  We can still use the great libraries developed by fellow makers from Adafruit, PJRC, and the FastSPI project.

For learning more about what really goes on under the hood of this wonderful RGB LED devices, we put together a thoroughly detailed Instructable explaining the implementation of the control protocol bit by bit (pun intended).  Thanks in advance for checking it out!

http://www.instructables.com/id/Bitbanging-step-by-step-Arduino-control-of-WS2811-
5215201 month ago

I would like to know why the program can be used to control the WS2812 after this WS2812B connected WS2812B do so

acrobotic (author)  5215201 month ago
Thanks for clarifying! The WS2812 uses a slightly different timing for communicating. We have a very detailed tutorial over here: http://www.instructables.com/id/Bitbanging-step-by-step-Arduino-control-of-WS2811-/

The best way to see the differences is by inspecting the datasheets as well:
http://acrobotic.com/datasheets/WS2812.pdf
http://acrobotic.com/datasheets/WS2812B.pdf

The code in the Bitbanging Instructable should work for both WS2812 and W2812B.
acrobotic (author)  5215201 month ago
Sorry, can you rephrase the question so I can understand it better and see if I can help?! Thanks.

Many thanks for your answer, I have to question is

Separate control program to control a WS2812's WS2812B, but WS2812B does not shine, this is why. ws2812 work,

cburg6 months ago

Thank You for this information. It will be very helpful for some projects iI am working on. One question.

You talked about the WS2811 chip. Do you have a source for this chip in the 8-pin dip package? I know WorldSemi make it but I can not find a place to buy it.

Thanks again!

MassimoO cburg3 months ago

These are 8pin SOPs, but they are already on a solderable board if you don't like working at SOP scale:

http://www.aliexpress.com/item/Fast-shipping-300pcs-15mm-WS2811-Circuit-Board-PCB-Square-Making-WS2811-LED-Pixel-Module-Light-5V/1644099518.html

Nobody on AliExpress shows up in a search for WS2811 IC DIP. Everyone selling WS2811 ICs is selling SOP format, so you could solder those onto a DIP8-SOP8 adapter board, but since you can get them already-soldered onto breakout boards, why bother?

marksmanaz11 months ago

I have had nothing but problems with the ws2812B LEDs that I bought in 5 meter strips. They are very sensitive. I use them as accent/motion lighting in a restaurant. When some equipment is turned on or if there is a slight surge the first LED in each string is blown and I have to solder a new one each time. What a pain. I had to remove all the florescent lighting in the building and replace them with LED because each time the balasits were turned on it would blow the first ws2812B in the string. Very sorry I installed they in the end I will lose a lot of money on this job because of these poor lights.

You ignored the recommendation to put a capacitor close to the first LED in the strip?

WorldSemi has clearly indicated recommendations for installation - that is one recommendation they try and emphasise. If you ignore it and blow your LED, that's not really the fault of the manufacturer.

acrobotic (author)  marksmanaz11 months ago

These are low (DC) voltage LEDs, so the power supplied to them does need to be 'clean'. Ideally, in most indoor lighting installations people use surge protection circuitry before connecting these LEDs. The strips just include LEDs, they do not carry additional circuitry to protect them from overvoltage---you need to add this yourself. If you do not have this option, at least add a 100uF 25V capacitor between power and ground, this will help with the transient changes in voltage!

How would I hook up the 100uF 25V capacitor in a setup with 5 LED strips where I have to run power to each LED strip in order to prevent color fading from voltage drop? Would I just hook it up between V+ and V- at the power supply and be done with it?

acrobotic (author)  Pseudonymd10 months ago

Yep, that's one option (between V+ and V-). If you want to be extra careful, you could connect 5 capacitors as close to the strips as possible (also between V+ and V-). Capacitance adds up in parallel, so you'd end up with a 500uF value, but this is ok. Depending on how 'clean' your power supply is, you may need to also connect additional capacitor values (also between V+ and V-). The point if to prevents the initial onrush of current from damaging the LEDs.

How clean do you think the power is from a LED power supply like this -

http://www.aliexpress.com/item/New-Waterproof-DC-5V-360W-72A-LED-Driver-Power-Supply-Adapter-Transformer-AC-110V-240V-Wholesale/1864726559.html

It has vague reference to "anti-interference function", and "meet CE & ROHS, GB4943.EN60950". By the way, it says it is constant voltage, but it is not. The voltage drops from 4.55V to 3.8V when full load is placed on it. And it 's supposed to be a 5V power supply...

Pseudonymd10 months ago

The diagram underneath step 2 showing the WS2812 vs WS2812B is incorrect. Though it correctly shows 4 pins vs 6 pins in the packaging, the internal layout of the LED pads and control chip (visible through the LED lens) shows the WS2812 layout in both cases, even on the WS2812B chip. This diagram needs to be updated to show the different visible layout of the WS2812B chip as seen through the chip's lens.

acrobotic (author)  Pseudonymd10 months ago

Good eye, we didn't have the time to create a new SVG. It's somewhere on our To-Do list :)

jdavid221 year ago

Hello, I'm using Fubarino Sd, but do not understand how to translate your code
Arduino to Fubarino Sd.
I could help with this?
http://fubarino.org/sd/index.html

acrobotic (author)  jdavid2210 months ago

Sorry, we typically don't work with PIC microcontrollers :-(

serhiyiv1 year ago

Hi. Could you tell me please is it possible to limit current used by WS2812B leds??? I found in a datasheet for WS2812 leds there is written - Current(mA) RED - 20, GREEN - 20, BLUE - 20. So if I set all the RGB to 255 the WS2812B will use 60mA? then how to limit it to 45mA???

acrobotic (author)  serhiyiv1 year ago
Thanks for the interest in our Instructable! You can use a current limiting resistor for that purpose. Each LED has a forward voltage of ~3V (check the datasheet). If you put a 40--50Ohm resistor between the power source and the VCC pins of the modules, you'd get a ~45mA current limit.

Remember that the more modules you have powered by the same supply, the more current that will pass through the resistor. Make sure that the wattage of the resistor is high enough for the *total* amount of current you'll be using.

Hi. Thank you for reply. I know adding a resistor works with simple LEDs but WS2812B has a built in IC, so I just wonder if the resistor won't interfere with the IC.????? Also, tell me please, as I've written above, if for example I set all the three (RGB) to half brightness (128, 128, 128), then will this WS2812B consume 30mA???? If so, then why the resistor????

acrobotic (author)  serhiyiv1 year ago

No problem, glad I can help.

The resistor won't interfere with the IC, as you're limiting the current supply only and not affecting the signal. The IC consumes little current, so it's negligible relative to the 20mA sourced to each LED.

The brightness scale isn't perfectly linear with current. Remember that a brightness of (1,1,1) will turn on the LEDs slightly, which means that current needs to be greater than the forward-current threshold (this value is on the datasheet). The best way to know how much current is needed for each intensity level, is to measure it. You can use your multimeter for this task!

I tried to measure the current used by one LED at full brightness (255, 255, 255) and my multimeter shower only 30 mA!!!! Also could you tell me please, in the datasheet I found the following:

"Also include a precision internal oscillator and a 12V voltage programmable constant current control part"

So it means that current usage can be programmed by 12V somehow, does not it?????

acrobotic (author)  serhiyiv10 months ago

Nah, this is a typo on the datasheet. It is a 5V controller. It's 'programmable' in the same way a shift register is. You set it using the specified protocol to output the levels you want on each LED.

Thank you for the very informative review. I shall order some of these beauties ASAP :-)