Can someone help me to understand how the WS2812B acutally works? I guess, I understand the functioning of SPI itself, but the WS2812B only uses one data wire. How does one led know that it has to do something? I couldn’t find any useful information, but I am pretty confident you know more than I do 
When I thought about this topic, I was wondering if every LED has it’s own adress? But I realised it can’t work, since you can use more than 2^8 LEDs on a 8 bit microcontroller.
By the way, what is the maxmium number of LEDs that I can use in a row?
Hope to get some answers
Thanks
Hello, I would suggest that you look in this data sheet maybe that will answer most if not all your questions…
In theory there is no maximum number of LEDs that you can have in a row !!!
You could have 1 million of them one after the other if you had a 5V power supply capable of supplying all the required current (~60,000 Amps !!!)
Also you would need to have a microcontroller with more than 3 Mbytes of ram and it would only take 30 seconds to update the whole string !!!
In practice, PSU limits, ram on your microcontroller, the time it takes to update the string are all factors that will dictate the more practical maximum.
All the one wire controllers, which I call clockless are based on loosely precise timing.
I say loosely because it turns out that there’s one important bit of timing, and the rest can slide around.
The short version is, for the ws2812b , a single bit is 1.25us long. If the data line is high for 250ns then low for 1000ns, then it is a 0, and if the line is high for 450ns and low for 800ns then it is a 1. (The actual timing values may change, but that is the rough idea)
Hey @Daniel_Garcia Shouldn’t you be double-checking your scuba gear at this time ?
Have a great vacation !!
The chip inside the LED “knows” data arrives due to the rising edge of the waveform. Worldsemi doesn’t document what’s actually inside the chip, but it’s a pretty good bet there’s a few one-shot timers triggered by that rising edge, which clock a 24 bit shift register that received the RGB data, and a little state machine that counts to 24 and then allows the data to pass to the output, so the next LED can grab its 24 bits, and so on. There’s also probably a much longer duration one-shot timer (a dozen microseconds), which is reset on each edge, that clears the state machine when there’s been a period of inactivity. At least that’s my guess of what’s inside a WS2812…
Actually, the answer I think you were looking for:
Is that FastLED, in this case, clocks the data into the Data IN of the first LED. The first LED clocks the previous values to the second LED via the data OUT as the new data comes from FastLED. The second, sends to the third and so on, all the way down the strip.
So if you have 10 LEDs, then you need to send the data 10 times, first LED #10, then #9 … and finally #1 (nearest the computer output pin). This is all handled for you by FastLED - which is why it is so easy to use ![]()
If you send data for 8 LEDs, then the first 8 will be what you want, the last 2 will appear random (although it can be predicted). If you send 12 LEDs worth of data, #11 & #12 will just ‘fall off the end’ as there is no LED chips to receive the data.
You are thinking about traditional shift registers, Adam, with most modern led chipsets, the first 24 bits of data written go to the first led, which then latches and passes through any subsequent data received to the next chip in the chain, and so on down the line.
The hl1606 was the last led chipset that worked in the way you described, as far as the ordering of shifting data.
Sorry @Synthetech , you got it wrong !
Actually the first LED data is sent first. That LED will take the first 24 bits and simply disregard and transfer all the rest of the data out to the next pixel.
The next or 2nd pixel only starts seeing the 2nd set of 24 bits and it takes that data and just passes the rest of the data bits to the next LED. etc… etc…