Introduction: Get to Know WS2812b

About: ElecFreaks is an open design house founded in March 2011. Our goal is to create rapid prototypes and give small-batch manufacture solution for makers and startups. With over 50% staff as engineers and expanded…

WS2812b is a kind of LED bead that I like most. It does not like common LED that needs IO control to every LED bead, nor like RGB LED that needs three pins to realize colorful display. The biggest characteristic of WS2812b is that it can realize cascade connection. With an IO port only, you can control the color of all LED bead. Today, I am going to talk about the reason why WS2812b has this amazing function.

Step 1: Instruction

WS2812b is a kind of LED bead that I like most. It does not like common LED that needs IO control to every LED bead, nor like RGB LED that needs three pins to realize colorful display. The biggest characteristic of WS2812b is that it can realize cascade connection. With an IO port only, you can control the color of all LED bead. Today, I am going to talk about the reason why WS2812b has this amazing function.

Step 2: Hardware

WS2812b is an intelligent external control LED source, which has integrated control circuit and light-emitting circuit. It has same appearance with 5050 bead and every component is a pixel. Picture below is for single LED bead. It has four pins.

Here is the pin definition:

The following diagram is for the typical circuit application of WS2812b cascade connection:

With this cascade connection, we can make light strips, light rings, or even matrix screens.

If you want to buy ws2812b light strip, just click here.

Step 3: Data Transmission

With a signal cable only, we can control LED light strip. On the cable, there are three signals: logic 0, logic 1 and RET code. And their corresponding temporal waveforms are showed in the following picture.

In a low voltage level of reset impulse(maintain at least 50us), all color data send out one by one from controller with 24-bit binary number. Among the 24-bit numbers, every color has 8-bit (i.e. 256 grade brightness). According to the sequence, it is green, red, and blue separately.

Every transmission of single bead data, WS2812b chip will transmit all data except its own color data to the next LED bead. Here's the schematic diagram:

Note: D1 stands for data come from MCU. D2, D3, D4 stand for cascade circuit auto-transformed forwarding data.

If you still feel very complicated, you can try to understand it in this way: Imagine the situation of a teacher dispatches books in class. The teacher is the source of signal (i.e. IO port of controller) and every student is a single bead. The teacher gives a stack of books to the first student. After the first student gets his book, he will hand over the rest books to the second student behind him. After the second student gets his book, he will pass on the rest books to the third student. Then the rest students repeat this movement until all student get their books.

Based on this principle, we can use an IO port to transmit the color data of all LED bead on the LED light strip.

Things we have to pay attention:

These working principles are helpful for you to understand how WS2812b works. However, in practical usage, it is not that complex. Because Arduino and Micro:bit have NeoPixel library. With this library, we can drive LED light strip quickly. If you want to know how to use NeoPixel to control LED strip, you can read our relative blogs. The channel current of every LED bead color is about 18.5mA, and the current of a single bead is about 55.5mA(18.5*3). If the quantity of LED bead in cascade connection, then we have to connect an outer power source, or it will lead to abnormal color display.

Step 4: Elecfreaks' WS2812b Product Recommends: