NeoPixelBus icon indicating copy to clipboard operation
NeoPixelBus copied to clipboard

Support multiple output

Open Atraii opened this issue 7 years ago • 14 comments

NeoPixelBus is an awesome library, and it is currently possible to create two different strip outputs using two different methods:

NeoPixelBus<NeoGrbFeature, Neo800KbpsMethod> strip(STRIP0_LEDS);
NeoPixelBus<NeoGrbFeature, NeoEsp8266AsyncUart800KbpsMethod> strip1(STRIP1_LEDS);

However, this makes it confusing to update the strip. Consider an example scenario where you have 900 WS2812 LEDs. This many LEDs will have serious framerate issues (~35 fps max), but this can be doubled if the ESP8266 were to be placed in the middle of the strip and using two outputs. Then only 450 LEDs need to be updated with each data line. While NeoPixelBus can work with creating two different strip objects, it would be really great if only one 'multiple output' strip object had to be made, with the appropriate number of LEDs on each output specified:

NeoPixelBus<NeoGrbFeature, NeoCombinedMethod> strip(strip0_ledcount, strip1_ledcount)

I would really love to see a new method that combines DMA and the Async UART methods to supply one long continuous strip with the ESP8266 in the middle to output to both sides. Then internal functions could simply use SetPixelColor and it would adjust the DMA or UART pixels accordingly.

Atraii avatar Feb 01 '17 04:02 Atraii

lets say both strips (A & B) have 4 pixels each. Where does index 0 start?

  0   1   2   3   4   5   6   7 - index to combined strips
 A0  A1  A2  A3  B0  B1  B2  B3 - linear from first strip to second
 A3  A2  A1  A0  B0  B1  B2  B3 - linear from center out from each strip

Makuna avatar Feb 01 '17 18:02 Makuna

I currently have the ESP module in the middle with one of the strip's reversed, like the second example you put. It's the easiest setup to connect.

0   1   2   3   4   5   6   7 - index to combined strips
A0  A1  A2  A3  B3  B2  B1  B0 - linear from center out from each strip

Atraii avatar Feb 01 '17 20:02 Atraii

https://github.com/Aircoookie/WLED/compare/master...peacepenguin:master

take a look at the fork differences in the repo i've created from WLED. WLED uses a "big single strip" throughout the entire program, similar to what you're after in concept. Then to enable multi-pin, i've just done the math on the provided "pixelindex" which represents the position on the giant "virtual" strip, the math just figures out what pixelindex to actually set on a specific strip.

Obviously you have to define the exact strip layout in advance so the math works. But the theory you're after is proven to be doable already without any changes or enhancements needed to neopixelbus.

Also check out the NeoBuffer method, you can generate a big "virtual" strip that way too, then dump the NeoBuffer to real strips using "Blt". Blt allows you to select an exact range of pixels to dump to the physical strip. So you can use the NeoBuffer as your virtual strip to begin, then at the end apply it to real NeoPixelBus strips using Blt.

@Makuna was a huge help on the gitter chat to help me figure all this out, and both methods work great. But seems to be an under-utilized, somewhat advanced feature of NeoPixelBus.

peacepenguin avatar Sep 01 '20 23:09 peacepenguin

So is multiple ledstrips already fixed? (it's about 3 years ago now) Still getting the RMT error. :-(

jvanlangen avatar Oct 18 '20 21:10 jvanlangen

So is multiple ledstrips already fixed? (it's about 3 years ago now) Still getting the RMT error. :-(

Yes.

Heres my test example for multtipin using blt method of neopixelbus:

https://www.github.com/peacepenguin/npb-complexblt/tree/master/src%2Fmain.cpp

You can send the same data to different strips, or unique data to each strip.

And here's a different way to do it, wled sends all output using neopixelbus, I've created a fork of wled that supports multipin output using neopixelbus, documented here:

https://github.com/Aircoookie/WLED/issues/104

Read from the bottom up, and find the most recent build instructions.

So yes I think it's proven to be possible now in two different ways using neopixelbus.

Use the link above in my previous post to my fork of wled, just click compare to see the changes I've made, all of it is reusable in other projects that use neopixelbus.

I would start with the fork of wled and get all your bugs worked out on code that has been tested successfully by a few people now, then take what you need from the wled fork.

peacepenguin avatar Oct 18 '20 21:10 peacepenguin

Thanks for your reaction. I had to download a .zip file to add to my arduino IDE, is there a zip file with this multi-pin support also to download?

Regards, Jeroen.


Van: Ben [email protected] Verzonden: zondag 18 oktober 2020 23:54 Aan: Makuna/NeoPixelBus [email protected] CC: Jeroen van Langen [email protected]; Comment [email protected] Onderwerp: Re: [Makuna/NeoPixelBus] Support multiple output (#160)

So is multiple ledstrips already fixed? (it's about 3 years ago now) Still getting the RMT error. :-(

Yes.

Heres my test example for multtipin using blt method of neopixelbus:

https://www.github.com/peacepenguin/npb-complexblt/tree/master/src%2Fmain.cpp

You can send the same data to different strips, or unique data to each strip.

And here's a different way to do it, wled sends all output using neopixelbus, I've created a fork of wled that supports multipin output using neopixelbus, documented here:

Aircoookie/WLED#104https://github.com/Aircoookie/WLED/issues/104

Read from the bottom up, and find the most recent build instructions.

So yes I think it's proven to be possible now in two different ways using neopixelbus.

Use the link above in my previous post to my fork of wled, just click compare to see the changes I've made, all of it is reusable in other projects that use neopixelbus.

I would start with the fork of wled and get all your bugs worked out on code that has been tested successfully by a few people now, then take what you need from the wled fork.

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/Makuna/NeoPixelBus/issues/160#issuecomment-711429163, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AALWGVDD3RJDTOGZB5SB7JLSLNP3FANCNFSM4C6N6MYA.

jvanlangen avatar Oct 19 '20 07:10 jvanlangen

I checked your example, I'm doing the exact same. Still getting the "14:29:57.909 -> E (33) rmt: rmt_set_pin(397): RMT GPIO ERROR" when I call strip2.Begin();

(using NeoPixelBus v2.6.0

jvanlangen avatar Oct 19 '20 12:10 jvanlangen

I works! Thank you very much

Hmm, instead of using pin35, I used pin 22 (something to do with that?)

jvanlangen avatar Oct 19 '20 12:10 jvanlangen

@jvanlangen Please don't use an issue to discuss your specific problem. Please use the gitter channel.

Your question is different than this issue. This issue is about a single instance of NeoPixelBus supporting multiple methods and pins; not multiple instances of NeoPixelBus (which has been working for years).

Makuna avatar Oct 19 '20 15:10 Makuna

Ok,

I'm not really familiar with gitter channels of something like that yet.

Thanks for pointing that out.


Van: Michael Miller [email protected] Verzonden: maandag 19 oktober 2020 17:14 Aan: Makuna/NeoPixelBus [email protected] CC: Jeroen van Langen [email protected]; Mention [email protected] Onderwerp: Re: [Makuna/NeoPixelBus] Support multiple output (#160)

@jvanlangenhttps://github.com/jvanlangen Please don't use an issue to discuss your specific problem. Please use the gitter channel.

Your question is different than this issue. This issue is about a single instance of NeoPixelBus supporting multiple methods and pins; not multiple instances of NeoPixelBus (which has been working for years).

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/Makuna/NeoPixelBus/issues/160#issuecomment-712235688, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AALWGVBYDN3P6RN3RNNNDVDSLRJVLANCNFSM4C6N6MYA.

jvanlangen avatar Oct 19 '20 15:10 jvanlangen

https://github.com/Makuna/NeoPixelBus/pull/411 While this doesn't specifically fix this issue yet, it is a step toward it.

Makuna avatar Jan 24 '21 23:01 Makuna

I keep thinking about this. Especially now that we have the x8 and x16 i2s parallel methods where the multiple buses are used to improve speed. Support for linear (single row) verses matrix (row/column) of pixel reference on input being mapped to mulitple buses.

Makuna avatar Feb 12 '23 02:02 Makuna

As per https://github.com/Makuna/NeoPixelBus/discussions/694, I would love to get support for multiple strips together with the NeoTiles. In my case, I have a panel of 7x5 tiles. Each tile is connected as RowMajorAlternatingLayout. Each column in the panel (a total of seven column) is a separate input/"strip", where five tiles in that column is interconnected using RowMajorAlternatingLayout (snakes all the way down).

Johboh avatar May 02 '23 14:05 Johboh

Just the initial naming brain thought... NeoMultiBus - an exposed single index range for multiple NeoPixelBus. Usually for speed reasons or mixing different types of strip protocols together as one.
NeoClusterBus - an exposed multi-index range (abstraction) for a single NeoPixelBus (and mulitple?). Usually for treating a single strip as different entities to run different effects on or to improve readability of said effects. The abstractions may infer a physical aspect that can be enumerated (think physical x,y or segment index) for input to the effect.

Makuna avatar Jul 09 '23 16:07 Makuna