How does Addressable LED id's work?

How does the 10th LED in a strip know that it is no 10?

When a strip of 20 leds is cut in half then the 11th led will become the first led in the cut off strip.

Is this no 11 led still 11 and the next one 12 ?

I saw this tutorial , below , and dont get the "addressable" part.

https://howtomechatronics.com/tutorials/arduino/how-to-control-ws2812b-individually-addressable-leds-using-arduino/

Yes. the 11th led will become the first led in the cut off strip.

This LEds work passing data for the next LED.
In the simple way:
The LED "catch" your "address" and move the next "address" to next LED.

Yes I sort of get the idea but how does the THIRD led know that it is NO 3 in the list?
Maybe I am just over thinking this , there must be something else going on.

It's like a roll of candies going around a room. Everyone takes the at that point top candy from the roll and passes on the roll to the next.
That's why you need to initialize how many "leds" there are, so that you start with a roll of candies that has just enough for everyone.

2 Likes

@hmeijdam's answer explains your doubt.

If the second person does not want candy the third person will take it and there will be one candy left at the end of the row.

If the first led is turned on and the second one is skipped what then?

I also found this.

https://www.instructables.com/Demystifying-4-pin-addressable-RGB-LEDS/

That little silicone brain also is able to figure out where in the sequence of LEDs it is

How does the silicone brain figure out the sequence?

No, you are not.
The confusion comes from the fact that they are referred to as "addressable", when they really are not. The pixels do not have addresses. Just put the term "addressable" out of your head.

Each WS28xx reads the first 24 bits for color and strips those bits.

Stop with "instructables", their explanations are rot, more often than not.

Maybe this will help. You have a stack of 10 envelopes. You walk down the street, putting one in each door, starting with the one on the top of the stack. Each "address" has received it's message.
Your array of 30 bytes(or 10 LEDs) is your 10 envelopes. The "addressing" is, as others said, meaningless, because who gets what is determined completely by the order of the array.

These leds are like teenagers in a snackbar. They will never skip taking their part.

2 Likes

That part I figured out but what makes it work?

@xfpd Thank for the video

If the data for all 10 leds is send every time with any colour change of any led then there is some logic in the opperation.

BUT;
This example skip led 3 and 4 and a few others , how does led 5 know it should light up.

#include <FastLED.h>

#define LED_PIN     7
#define NUM_LEDS    20

CRGB leds[NUM_LEDS];

void setup() {

  FastLED.addLeds<WS2812, LED_PIN, GRB>(leds, NUM_LEDS);
  
}

void loop() {
  
  leds[0] = CRGB(255, 0, 0);
  FastLED.show();
  delay(500);  
  leds[1] = CRGB(0, 255, 0);
  FastLED.show();
  delay(500);
  leds[2] = CRGB(0, 0, 255);
  FastLED.show();
  delay(500);
  leds[5] = CRGB(150, 0, 255);
  FastLED.show();
  delay(500);
  leds[9] = CRGB(255, 200, 20);
  FastLED.show();
  delay(500);
  leds[14] = CRGB(85, 60, 180);
  FastLED.show();
  delay(500);
  leds[19] = CRGB(50, 255, 20);
  FastLED.show();
  delay(500);
}

No... It's serial data. You are only feeding the 1st door with one envelope one at time and everybody will pass-on the envelope when they receive another one.

I'm not actually sure if the LEDs flash the data for a few microseconds (faster than you can see it) as it passes-through, but I think so.

There are serial addressing modes where the data can be ignored as it passes through but they usually require more than one "data" connection.

You send 10 pixels worth of data and the 1st pixel you send ends-up wherever you stop. The 2nd pixel ends-up next to the end, etc.

If you send 11 pixels, the 1st one will be lost when there is no device (LED & chip) to receive the data.

If you wire it as a new strip, or in parallel with the 1st strip, it's No. 1 because it's the 1st LED in the strip.

The library takes care of that for you. If you wrote the code yourself without using the library you would find that you do indeed need to include 3 and 4

The WS28xx is an integrated circuit. Here is a paragraph from the WS28xx datasheet...

The data transfer protocol use single NZR communication mode. After the pixel power-on reset, the DIN port receive data from controller, the first pixel collect initial 24bit data then sent to the internal data latch, the other data which reshaping by the internal signal reshaping amplification circuit sent to the next cascade pixel through the DO port. After transmission for each pixel,the signal to reduce 24bit. pixel adopt auto reshaping transmit technology, making the pixel cascade number is not limited the signal transmission, only depend on the speed of signal transmission.

(translated from Chinese)

Thanks , so the data bytes is always the same amount as the leds in the strip.

So the library will do something like this, for 10 leds.

blue,previous,previous,previous,green,green,previous,previous,white,previous

It makes much more sense now.

Using the library, you will define and declare the type and size (number of LEDs) of the WS2812 and create an "instance" (also called an object). In your sketch, you will load the WS2812 object/instance with colors for every WS2812 LED. Then, with a Library call, you will "shift-out" all that data into the WS2812 string. The first WS2812 chip will strip the first 24 bits and pass the rest. The next WS2812 will strip the new "first 24" bits and pass the rest... and so on.

Yes, but 3 bytes for each pixel (RGB). So for 10 neopixels it will always send 30 bytes of data.

No, the data can be either more, or less than number of leds. It doesn't matter.

It doesn't. Every led in the row " thinks" that he is the first. So it get THE first data from the sequence and pass the rest to the next led.
The critical fact for understanding how the addressable leds work is that the data do not transmitted unchanged. Every led in row cut the first packet and transmit the sequency from the second packet only.

1 Like

They are shift registers.
The number of shift cycles is determined by the number of devices established at instantiation.

1 Like