FastLED Parallel Output (Same Data Different Pins)

I thought this was going to be fairly straight forward. I'm trying to drive four 16x16 LED panels using data two pins from my Arduino Nano Every. Power is being supplied separately. The data pins D2 and D4 are each wired to two of the 16x16 LED panels. I want to see the same animation on all 4 panels.

Modifying some example code I thought all I would need to do would be to define my second LED output (D4) and add a the second controller pointing to D4.

#define LED_PIN_2 2
#define LED_PIN_4 4

FastLED.addLeds<NEOPIXEL, LED_PIN_2>(leds, NUM_LEDS);
FastLED.addLeds<NEOPIXEL, LED_PIN_4>(leds, NUM_LEDS);

The two LED panels connected to pin D2 are working fine but nothing from the panels connected to pin D4.

You need a separate leds array for each.

#define NUM_LEDS 24  // or the number for your setup

#define LED_PIN_2 2
#define LED_PIN_4 4


FastLED.addLeds<NEOPIXEL, LED_PIN_2>(leds1, NUM_LEDS);
FastLED.addLeds<NEOPIXEL, LED_PIN_4>(leds2, NUM_LEDS);

Read the forum guidelines. Please post all of the code.
Use the IDE autoformat tool (ctrl-t or Tools, Auto format) before posting code in code tags.

Thanks for the quick response. Though this seems like it would require me to duplicate a lot of code. Every modification to leds1 array would have to be duplicated to leds2 array. Is there any way to use only one leds array or have leds2 be a reference of leds1?

Adafruit says....

I take no responsibility.

This was originally how I went about it. But unfortunately it doesn't work quite right. I get a good bit of unexpected behavior from the LEDs.

Now use the buffer IC. :wink:

I guess that I don't under stand what you are trying to do.

I thought that OP just want to display exactly the same light on two separate parallel strips at same time.

Have a look at the MirroringSample example sketch for FastLED (File > Examples > FastLED > Multiple > MirroringSample).

1 Like

Thanks @david_2018, I'll give that a look later. Sounds promising

I notice that the compiler generates errors unless I set Tools > Registers Emulation > "None (atmega4809)" in the IDE. Good to see that FastLED finally added support for the Nano Every.

This will show the same data but will each pin be transferred in order.
I thought the two panels could appear out of timing when the OP was showing something on the display at high refresh rate.
Well, it may be the same from the human eye. :laughing:

I'm not sure how many strips can be directly driven off a single output pin, if four is too many then a buffer would be easy to implement, and the strips would be driven simultaneously.

Adafruit says four are feasible, but OP wasn't.
So I've suggested a use buffer IC, but if a very slight timing shift doesn't matter, approach at you provided is better.
And timing shift issues are unlikely to be a problem for most applications.

Or use the Adafruit idea but only expect two instead of four to work, two buffer pixels on one output pin each driving two strips.


@chrisknightley, I'll have to look into ic buffer as well. I don't have much experience with Arduino as this is my first project with it.

@david_2018 after looking at the example, this appears to be exactly what I was doing

As long as your Arduino still have unused pins and your LEDs are not displaying super fantastic high-speed animations, david's approach is everything fine.

But, Well... it's not a bad thing to learn how to use the logic IC for your much experience of electronics.

If your code is using the same technique as the example code, then try the example code to verify that it works on the Nano Every. It's possible that FastLED has a bug with multiple outputs on the Nano Every, support for the atmega4809 is a fairly recent addition.

I am noticing that when Tools > Registers emulation > "ATMEGA328" is selected the code generates errors when certain pins are selected - pins 0, 1, 4, 5, 9, 10, A0, A1, A2, A3 - you might try using another pin instead of 4 for the 2nd output.

1 Like

Just out of curiosity; Could you not run all strips from one pin if you used a transistor to amplify the signal? Or are the LED panels causing interference in the data signal?

1 Like