LED is slow is this normal with fASTLeD library

Hi All,
Using FastLED library
Using these strips, connected two 300 count strips.

BTF-LIGHTING WS2812B RGB ECO LED Strip, Chasing Effects 5050SMD Individually Addressable 16.4FT 60Pixels/m 300Pixels Flexible Dream Color IP30 for Bedroom DIY Projects DC5V(No Adapter or Controller) Amazon.com: BTF-LIGHTING WS2812B RGB ECO LED Strip, Chasing Effects 5050SMD Individually Addressable 16.4FT 60Pixels/m 300Pixels Flexible Dream Color IP30 for Bedroom DIY Projects DC5V(No Adapter or Controller) : Tools & Home Improvement

Running this code, it takes like 11 seconds to run through the led strip (600)

Is this normal performance, is there any easy way i can speed it up, using software?
Otherwise what hardware changes need to be made to get through this cycle in like 1 second?

Code:

#include <FastLED.h> // Include the FastLED library
#define NUM_LEDS 600 // Define the number of LEDs

CRGBArray<NUM_LEDS> leds; // Create an array of CRGB objects

void setup() {
  FastLED.addLeds<NEOPIXEL,13>(leds, NUM_LEDS); // Initialize the LED strip
  end_turnblack(); // Turn off all LEDs
  randomSeed(analogRead(0)); // Initialize random number generator
}

void loop(){
pattern1_snake(); // Execute pattern 1
end_turnblack(); // Turn off all LEDs
}

void end_turnblack(){
  leds.fadeToBlackBy(255); // Fade all LEDs to black
  FastLED.delay(1); // Delay to allow the LEDs to update
}

void pattern1_snake(){ 
  int col = random(0,256); // Generate a random color
  for(int i=0;i<NUM_LEDS;i++){
    leds[i]=CHSV(col,255,255); // Set each LED to the random color
    leds.fadeToBlackBy(10); // Fade the LED to black
    FastLED.delay(1); // Delay to allow the LEDs to update
  }
}

Please edit your post, select all code and apply code tags; next save the post.

600 LEDs take 18 milliseconds to update; that is the way the strips work. Your for-loop in pattern1_snake() does 600 updates (I assume fadeToBlackBy does update the strip). So the 11 seconds will be more or less correct.

It is not a performance of the strip, but performance of your code.

Can you help me understand?

Can i rewrite the code to make it faster?

The above poster indicated the hardware (led strip) is the limiting factor

No, the limiting factor is a duration of your led effects. If you need to lit each led separately, it can't be done quickly any way.
To switch one led you always need to update an entire strip - all 600 leds. Try to modify your plans to use a less time-consuming effects.

If it would take 1 picosecond to update the full strip, ...... :smiley:

Can you recommend how to make a light run across the strip any faster?

I tried making the led jump every 2 spots, but it doesn’t look so nice. Though it did cut runtime down in half.

With WS2812b leds there is no way to make it faster

If i upgrade to a more top of line LED but still use Arduino how much speed increase can i expect?

I don't think that there are strips that are 10 times as fast but I have never really looked.

I'm aware of the fact that you can do strips in parallel. You need a very fast processor for that (and you don't mention which board you use).

Using a Teensy 3.2-4.1 OctoWS2811 Adaptor with a suitable teensy board might be a solution. I have never used it. I only have a faint idea how it works. There are two examples in the FastLED library how to use it; you will have to rework your code to handle your pattern correctly.

With this, you should be able to speed it up to approx. 1.5 seconds.

Note: the needed Teensy board is a 3.3V board hence the need for the / an adapter.

Hi All,
Using FastLED library
Using these strips, connected two 300 count strips.

BTF-LIGHTING WS2812B RGB ECO LED Strip, Chasing Effects 5050SMD Individually Addressable 16.4FT 60Pixels/m 300Pixels Flexible Dream Color IP30 for Bedroom DIY Projects DC5V(No Adapter or Controller) https://a.co/d/faGfGmS

Running this code, it takes like 11 seconds to run through the led strip (600)

Is this normal performance, is there any easy way i can speed it up, using software?
Otherwise what hardware changes need to be made to get through this cycle in like 1 second?

#include <FastLED.h> // Include the FastLED library
#define NUM_LEDS 600 // Define the number of LEDs

CRGBArray<NUM_LEDS> leds; // Create an array of CRGB objects

void setup() {
  FastLED.addLeds<NEOPIXEL,13>(leds, NUM_LEDS); // Initialize the LED strip
  end_turnblack(); // Turn off all LEDs
  randomSeed(analogRead(0)); // Initialize random number generator
}

void loop(){
pattern1_snake(); // Execute pattern 1
end_turnblack(); // Turn off all LEDs
}

void end_turnblack(){
  leds.fadeToBlackBy(255); // Fade all LEDs to black
  FastLED.delay(1); // Delay to allow the LEDs to update
}

void pattern1_snake(){ 
  int col = random(0,256); // Generate a random color
  for(int i=0;i<NUM_LEDS;i++){
    leds[i]=CHSV(col,255,255); // Set each LED to the random color
    leds.fadeToBlackBy(10); // Fade the LED to black
    FastLED.delay(1); // Delay to allow the LEDs to update
  }
}

What is your arduino?
Using some advanced boards - Teensy, Due or STM32 you can split your strip on, say, 8 parts and run them in parallel - so your led could run on strip 8 times faster.

Would i need to cut the led strip and have wires going back to different pins on my board?

I have an arduino Uno, is that good enough to get this 8 fold increase through this process?

With Uno you also can connect several strips to different pins, but all they will be updated one by one, in series, so it pointless if you need to make it faster

This is complicated.

Is the limiting factor the speed of the arduino processor or the speed of the led strip data flow?

If the latter then, wouldn’t it be better to split in arduino dup?

Sorry i am not bale to wrap my head around this.

With 600 LEDs, it will take 18mS to update the strip (assuming 800KHz data rate, 24 bits per LED).
In the following code, the for loop executes 600 times, adding an additional 1mS delay per iteration, for a total time of 19mS x 600 = 11.4 seconds.

void pattern1_snake() {
  int col = random(0, 256); // Generate a random color
  for (int i = 0; i < NUM_LEDS; i++) {
    leds[i] = CHSV(col, 255, 255); // Set each LED to the random color
    leds.fadeToBlackBy(10); // Fade the LED to black
    FastLED.delay(1); // Delay to allow the LEDs to update
  }
}

A teensy with an OctoWS2811 board would be able to drive the strips faster, because that drives eight strips in parallel.

For this one particular pattern, you could split the strip into smaller segments, and only update the specific strips that have lit LEDs, but that gets rather complex. ( < edit > not going to work with this pattern, the fade takes too long.)

Alternatively, there are other types of addressable LEDs that have faster bit rates, or that are truly individually addressable, either of which would help.

700 LEDs times 3 bytes per LED times 8 bits per byte = 14,400 bits of data, which is transferred at 800 kHz taking 18 ms to update the whole string.

I don't see a leds.show() command, I thought that's needed to write out the data to the LEDs? Or is that done in the leds.fadeToBlackBy(10) call? That would mean you're doing a total of 600 updates, taking close to 11 seconds.

So there you go. That's 11 seconds of updating the LED string. Not limited by the MCU for sure.

FastLED.delay() calls show().

@rickarduinotinker, please do not cross-post. Threads merged.