Help pixel mapping on steps

Has anyone written some similar code or can someone point me in the right direction?
I have an installation of LEDs under the treads of irregular (architecturally offset) stairs. I am trying to pixel map them. The LEDs are not visible directly (they are in a recessed channel), so I can’t use an image mapper. I am calculating a data structure with the following for each step: [StripID, PixelblazeExpanderPin, StartX, NumPixels, Y, Direction, OffsetPixelsInCircuit].
All LEDs in the project are 60/m. Increasing X goes west, Y goes north.
I have 42 strips on 11 circuits on 2 different output expanders. I want to get a rough draft of a pixel mapping pattern but I’m very rusty in JS and I’ve never done world coordinate mapping before.
Potential items to consider are that 2 steps are significantly offset in the -X direction. Will that greatly expand the calculations or memory needs? Also since they are steps with a landing and a bench they are not quite in a plane. Should I map them as 3D with a Z coordinate being elevation, or is that just unnecessary?
As a bonus, are there tester patterns I could use to make sure I correctly counted the number of pixels in each strip and the offset for each strip? I would not be surprised if I made a mistake counting or measuring.

Sounds doable , but I’m having trouble visualizing the layout. Can you sketch it up?

Thanks for your help.
I am trying to understand what I need the mapping function to do, given that I have 2 expansion boards sending data to 12 LED runs. Each run goes to 2-5 steps in a way that makes roughly equal numbers of pixels, where the wiring goes in a zigzag pattern. I am including a piece of the architectural drawings:Stair Architecture
I also have a photo of me standing on the installation
Google Photos
As you can see the pixels reflect light so they are not directly visible. Thus I am building a mapping.
Here are some specific questions that should let me generate a mapping:

  1. Does the order of pixels matter or is there some magic that I am missing?
  2. Does the order of pixels on the funtion’s output “map” need to match the order of pixels as determined on the settings page or some other order?
  3. Do the expansion boards also go in order 0,1,…? So that if I have 100 LEDs on board 0, indexed 0 - 99, does that make the first pixel on board 1 have index 100?
  4. Does it affect the pixelblaze speed and smoothness if I use an explicit mapping of all 3421 pixels or write a javascript function? Either is fine, but I wonder about performance.
  1. Yes. The order of pixels has to match.
  2. Yes. The map data indexes should match the pixel index bars on settings and wiring.
  3. With expansion boards, the start index and count are under your control, and thus all physical pixel indexes can be controlled. The address of the board and the channel don’t matter, except that the auto button will assign sequential addresses for channels. But you can set that up manually if needed. You’ll want to make sure you don’t overlap addresses, and that you don’t have any gaps.
  4. No, this mapper code is run once in browser and they both result in the same map as far as PB is concerned.

Very cool stairs!

To map, I’d get pixel indexes sorted out so that you have a sequential contiguous pixel address space, will make it easier to reason about in the map.

Then id make a function that added pixels for a single stair that took a length in pixels (you mentioned they are roughly but not exactly the same length) and an x offset to account for the wobble.

Then for each stair in order, call the function with the length and offset for the stair. Alternatively these 2 parameters could be put in an array literal, and the function called programmatically.

1 Like