FastLED multiple strips on different data pins

I'm using Arduino Uno rev3 with WS2812B LED strips. Due to project requirements need to run five different strips of five different data pins.

I tried using the included FastLED example in my code and the results are very strange. I've checked my wiring dozens of times and finally deduced if used each strip individually all strips work as expected.

Is it possible to run multiple separate WS2812B strips of different data pins? I did some reading and found some discussion of issues with multiple strips but unclear if it pertains to me or not.

If multiple WS2812B strips will run off Arduino Uno rev 3 what would be the proper code to use?

Thanks in advance for the help.

1 Like

Take a look here: Multiple Controller Examples · FastLED/FastLED Wiki · GitHub

How many strips?
How many pixels per strip?
How are your strips powered?
What is the memory usage that the IDE reports?

Thanks for the reply!

That's exactly what I read and I see the code is different from the FastLED library but didn't want to waste time trying it only to find it still doesn't work.

The example that represents what I'm trying to do is multiple LED arrays. Will try and report back.

1 Like

Thanks sterretje for your questions.

  • Five strips.
  • Each strip has differing number of pixels per strip from 156 down to 10
  • Due to project requirements strips are powered off multiple 5V power sources. They are divided in a way that best makes use of the power supply amperages.
  • My code is very simple because the project doesn't require more at the moment. The compelling report is:
    Sketch uses 8176 bytes (25%) of program storage space. Maximum is 32256 bytes.
    Global variables use 946 bytes (46%) of dynamic memory, leaving 1102 bytes for local variables. Maximum is 2048 bytes.
1 Like

What does that mean?

1 Like

Here is my code I was trying to use. As I'd said it was derived from the FastLED library but I modified it to fit within the memory requirements of the Uno. It produces results just very odd and unexpected results. I should add, this code only shows four strips but eventually I'll be adding a fifth and will add the code at that time. The bottom line is I have four strips (eventually five) that will each display different colors. Very, very, very simple requirements.

#include <FastLED.h>

// Define the array of leds
CRGB leds[4][60];

void setup() { 

    FastLED.addLeds<NEOPIXEL, 6>(leds[0], 156); 
    FastLED.addLeds<NEOPIXEL, 7>(leds[1], 34);  
    FastLED.addLeds<NEOPIXEL, 5>(leds[2], 36);
    FastLED.addLeds<NEOPIXEL, 4>(leds[3], 10); 
    fill_solid( &leds[0][0], 156, CHSV(0,0,0));  // set starting state of LEDs to black
    fill_solid( &leds[1][0], 34, CHSV(0,0,0));  // set starting state of LEDs to black
    fill_solid( &leds[2][0], 36, CHSV(0,0,0));  // set starting state of LEDs to black
    fill_solid( &leds[3][0], 10, CHSV(0,0,0));  // set starting state of LEDs to black
    FastLED.show();

}

void loop() { 
  
  // building green
fill_solid( &(leds[1][0]), 34, CHSV( 105, 150, 255) );
// plant purple
fill_solid( &(leds[3][0]), 10, CHSV( 240, 255, 255) );
// plant red
fill_solid( &(leds[2][0]), 36, CHSV( 256 , 255, 255) );
// road blue
fill_solid( &(leds[0][0]), 156, CHSV( 144 , 255, 255) );

    FastLED.show();
  }
1 Like

The way it is structured and accomplished is different. I think. HAHAHA I could be wrong and the code logic is the exact same. if so the example you directed me to won't work for some reason.

1 Like

What is "it" and what is "it" structured differently from?

What is the same as what?

The way the FastLED example is structured seems to my novice eye to be different from the GitHub example.

I could be wrong and the code logic in the FastLED example could be exactly the same as the GitHub example.

By code logic I mean the syntax and specific code.

So if the FastLED example is the same as the GitHub example then I know already by trying it, it will not work and require a different solution. Please refer to the code I've tried that I posted in a reply above.

1 Like

Is the for statement from the GitHub example required to display the LEDs properly or can I do display the LEDs as I've done in my example below the GitHub example?

From GitHub "Multiple LED Arrays":

void loop() {
  for(int i = 0; i < NUM_LEDS_PER_STRIP; i++) {
    // set our current dot to red, green, and blue
    redLeds[i] = CRGB::Red;
    greenLeds[i] = CRGB::Green;
    blueLeds[i] = CRGB::Blue;
    FastLED.show();
    // clear our current dot before we move on
    redLeds[i] = CRGB::Black;
    greenLeds[i] = CRGB::Black;
    blueLeds[i] = CRGB::Black;
    delay(100);
  }
}

The way I was attempting to have the LEDs display:

void loop() { 
  
  // building green
fill_solid( &(leds[1][0]), 34, CHSV( 105, 150, 255) );
// plant purple
fill_solid( &(leds[3][0]), 10, CHSV( 240, 255, 255) );
// plant red
fill_solid( &(leds[2][0]), 36, CHSV( 256 , 255, 255) );
// road blue
fill_solid( &(leds[0][0]), 156, CHSV( 144 , 255, 255) );

    FastLED.show();
  }
1 Like

I read a lot of "not work" and "doesn't work". Can you post a more specific problem report? We can't see the LEDs or the part of your brain that knows what you want them to do.

1 Like

Sure thanks for asking. The first three pins will display solid colors but not the colors I expect, then the last two display either flickering lights or nothing.

As I've said above I can get each pin to display correctly individually without attempting to display them simultaneously. So I'm certain the Arduino Uno rev3 is functioning correctly.

1 Like

First simplify your code so it only drives one strip. Then move on. You've made it complex, past the point of easy troubleshooting.

1 Like

Thanks for the suggestion. It's a good one. That was the first thing I tried. Figured I should make sure the Arduino was functioning so I simplified the code as you suggested and hooked up a single strip of LEDs to each data pin and made sure each pin was outputting the correct data. All pins worked and the LEDs were displaying the expected color. That helped me to know that the Arduino is functioning correctly and my wiring is correct and that the problem was in the code I was using.

So to return to my original request it appears based on what everyone has said so far the Arduino is capable of using multiple LED strips on separate data pins and the GitHub example is the correct way to have the LEDs display correctly?

1 Like

Okay, post that simple working code, and maybe we can help you expand it.

So to return to my original request it appears based on what everyone has said so far the Arduino is capable of using multiple LED strips on separate data pins and the GitHub example is the correct way to have the LEDs display correctly?

Let's not return to this request. I think this is a futile question that won't get you any closer to a working system.

1 Like

Thank you. Here is the code I used to test. I commented out and would change each line of code so that they appear as the uncommented lines. As I said each data pin worked correctly on a single strip of LEDs. The requirement is to have five separate strips display a different color off of five different data pins. Again, I'm only showing code for four pins. A fifth will be added later.

#include <FastLED.h>

// Define the array of leds
CRGB leds[156];

void setup() { 

   //FastLED.addLeds<NEOPIXEL, 6>(leds, 156);  
  //FastLED.addLeds<NEOPIXEL, 7>(leds, 156); 
FastLED.addLeds<NEOPIXEL, 5>(leds, 36); 
  //FastLED.addLeds<NEOPIXEL, 4>(leds, 156); 
    fill_solid( &leds[0], 156, CHSV(0,0,0));  // set starting state of LEDs to black
  //  fill_solid( &leds[1][0], 34, CHSV(0,0,0));  // set starting state of LEDs to black
 //   fill_solid( &leds[2][0], 36, CHSV(0,0,0));  // set starting state of LEDs to black
 //   fill_solid( &leds[3][0], 10, CHSV(0,0,0));  // set starting state of LEDs to black
    FastLED.show();

}

void loop() { 
  
  // building green
//fill_solid( &(leds[0]), 156, CHSV( 105, 150, 255) );
// plant purple
//fill_solid( &(leds[0]), 156, CHSV( 240, 255, 255) );
// plant red
//fill_solid( &(leds[0]), 156, CHSV( 256 , 255, 255) );
// road blue
fill_solid( &(leds[0]), 156, CHSV( 144 , 255, 255) );

    FastLED.show();
  }

Okay, what is the behavior? Is it, only one strip will work at one time?

Why are you addressing 'leds[]' as a one dimensional array in the uncommented line, and two dimensional arrays, in the commented lines?

It is declared as a one dimensional array:

// Define the array of leds
CRGB leds[156];

Okay, what is the behavior? Is it, only one strip will work at one time?

Yes only one strip will work at a time.

Why are you addressing 'leds[]' as a one dimensional array in the uncommented line, and two dimensional arrays, in the commented lines?

This is residual code from the attempt to make multiple strips work simultaneously. I'll post the original multiple strip code below in a separate reply.

I can't make any more replies. Even though it's not my first day on these forums I'm receiving errors from the forum auto-moderation saying I can't make any more posts today. HAHAHA I guess no solution for me. I've reached my maximum number of allowed posts for my status. I've been on these forums a couple years now. Weird.

Here is the reason for the two dimensional arrays. Came from the FastLED library examples. First array dimension represents the pin and second represents the number of LEDs on that strip.

#include <FastLED.h>

// Define the array of leds
CRGB leds[4][60];

void setup() { 

    FastLED.addLeds<NEOPIXEL, 6>(leds[0], 156); 
    FastLED.addLeds<NEOPIXEL, 7>(leds[1], 34);  
    FastLED.addLeds<NEOPIXEL, 5>(leds[2], 36);
    FastLED.addLeds<NEOPIXEL, 4>(leds[3], 10); 
    fill_solid( &leds[0][0], 156, CHSV(0,0,0));  // set starting state of LEDs to black
    fill_solid( &leds[1][0], 34, CHSV(0,0,0));  // set starting state of LEDs to black
    fill_solid( &leds[2][0], 36, CHSV(0,0,0));  // set starting state of LEDs to black
    fill_solid( &leds[3][0], 10, CHSV(0,0,0));  // set starting state of LEDs to black
    FastLED.show();

}

void loop() { 
  
  // building green
fill_solid( &(leds[1][0]), 34, CHSV( 105, 150, 255) );
// plant purple
fill_solid( &(leds[3][0]), 10, CHSV( 240, 255, 255) );
// plant red
fill_solid( &(leds[2][0]), 36, CHSV( 256 , 255, 255) );
// road blue
fill_solid( &(leds[0][0]), 156, CHSV( 144 , 255, 255) );

    FastLED.show();
  }

Well, you could go "old school" and solve it yourself with some online research, patience, time, and analysis... it worked for everyone before forums like this came along...

Would LOVE to take this approach but unfortunately the project goes out tomorrow and a ton of other stuff to do before then.

It seems to me that you are not doing any follow up to the replies. For example, I mentioned the one/two dimensional discrepancy and you are dead silent on the issue.

Please see my edits above. I appreciate the willingness to help though. You all have been wonderful. Thank you.

Well, you could go "old school" and solve it yourself with some online research, patience, time, and analysis... it worked for everyone before forums like this came along...

It seems to me that you are not doing any follow up to the replies. For example, I mentioned the one/two dimensional discrepancy and you are dead silent on the issue.