Cylinder pixel mapper design (instead of 2d Matrix)

I am finishing up a project I’d had on the back burner all pandemic, and realized it would look much better as a cylinder / cylindrical shape that wraps than as a 2D matrix (with a left and right side). I’d like to use the 2D function calls, but for the edges to wrap around. (I’d also be glad to use a 3D function call if that works better).

Any easy suggestions for how to do that? The closest example I found was https://newscrewdriver.com/2019/07/04/pixelblaze-pixel-map-for-led-helix/ .

The project is a coat wired into a zig-zag with the wiring going down one column, then up the next column, and back down the third, and so on.

Each column has 11 LEDs, and there are 15 total columns for 165 total pixels.

There are two columns on each front lapel, and 11 columns on the back. When I test-assembled it, I realized that having the “edge” of the pattern at my sternum was distracting and less cool than a cylinder where patterns could wrap around my entire body. (The patterns right now are fire burst / fireworks style effects and basic sound reactive effects, not that it matters to the root question).

Thank you. Wiring diagram is below, followed by a look at the actual wiring in the coat linking I was installing today, with a cat tax as well.

1 Like

Hi @ZacharyRD,

Anything in this post help?

See also

2 Likes

Thank you – I think that first link, to Cylinder Pixel Map and specifically the reply by @Scruffynerf that you quoted is doing the same think I want to do – a cylinder comprised of zig-zagging columns of LEDs, and the once I have the math right, I can just use any 3D render call.

Pasting that here as code, from @Scruffynerf’s original post, and I think all I have to do is replace “strands” with 15 and pixPerRing with 11, and use that code in my 3d render function:

function (pixelCount) {
  var map = [];
  var strands = 16;
  var pixPerRing = 14;
    for (strand = 0; strand < strands; strand++) {
      for (i = 0; i < pixPerRing; i++) {
        c = strand / strands * Math.PI * 2
        if (strand % 2) {
          map.push([Math.cos(c), Math.sin(c), i ])
        } else {
          map.push([Math.cos(c), Math.sin(c), pixPerRing -1 - i ])
        }
      }
    }
  return map
  
}
2 Likes

Let me know if it doesn’t work for you.