Grouping WS2812B LEDs for easier control?

Hi Everyone - Thanks in advance for the help. I looked online for an answer to this question, and searched the first 20 pages of this forum, (sorry, I'm not going to manually go through 798 pages....), but have come up empty.

The Situation:
I have built 14 lighting fixtures which line my driveway, each containing 6 WS2812B LEDs. The idea is that I could turn each fixture whatever color I want, (red/green for Christmas, orange and purple for Halloween, red, white, and blue for July 4th, etc.) This works just fine.

The Issue:
But what I would like to do is be able to address each fixture for easier control, as opposed to addressing each LED. I don't really need each WS2812B in one fixture to be independent of the other five in that fixture. I just would like all six LEDs to act as one unit.

Is there a way to assign addresses 0-5 to some group name?

Example:
Addresses 0-5 = Group 1
Addresses 6-11 = Group 2
Addresses 12-17 = Group 3
....

Best,
HikerDave

You have not shown us how things are wired.

Is there a way to assign addresses 0-5 to some group name?

Well it would be simpler to use numbers. But using the enum statement you can assign a range of numbers to a name.

You simply assign a range of LED numbers to each group. In your case this is easy because the first group is LEDs 0 to 5 second group is 6 to 12 and so on.

Are you using a strip of 6 LEDs in each fixture, or 6 separate LEDs (for example on those tiny PCBs)?

If the latter, you can do what you want with simple wiring. Each fixture will act like a single led, which will make your code simpler.

why no just write a small wrapper function above setPixelColor e.g. “setGroupColor” and just call the 6 pixels assigned to that group?

something like

pseudo code, untested, therefore no code tags:

void setGroupColor (byte group, uint32_t color)
{
for (byte i = 0 + group6; i<6group; i++)
myStrip.setPixelColor(i, color);
}

https://forum.arduino.cc/index.php?topic=677260.0 Post #1 might be a thing?

You have not shown us how things are wired.

I’m sorry, Larry - perhaps I wasn’t clear enough. Each fixture contains six WS2812B elements. The WS2812B’s are wired in the standard way (data from Uno to Din on the first WS2812B, Dout from that to Din on the next one, etc.) Think of it as an led tape of WS2812b’s, with long jumpers between units 6 and 7, 12 and 13, 18 and 19, and so on. Clear as mud? :wink:

Are you using a strip of 6 LEDs in each fixture, or 6 separate LEDs (for example on those tiny PCBs)?
If the latter, you can do what you want with simple wiring. Each fixture will act like a single led, which will make your code simpler.

Paul - I am using 6 individual WS2812Bs in each fixture, but it’s more like 6 separate LEDs strung together to create a strip of 6 LEDs, (so, 18 leds total). The picture shows what is in each fixture.

Idahowalker - I hadn’t thought of breaking them into segments and calling them that way. I will try that before moving towards noisaca’s or Mike’s solutions.

And my apologies - I forgot to mention that I’m trying to write this with FastLED, as I think it is easier to write for.

Thank you all!
Best,
HikerDave

hikerdave:
I am using 6 individual WS2812Bs in each fixture, but it's more like 6 separate LEDs strung together to create a strip of 6 LEDs

My point is that if you are in control of the wiring, which you are, you don't have to wire them like that. You can wire them to act as a single led per fixture, simplifying your code.

WS2812B DM.jpg

PaulRB:
My point is that if you are in control of the wiring, which you are, you don't have to wire them like that. You can wire them to act as a single led per fixture, simplifying your code.

Mind you, you would need some insulation to jump over the "out" pads. :grinning:

And to chain the strips, you would be relying on a reasonable fan-out of the WS2812. Not specified in the datasheet! :roll_eyes:

Could be conservative and do three in parallel, 2 in series.

Ahhhh.... I did not realize that you could split the data across several units! That would make things much easier! I'm very glad to learn that. If I was home for six months and didn't learn anything, it would be a waste of a pandemic. :wink:

Thank you, gentlemen!

HikerDave

hikerdave:
I did not realize that you could split the data across several units!

Well, be sure to prototype it first. As the other Paul says, fan-out could be an issue, for example it might limit the max distance between fixtures.

Paul__B:
Could be conservative and do three in parallel, 2 in series.

I can't see any value in comprising like that, Paul. The idea was to keep the code simple by not having to group LEDs together at all. If you have to group them in pairs, you might as well group them in sixes. So if fan-out is a problem with groups of 6, the OP might as well stick to the conventional chaining and group LEDs together in the code.

PaulRB:
If you have to group them in pairs, you might as well group them in sixes.

Except that 2 is binary. You can easily do digital tricks with it. :grinning: