Get to Know WS2812b

Get to Know WS2812b

WS2812b is the 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 a colorful display. The biggest characteristic of WS2812b is that it can realize cascade connections. With an IO port only, you can control the color of all LED beads. Today, I am going to talk about the reason why WS2812b has this amazing function.  

 

Hardware  

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

ws2812b

Here is the pin definition:  

ws2812b

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

ws2812b

With this cascade connection, we can make light strips, light rings, or even matrix screens. If you want to buy a WS2812b light strip.  

 

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 shown in the following picture.  

ws2812b

ws2812b

In a low voltage level of reset impulse(maintain at least 50us), all color data send out one by one from the controller with a 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.  

ws2812b

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

ws2812b

Note: D1 stands for data coming from MCU. D2, D3, and 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 dispatching books in class. The teacher is the source of the signal (i.e. IO port of the 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 beads on the LED light strip.

 

Things we have to pay attention to:

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 libraries. With this library, we can drive LED light strips quickly. If you want to know how to use NeoPixel to control LED strips, 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???/span>18.5*3). If the quantity of LED beads is in a cascade connection, then we have to connect an outer power source, or it will lead to an abnormal color display. Elecfreaks' WS2812b

 

Relative Readings:

Light the First Bead on 8*8 Rainbow Matrix with Arduino