I'm having trouble getting 8 strips of NeoPixels running on an arduino mega to

I’m having trouble getting 8 strips of NeoPixels running on an arduino mega to display properly. Here I am using the MultipleStripsInOneArray sketch. If I only run 4 strips at a time, it is fine. Any combination will do. If I run more than 4, black changes to green, and red changes to yellow.

The strips are wired in two paralleled banks of four each, with individual data lines. I’ve had some issue with the PWM pins, so now they are on 2-5 and 10-13. They are hooked up to two separate power supplies, one 5v 2a, one 10a. Arduino is either run off of USB or a 12v 500ma supply.

Code in the comments.
Thoughts?

8197f64674ce7c20b3d18ab555ef4379.gif

6c5254de5544b548919235cdc520ff3b.gif

I’ll post the code that results in the error. When running 4, I just comment out any four of the strips and adjust as needed to get them in order:

#include “FastLED.h”

#define NUM_STRIPS 8
#define NUM_LEDS_PER_STRIP 3
#define NUM_LEDS NUM_LEDS_PER_STRIP * NUM_STRIPS

CRGB leds[NUM_STRIPS * NUM_LEDS_PER_STRIP];

// For mirroring strips, all the “special” stuff happens just in setup. We
// just addLeds multiple times, once for each strip
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);

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

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

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

FastLED.addLeds<NEOPIXEL, 12>(leds, 6 * NUM_LEDS_PER_STRIP, NUM_LEDS_PER_STRIP);

FastLED.addLeds<NEOPIXEL, 13>(leds, 7 * NUM_LEDS_PER_STRIP, NUM_LEDS_PER_STRIP);
}

void loop() {
for(int i = 0; i < NUM_LEDS; i++) {
leds[i] = CRGB::Red;
FastLED.show();
leds[i] = CRGB::Black;
delay(100);
}
}

What version of FastLED are you using? Try v3.1
Also pins from 10 are better (explanation in FastLED bug list).

My FastLED version is current. I installed it maybe two weeks ago. Though I hadn’t paid attention to the potential problems incurred in using the most current IDE. I’m up to date with Arduino, so I may need to step that back to 1.5.7, apparently.

Just ran it in IDE 1.5.7, still giving me green and yellow on all 8 strips.

Should I move some of the pins from PWM to the digital write pins in the 46+ range? I was under the impression that I needed PWM pins, but if I need to be above 10, I’m out of options.

@Bob_Jacobs NUM_LEDS == NUM_LEDS NUM_LEDS_PER_STRIP * NUM_STRIPS

so NUM_LEDS = 24 and your CRGB leds array has a zero index, meaning it starts at counting at 0 up to 23 (which makes 24).

Take a look at this in the code:
for(int i = 0; i < NUM_LEDS; i++) { }

Its calling LED 0 all the way to LED 24 (which makes 25 in total). You need to either NUM_LEDS-1 or in the setup, NUM_LEDS = NUM_LEDS NUM_LEDS_PER_STRIP * NUM_STRIPS + 1

@Jon_Burroughs This is a basic sketch and it is OK !

It writes from 0 to 23 only never reaches 24 !!

@Bob_Jacobs For now, my only suggestion is to carefully re-check all your wiring. It loks a bit messy from the video :wink: I can’t imagine this being anything but a power issue.

The code is direct from the FastLED examples with the exception of my adding 5 strips. It seems like I shouldn’t have to modify it since it works for other people.

@JP_Roy Thanks. I know it looks a mess, but I believe it is all correct. I’ll strip it and start over just in case.

I’d like to say that it is a problem with running two sets of strips in parallel, but since I’m able to get them to work in conjunction with each other as long as I don’t add more than 4 strips, I’m baffled.

@Bob_Jacobs Do you have a Skype account ?
If you want, we could setup a video call and I would try to help you live !

@JP_Roy You are too kind! Thank you for the offer. I’ll try to rebuild it first, and if you have some free time in the next couple afternoons, I may just hit you up for that.

I greatly appreciate it!

@Bob_Jacobs I have a setup on my desk with 16 strips of 25 WS2812b pixels [Total of 400 LEDs] running on 16 different pins of my MEGA 2560.

I tried, unsuccessfully, to re-create the behavior you describe.

I run a simple sketch that lights up all 400 LEDs and slowly changes the hue in a loop over time. The whole array is powered via my PC’s USB port only !!!

I have a potentiometer hooked up to an analog input that I use to vary the overall brightness of the array.

I am able to get the whole set of 400 LEDs surprisingly bright before the sketch freezes up.

I measured the 5Vdc to be as low as 3.5 Vdc and the sketch was still running fine !!

But I never got that green color on LEDs that should have been black !?

Very strange.

Are you using the digital pins in the 46-50ish range to get so many outputs? I was considering using those to see if it had some mystery effect.

Yes I am using pins somewhere between 26 to 52.

I really doubt that changing to that range of pins will help but as this is a baffling case, if it is not too much of a hassle… try it !

From you videos, I see that you actually get a ‘chaser’ effect going on all 8 strips.

That tells me that all 8 pins are outputting some valid data at the correct time.

Note that when a Red color is ‘added’ to a green LED, you get Yellow !!

It simply looks like the green color is always on all LEDs. Why that is, I do not know !!??

I do get the chaser effect, no matter what. Good point on the Green/Yellow/Red effect, I hadn’t considered that.

I tried using pins ranging from 28-40, it was still green.

I wired them all back into a single power supply with a single capacitor just to make things simple again.

I’ve now pulled everything but the resistors off the board, reinstalled everything, and I still am coming up green. So I’m at a total loss.

I’m going to put it down until tomorrow.

Thanks again for all your help!

There are two versions of FastLED . I had similar issue, red instead black.
Try to add 120-470 resistor between arduino and strip.

@Artur_Koziol I’ve got 300ohm resistor between the data lines of each strip and the Mega, on a breadboard.

I was unaware of there being two versions of FastLED. Did you solve your color issue?

@Bob_Jacobs ​ Yes, it work’s nice now. https://github.com/FastLED/FastLED/issues/136

Success!

I didn’t realize 3.1 was not the default. I switched over and the problem is gone. All my colors are displaying properly!

I’ve been quite frustrated by this, so thank you so much for pointing me in the right direction. Thank you everyone for all your help!

Now on to the next part of the problem!