NeoPixel strip array quandary

Hi all,

I’m in need of some direction towards the right track for my project.
I’ve got a Mega wired up with 8 NeoPixel strips. Currently the strips are 3 pixels each, eventually they will be about a meter each. Each is wired into its own PWM pin, 2-5 and 8-11 (separated simply because the jumpers got crowded). I’m working with the FastLED library trying to make a specific pattern.

Right now I’ve got the following:

#include "FastLED.h"

#define NUM_LEDS_PER_STRIP 3
CRGB leds[NUM_LEDS_PER_STRIP];
#define BRIGHTNESS  64
#define LED_TYPE    WS2811
#define COLOR_ORDER GRB

#define UPDATES_PER_SECOND 100


CRGBPalette16 currentPalette;
TBlendType    currentBlending;

void setup() {
  FastLED.addLeds<NEOPIXEL, 2>(leds, NUM_LEDS_PER_STRIP);

  FastLED.addLeds<NEOPIXEL, 3>(leds, NUM_LEDS_PER_STRIP);

  FastLED.addLeds<NEOPIXEL, 4>(leds, NUM_LEDS_PER_STRIP);

  FastLED.addLeds<NEOPIXEL, 5>(leds, NUM_LEDS_PER_STRIP);
    
  FastLED.addLeds<NEOPIXEL, 8>(leds, NUM_LEDS_PER_STRIP);

  FastLED.addLeds<NEOPIXEL, 9>(leds, NUM_LEDS_PER_STRIP);

  FastLED.addLeds<NEOPIXEL, 10>(leds, NUM_LEDS_PER_STRIP);

  FastLED.addLeds<NEOPIXEL, 11>(leds, NUM_LEDS_PER_STRIP);
  

  delay( 3000 ); // power-up safety delay
  FastLED.addLeds<LED_TYPE, COLOR_ORDER>(leds, NUM_LEDS_PER_STRIP).setCorrection( TypicalLEDStrip );
  FastLED.setBrightness(  BRIGHTNESS );
  
  currentPalette = RainbowColors_p;
  currentBlending = BLEND;
}


void loop()
{


  static uint8_t startIndex = 0;
  startIndex = startIndex + 1; /* motion speed */

  FillLEDsFromPaletteColors( startIndex);

  FastLED.show();
  FastLED.delay(833 / UPDATES_PER_SECOND);  // Scroll speed in milliseconds
}

void FillLEDsFromPaletteColors( uint8_t colorIndex)
{
  uint8_t brightness = 255;
  
  for( int i = 0; i < NUM_LEDS_PER_STRIP; i++) {
    leds[i] = ColorFromPalette( currentPalette, colorIndex, brightness, currentBlending);
    colorIndex += 8;  // Color segment size
  }
}

What I would like to do with this is turn it into an array, where the same color palette runs, but if the first strip is say green, the second strip is blue, the third is purple, and so on.

My question is thus two-fold: how do I separate the strips appropriately? I’ve worked with the FastLED MultiArray example, but I’m not exactly sure how to input the color palette function. And secondly, how should I go about controlling where the color palette starts on each strip?

One of the things I’ve run into in my research is a suggestion of skipping the array for something like:

for(int i= 0; i <3; i++){ }
for(int i = 3; i < NUM_LEDS-1; i++) { }

I played with that for a bit, but I couldn’t get the second strip to run properly. It looks like that would require me to run the strips in series, rather than giving each its own PWM pin. I would prefer to keep each strip on its own pin for ease of wiring in the final install, but I’d really just like to know what the best direction is to create the display I want.

Also, as a side question, my above code works to mirror all the strips, but when I have more than 3 or so strips running, I lose half the colors in the sequence. If I eliminate:

FastLED.addLeds<NEOPIXEL, 11>(leds, NUM_LEDS_PER_STRIP);

five of those, I get full color. If I run all 8, I only get greens and blues. It may not be important, but it is curious.

Thanks again!

Update:

I’ve put together some code that largely goes in the direction I want. This creates a pattern that cycles through three strips (though for some reason only two pixels from the third strip are lit). It still causes the color to shift down each individual pixel in a strip, rather than each strip being a uniform color with the shift happening between the strips rather than the pixels.

// MultipleStripsInOneArray - see https://github.com/FastLED/FastLED/wiki/Multiple-Controller-Examples for more info on
// using multiple controllers.  In this example, we're going to set up four NEOPIXEL strips on three
// different pins, each strip will be referring to a different part of the single led array

#include "FastLED.h"

#define NUM_STRIPS 3
#define NUM_LEDS_PER_STRIP 3
#define NUM_LEDS NUM_LEDS_PER_STRIP * NUM_STRIPS
#define BRIGHTNESS  64
#define LED_TYPE    WS2811
#define COLOR_ORDER GRB

CRGB leds[NUM_STRIPS * NUM_LEDS_PER_STRIP];

CRGBPalette16 currentPalette;
TBlendType    currentBlending;

#define UPDATES_PER_SECOND 100

void setup() {

  FastLED.addLeds<NEOPIXEL, 2>(leds, 0, NUM_LEDS_PER_STRIP);

  FastLED.addLeds<NEOPIXEL, 3>(leds, NUM_LEDS_PER_STRIP, NUM_LEDS_PER_STRIP);

  FastLED.addLeds<NEOPIXEL, 4>(leds, 2 * NUM_LEDS_PER_STRIP, NUM_LEDS_PER_STRIP);
  
   

  delay( 3000 ); // power-up safety delay
  FastLED.addLeds<LED_TYPE, COLOR_ORDER>(leds, NUM_LEDS).setCorrection( TypicalLEDStrip );
  FastLED.setBrightness(  BRIGHTNESS );
  
  currentPalette = RainbowColors_p;
  currentBlending = BLEND;

}

void loop() {


  static uint8_t startIndex = 0;
  startIndex = startIndex + 1; /* motion speed */

  FillLEDsFromPaletteColors( startIndex);

  FastLED.show();
  FastLED.delay(833 / UPDATES_PER_SECOND);  // Scroll speed in milliseconds
}

void FillLEDsFromPaletteColors( uint8_t colorIndex)
{
  uint8_t brightness = 255;
   
  for( int i = 0; i <3; i++) {
    leds[i] = ColorFromPalette( currentPalette, colorIndex, brightness, currentBlending);
    colorIndex += 8;  // Color segment size (e.g. 4 reds at a time)
  }
  for(int i = 3; i < NUM_LEDS-1; i++) {  
   leds[i] = ColorFromPalette( currentPalette, colorIndex, brightness, currentBlending);
    colorIndex += 8;  // Color segment size (e.g. 4 reds at a time)
  }
}

Many questions in one post... I´d recommend to post it here - thats the place for it.

You also need to divide your project into small problems and then solve them one by one - and it´s way easier to answer questions then, too.

You still have some basic misunderstandings in your assumtions.

You need digital pins, it´s no PWM signal that you feed into the strips.

Parallel output is designed for ARM processors - on AVR it has no advantage speedwise because pins are written in serial.

The color shift along a strip is caused by

colorIndex += 8;

The data for multiple strips can be stored in one big array (as in your second code) or in multiple CRGBs.

The color shift when connecting more leds sounds like a powering issue. You need to power the strips by an external power supply.

The palettes are basically lookup tables which you need to manage seperately when using multiple ones. To start not from the beginning just manipulate the index number. They are casted to bytes, so nothing can go wrong.

Thanks for the detailed reply, Helmuth!

I've found my way over to the FastLED community with some success already.

The color/power issue continues. I've been running the LEDs on a separate power supply. Now I've got them on two separate power supplies. The problem hasn't stopped though. I'll figure it out.

As to the rest of your points, I'll see what I can do.

Thanks again!