Using 2 ledstrips as one, but with a catch

First of all, Hello! I’m totally new to WLED and just very recently found out it existence.
From every thing i have seen so far its amazing! Would love to use it with my ledstrips but there is some programming to do.

In my livingroom there is a square ledstip housing (3m x 4m or so) in the ceiling filled to the brim with APA102 leds, 1,887 to be exact.

I run this with a ESP32 with the FastLED library. Because the led strip is is quite long i had a lot of issues with flikkering and datalosses after about 7 meters, so i decided to split the strip in to 2 strips.
One of those strips is now in reverse, if you would count the leds clockwise it would go like. strip1[led 1] till strip1[led 942] strip2[led 945] till strip2[led 1]. Still with me? :sweat_smile:

With the FastLED library i made a dirty fix (But it works!)

#define DATA_PIN1    23
#define CLK_PIN1   18
#define strip1 942
#define DATA_PIN2    13
#define CLK_PIN2   14
#define strip2 945
#define LED_TYPE    APA102
#define COLOR_ORDER BGR
#define NUM_LEDS    strip1 + strip2
CRGB leds[NUM_LEDS];
CRGB leds1[strip1];
CRGB leds2[strip2];
CRGB leds2reverse[strip2];
CRGB ledsMain[NUM_LEDS]; 

 FastLED.addLeds<LED_TYPE,DATA_PIN1,CLK_PIN1,COLOR_ORDER,DATA_RATE_MHZ(3)>(ledsMain, strip1).setCorrection(TypicalLEDStrip);
 FastLED.addLeds<LED_TYPE,DATA_PIN2,CLK_PIN2,COLOR_ORDER,DATA_RATE_MHZ(3)>(ledsMain, strip1,strip2).setCorrection(TypicalLEDStrip);

void showleds(){
  for(int i = 0; i < NUM_LEDS; i++){    // Split total leds array into separate arrays (each strip its own array)
    if(i < strip1) {
      leds1[i] = leds[i];
    } else {
      leds2[i - strip1] = leds[i];  
    }
  }
  
  int i = 0;
  int j = strip2;
  while(i < strip2){                  // Reverse second leds strip array
      leds2reverse[j] = leds2[i];
      i++;
      j--;
  }
  
  for(int i = 0; i < NUM_LEDS; i++){    // Create one big array from the first led strip, combined with the reversed second strip
    if(i < strip1) {
      ledsMain[i] = leds1[i];
    } else {
      ledsMain[i] = leds2reverse[i - strip1];
    }
  }
  FastLED.show();  
}

Because FastLED built up an array for the leds then call the function FastLED.show(); to “push” it to the strip i could tweak it in a way to “render” the effects as one Array and the split them up in seperate arrays for the 2 strips.

Now the real question, i have looked through the WLED source code and cant figure out where i could implement a feature like i described.
Does WLED uses a Array like the one used above?

Hope someone can help! Would love to use this with an App and Home assistant :grinning:

You may be able to use custom mapping?

#ifdef WLED_CUSTOM_LED_MAPPING
//this is just an example (30 LEDs). It will first set all even, then all uneven LEDs.
const uint16_t customMappingTable[] = {
  0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28,
  1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29};

//another example. Switches direction every 5 LEDs.
/*const uint16_t customMappingTable[] = {
  0, 1, 2, 3, 4, 9, 8, 7, 6, 5, 10, 11, 12, 13, 14,
  19, 18, 17, 16, 15, 20, 21, 22, 23, 24, 29, 28, 27, 26, 25};*/

Because of the addressable LED strip technology, above around 500 LEDs per strip and the update rate drops and eventually becomes noticeable.
I would recommend splitting what you have into 3 or 4 strips.
Your update rate is around 30 updates per second (if my math is right … see also this FAQ: https://www.pololu.com/product/2548/faqs )
At 30 updates/sec, the human eye can sense it, and if the LEDs are the only light source in an otherwise dark space, it may seems like a strobe effect if people are moving around.

That said, I applaud your solution.

The ESP32 has more pins and processing power. Use a couple more pins and more dirty fixes to get all 1887 controlled by one WLED instance.

As a side note, WLED has the ability to SYNC with other instances of WLED. So, if you broke it up into 4 independent WLED instances, perhaps using the esp8266, and had them all SYNC, with whichever strip(s) needs reverse configured, that is all automatic without any of the magical dirty fixes.

Not suggesting you do that, but it would allow OTA updates using standard WLED firmware rather than having to redo the dirty fix everytime a new WLED update comes out with a new feature you want to use.

Just be aware that it’s currently “almost sync”. :wink: Things don’t happen at the exact time across devices.

I have looked in to this, but can’t seem to figure out how to make this work with 2 strips.
Thank you for helping to solve this problem!

I have check the FPS in a curde way, it seems around 100FPS right now, because with de APA102 Leds you have a separate data/clock with no maximum clock speed, but if I go any higher you would loss data along the way. I have looked at the sync feature (awesome btw!!) but I don’t think it would work with one “continuous” strip. Sadly there is no option to split the led strip any further or reverse it again… Ceiling is closed and I don’t think my wife will let me break it apart again :joy:

For the fun of it I will post a YouTube link this evening so you have a beter understanding of what it’s like now. But without the fancy, awesome, beautiful app and interface of Wled, just some demo code.

In WLED, is there a function like the “showleds” and pin assignments? Maybe then I can try to manipulate the code with the reverse array function.
Thank you for helping to solve this problem!
This community is awesome already!

I have uploaded a video of how its working now with the old setup.

APA102 Ledstrip

The two strips start at the bottom left corner and meet end to end in the top right corner.

*APA102 isn’t limited to 500LEDs to keep ~60FPS, that’s the WS2812b protocol causing that issue. It only goes up to 800kHz where APA102 can go up to 24Mhz (generally not recommended)!

Do you get the flicker with anything set or only set to full colors and maybe white? If so I’d think it’s some kind of voltage drop where the LEDs can’t regenerate the signal back up to 5v anymore and at some point it becomes too low for the next LED to know what to do.

Could also be an issue with the APA102 clock line set too high, I don’t believe you can run maximum frequenties after a certain number of LEDs.

In regards of syncing both halves, would splitting it mechanically not just work? Basically split the Data and Clock signals and feed those into both strips. There is no feedback in there so they should always do 100% the same.

Maybe this link can help? https://hackaday.com/2019/05/07/lots-of-blinky-esp32-drives-20000-ws2812-leds/
At least until WLED supports multiple strips.