# Concentric Rings/Circle Mapping

**URL:** <https://forum.electromage.com/t/concentric-rings-circle-mapping/649>\
**Category:** Patterns and Code\
**Created:** [October 16, 2020, 10:59pm UTC](https://forum.electromage.com/t/concentric-rings-circle-mapping/649 "2020-10-16T22:59:14Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Scruffynerf](https://forum.electromage.com/letter_avatar_proxy/v4/letter/s/34f0e0/32.png) [@Scruffynerf](https://forum.electromage.com/u/Scruffynerf)\
**Post date:** [October 16, 2020, 10:59pm UTC](https://forum.electromage.com/t/concentric-rings-circle-mapping/649/1 "2020-10-16T22:59:14Z")

</div>

I have a few led rings that are concentric, and actually just ordered a 241 led circle set, the biggest I had was 93 leds so far. Figured I’d write this once, for all cases.

Here’s a generically written, and hopefully easy to understand mapper:

```
function (pixelCount) {
  var map = [];
  // put # of pixel in each ring here, starting center outward
  // use 0 to add an empty ring for spacing
  var rings = [1,8,12,16,24,32]; 
  var numberofrings = rings.length;
  var inwardwired = 1; // if outward, set to 0
  // it's far easier to calculate this mapping going outward, 
  // but if lights are wired inward, we'll reverse at the end
    
  for (ring = 0; ring < numberofrings; ring++) {
    if (rings[ring] == 0) {
      // no ring, just for spacing
    } else {
      if (rings[ring] == 1) {
        map.push([0,0]);
      } else {
        for (i = inwardwired; i < rings[ring] + inwardwired; i++) {
          c = i / rings[ring] * Math.PI * 2
          // To change the initial start pixel location from 12 o'clock,
          // or the spin direction (clockwise or counterclockwise)
          // adjust +/-sign(s) (for 180 + spin) 
          // and/or swap sin/cos locations (for 90/270 start points)
          map.push([0 - Math.sin(c) * ring, 0 - Math.cos(c) * ring])
        }
      }
    }
  }
  
  if (inwardwired) {
    return map.reverse(); //flip the map, so pixel order runs inward
  } else {
    return map; // outward is correct
  }
}

```

![rings](https://forum.electromage.com/uploads/default/original/1X/77ad0027c10d587b787908278b836c1f69dc4177.png)

---

<div class="post-metadata">

**Author:** ![Scruffynerf](https://forum.electromage.com/letter_avatar_proxy/v4/letter/s/34f0e0/32.png) [@Scruffynerf](https://forum.electromage.com/u/Scruffynerf)\
**Post date:** [October 17, 2020, 2:08am UTC](https://forum.electromage.com/t/concentric-rings-circle-mapping/649/2 "2020-10-17T02:08:21Z")

</div>

Hey @wizard can you explain Polar mapping?  
I don’t see any documentation except for the mention and example(s) here at [https://www.evilgeniuslabs.org/fibonacci128#pixelblaze-maps](https://www.evilgeniuslabs.org/fibonacci128#pixelblaze-maps)

Nothing on your mapping page on your own website…

Sounds like that would be super useful.

---

<div class="post-metadata">

**Author:** ![devoh](https://forum.electromage.com/letter_avatar_proxy/v4/letter/d/c5a1d2/32.png) [@devoh](https://forum.electromage.com/u/devoh)\
**Post date:** [October 17, 2020, 2:54pm UTC](https://forum.electromage.com/t/concentric-rings-circle-mapping/649/3 "2020-10-17T14:54:45Z")

</div>

LOL, I was just writing a reply to check out Jason Coon… I see you are already aware of his stuff. His stuff looks hypnotic to me. I think I am putting a [https://www.tindie.com/products/jasoncoon/fibonacci256-166mm-disc-with-256-ws2812b-rgb-led/](https://www.tindie.com/products/jasoncoon/fibonacci256-166mm-disc-with-256-ws2812b-rgb-led/) on my Christmas list 🙂

---

<div class="post-metadata">

**Author:** ![jeff](https://forum.electromage.com/user_avatar/forum.electromage.com/jeff/32/3473_2.png) [@jeff](https://forum.electromage.com/u/jeff)\
**Post date:** [October 17, 2020, 9:17pm UTC](https://forum.electromage.com/t/concentric-rings-circle-mapping/649/4 "2020-10-17T21:17:44Z")

</div>

Hi! Re: polar maps, I know you asked Wizard to explain, but I think I know what’s going on and can give it a try.

Wizard’s shown me a few times how you can use pixel maps as a generalized per-pixel attribute dictionary. For example, there was the recent thread where, if it was a 2D map, you could store extra information in ‘z’, such as a per-pixel brightness coefficient.

I think a polar map just means that you write a map such that the first per-pixel array element (normally `x`) stores r (distance), and `y` stores phi (angle). It won’t render correctly in the Mapping tab’s preview anymore, but you can consume it in a render2D as `render2D(index, r, phi)`. Circles, spirals, and Spirograph-esque stuff would be a little faster than using the trig transforms.

Thanks for the big circular maps!

---

<div class="post-metadata">

**Author:** ![Scruffynerf](https://forum.electromage.com/letter_avatar_proxy/v4/letter/s/34f0e0/32.png) [@Scruffynerf](https://forum.electromage.com/u/Scruffynerf)\
**Post date:** [October 17, 2020, 10:29pm UTC](https://forum.electromage.com/t/concentric-rings-circle-mapping/649/5 "2020-10-17T22:29:27Z")

</div>

Awesome, I sorta kinda was wondering if it was exactly like that, “abusing” pixel attributes that way. I’ll have to play with it. I keep finding areas barely hinted at in the existing examples.

I got in the 241 led circle array and Wow, it’s nice, especially for a meager $30 from Amazon.

---

<div class="post-metadata">

**Author:** ![jeff](https://forum.electromage.com/user_avatar/forum.electromage.com/jeff/32/3473_2.png) [@jeff](https://forum.electromage.com/u/jeff)\
**Post date:** [October 17, 2020, 10:43pm UTC](https://forum.electromage.com/t/concentric-rings-circle-mapping/649/6 "2020-10-17T22:43:39Z")

</div>

@Scruffynerf Please stop making me aware of [new LED products](https://smile.amazon.com/gp/product/B083VWVP3J/ref=ox_sc_act_title_2?smid=A1ON111AEWFN60&psc=1) at good prices. I compulsively purchase them with no project in mind.

---

<div class="post-metadata">

**Author:** ![Scruffynerf](https://forum.electromage.com/letter_avatar_proxy/v4/letter/s/34f0e0/32.png) [@Scruffynerf](https://forum.electromage.com/u/Scruffynerf)\
**Post date:** [October 17, 2020, 11:00pm UTC](https://forum.electromage.com/t/concentric-rings-circle-mapping/649/7 "2020-10-17T23:00:16Z")

</div>

I have no idea what you’re talking about. 😉

---

<div class="post-metadata">

**Author:** ![Scruffynerf](https://forum.electromage.com/letter_avatar_proxy/v4/letter/s/34f0e0/32.png) [@Scruffynerf](https://forum.electromage.com/u/Scruffynerf)\
**Post date:** [October 18, 2020, 10:15am UTC](https://forum.electromage.com/t/concentric-rings-circle-mapping/649/8 "2020-10-18T10:15:59Z")

</div>

Jason’s latest: micro using tiny LEDs

[https://www.reddit.com/gallery/jd0b5l](https://www.reddit.com/gallery/jd0b5l)

---

<div class="post-metadata">

**Author:** ![devoh](https://forum.electromage.com/letter_avatar_proxy/v4/letter/d/c5a1d2/32.png) [@devoh](https://forum.electromage.com/u/devoh)\
**Post date:** [October 19, 2020, 2:18am UTC](https://forum.electromage.com/t/concentric-rings-circle-mapping/649/9 "2020-10-19T02:18:00Z")

</div>

Did you read the part where he was using a microscope to place them?!

---

<div class="post-metadata">

**Author:** ![Scruffynerf](https://forum.electromage.com/letter_avatar_proxy/v4/letter/s/34f0e0/32.png) [@Scruffynerf](https://forum.electromage.com/u/Scruffynerf)\
**Post date:** [October 21, 2020, 11:20pm UTC](https://forum.electromage.com/t/concentric-rings-circle-mapping/649/10 "2020-10-21T23:20:22Z")

</div>

Just as a pointer to piles of neat info, related to the above

> **[r/FastLED - Are there any FastLED Patterns/Libraries for these 241 LED Rings?](https://www.reddit.com/r/FastLED/comments/hg6nfp/are_there_any_fastled_patternslibraries_for_these/)**
>
> 27 votes and 22 comments so far on Reddit

I found a pile of patterns I expect will be trivial to port to PB (if they don’t already exist)

---

<div class="post-metadata">

**Author:** ![Scruffynerf](https://forum.electromage.com/letter_avatar_proxy/v4/letter/s/34f0e0/32.png) [@Scruffynerf](https://forum.electromage.com/u/Scruffynerf)\
**Post date:** [November 12, 2020, 12:09pm UTC](https://forum.electromage.com/t/concentric-rings-circle-mapping/649/11 "2020-11-12T12:09:55Z")

</div>

> [@jeff](#):
>
> Please stop making me aware of new LED products at good prices. I compulsively purchase them with no project in mind.

@jeff, whatever you do, don’t go look at

> **[Amazon.com: BrizLabs Color Changing Fairy Lights, 66ft 200 LED Rainbow Christmas...](https://www.amazon.com/BrizLabs-Changing-Adapter-Twinkle-Bedroom/dp/B08KS4LXFD)**
>
> Buy BrizLabs Color Changing Fairy Lights, 66ft 200 LED Rainbow Christmas Fairy Lights with Remote, RGB Xmas Tree Light with Timer, Dimmable Twinkle Light Music Sync for Indoor Xmas Halloween Easter Party: Indoor String Lights - Amazon.com ✓ FREE...

3 wire, not 2 (non addressable single color) or 4 wire (non-addressable RGB), these are w2812 in a fairy wire (copper wire) setup, 66ft/200 led (so 30 led/m) also available perhaps cheaper from China (which I was going to do on 11.11 day sales, but decided to check Amazon… And yup, for next day delivery to me… Almost same price, instead of weeks of waiting? Sold.)

Ordered enough to build a massive 10x10x10 cube, and yet didn’t break the bank at all.

---

<div class="post-metadata">

**Author:** ![wizard](https://forum.electromage.com/user_avatar/forum.electromage.com/wizard/32/4_2.png) [@wizard](https://forum.electromage.com/u/wizard)\
**Post date:** [November 12, 2020, 4:48pm UTC](https://forum.electromage.com/t/concentric-rings-circle-mapping/649/12 "2020-11-12T16:48:25Z")

</div>

@Scruffynerf,  
Those don’t look like addressable LEDs. I’d expect rainbows in the previews or mentions about repurposing in the reviews. I have seen RGB 3 wire fairy wire LEDs that are in some sort of [charlieplexed](https://en.wikipedia.org/wiki/Charlieplexing) configuration, which would be enough to drive the simple patterns shown in the photos. And the price is too good to be true.

There are serially addressable fairy wire LEDs out there, but I don’t think these are it.

---

<div class="post-metadata">

**Author:** ![jeff](https://forum.electromage.com/user_avatar/forum.electromage.com/jeff/32/3473_2.png) [@jeff](https://forum.electromage.com/u/jeff)\
**Post date:** [November 12, 2020, 5:17pm UTC](https://forum.electromage.com/t/concentric-rings-circle-mapping/649/13 "2020-11-12T17:17:37Z")

</div>

Thanks for the heads up… I have something similar to share back. That link shows 200 for $20 shipped is $0.10 per pixel;

I can report decent results with [this product](https://www.aliexpress.com/item/1005001430899603.html?spm=a2g0o.productlist.0.0.1edd1ec55xtbzo&algo_pvid=59e48994-04f8-4ac4-bf3e-df215b4bf03b&algo_expid=59e48994-04f8-4ac4-bf3e-df215b4bf03b-2&btsid=0b86d81616017652923475733eb6e8&ws_ab_test=searchweb0_0,searchweb201602_,searchweb201603_) from AliExpress. WS2812, $0.12 per pixel shipped, arrived in under three weeks from my order date.

---

<div class="post-metadata">

**Author:** ![Scruffynerf](https://forum.electromage.com/letter_avatar_proxy/v4/letter/s/34f0e0/32.png) [@Scruffynerf](https://forum.electromage.com/u/Scruffynerf)\
**Post date:** [November 12, 2020, 5:50pm UTC](https://forum.electromage.com/t/concentric-rings-circle-mapping/649/14 "2020-11-12T17:50:45Z")

</div>

They are, look at the video someone posted in the reviews and watch the chase sequence. Plus I did the research and found this elsewhere (AliExpress, similar to Jeff’s link above) with more details. BTF also makes similar for $13 for 50 LEDs no controller, and $20ish for either USB or battery box controller.

I’ll have these tomorrow and will confirm and even hook it up to PB. (I really need some more PBs, I was hoping for the v3s soon ish)

---

<div class="post-metadata">

**Author:** ![wizard](https://forum.electromage.com/user_avatar/forum.electromage.com/wizard/32/4_2.png) [@wizard](https://forum.electromage.com/u/wizard)\
**Post date:** [November 12, 2020, 6:04pm UTC](https://forum.electromage.com/t/concentric-rings-circle-mapping/649/15 "2020-11-12T18:04:26Z")

</div>

Yeah that video looks like addressables! I missed that before. I’m still skeptical, but I would be happy to hear confirmation when you get yours!

---

<div class="post-metadata">

**Author:** ![Scruffynerf](https://forum.electromage.com/letter_avatar_proxy/v4/letter/s/34f0e0/32.png) [@Scruffynerf](https://forum.electromage.com/u/Scruffynerf)\
**Post date:** [November 13, 2020, 8:02pm UTC](https://forum.electromage.com/t/concentric-rings-circle-mapping/649/16 "2020-11-13T20:02:42Z")

</div>

Confirmed. Cracked open the USB controller and it’s got 2 no name/ID 8 pin ICs (plus IR, etc) and the lines are labeled L+, L- and D. Many of the 15 effects are individually addressable across the string, like color each pixel red one at a time, till the strip is red, then change each pixel one at a time to green, then all to blue etc. Will hook up to a PB shortly. Right now, the one I opened is still in 2 round bundles of 100 as I plan how to layout it out on the 12 inch sphere (ok, it’s actually 2 round wire plant hangers, but damn for $20, look at the nifty 12 inch wire sphere…) The PB will be the most expensive part of this build. It even came with a USB wall wart (5v2a)

---

<div class="post-metadata">

**Author:** ![Scruffynerf](https://forum.electromage.com/letter_avatar_proxy/v4/letter/s/34f0e0/32.png) [@Scruffynerf](https://forum.electromage.com/u/Scruffynerf)\
**Post date:** [November 14, 2020, 4:58pm UTC](https://forum.electromage.com/t/concentric-rings-circle-mapping/649/17 "2020-11-14T16:58:41Z")

</div>

I’m going to move discussion of the above very cheap string to it’s own thread, due to some technical questions.

> [@Timing of a cheap strand?](https://forum.electromage.com/t/timing-of-a-cheap-strand/739):
>
> As discussed in [Concentric Rings/Circle Mapping](https://forum.electromage.com/t/concentric-rings-circle-mapping/649/11) I found a very inexpensive set of 200 “fairy wire” addressable lights. I took the strand and attached it to my PB. the 3 wires are V+, G, Data. NOT V, D, G as usually found. I confirmed this. it’s RGB order perhaps it’s the 200 pixels, without added power at the far end (that’ll be my next trial but this was a quick and dirty setup), but it seemed VERY sensitive to timing: It seemed to prefer 333 and will light them all, but pixel 1…

---

<div class="post-metadata">

**Author:** ![Scruffynerf](https://forum.electromage.com/letter_avatar_proxy/v4/letter/s/34f0e0/32.png) [@Scruffynerf](https://forum.electromage.com/u/Scruffynerf)\
**Post date:** [December 10, 2020, 10:33am UTC](https://forum.electromage.com/t/concentric-rings-circle-mapping/649/18 "2020-12-10T10:33:23Z")

</div>

Heh, so glad I inspired Jeff to build his StarDisc.

My latest arrival on the pile of cool stuff (so many projects, and now I want to do them with videos…) is I snagged a “warehouse” (returned?) discounted (Amazon FTW) 576 pixel micro smd2020 ws2812 board, 18x32 pixels, PCB full of holes so it’s a mesh of LEDs (rigid)  
Photo when I light it up.

I also got in some NLED Photon controllers for building a set of wand poi, and the HD107 sticks arrived for that (also photos when I light them up), along with the hd107 8x8 matrix. I got enough sticks of 8 to do multiple poi, and I also got enough PBs (I own 5 now, and 4 sensors) to turn two into poi as well (long down my list). Waiting for more poi bits though.

---

<div class="post-metadata">

**Author:** ![Scruffynerf](https://forum.electromage.com/letter_avatar_proxy/v4/letter/s/34f0e0/32.png) [@Scruffynerf](https://forum.electromage.com/u/Scruffynerf)\
**Post date:** [January 31, 2021, 10:52pm UTC](https://forum.electromage.com/t/concentric-rings-circle-mapping/649/19 "2021-01-31T22:52:30Z")

</div>

Found this tip on Reddit at Jason Coons latest ring project (1628 pixels)

> **[r/FastLED - Sol v2: 420mm (16.5") wide, 1,600+ RGB LEDs wall-mounted behind...](https://www.reddit.com/r/FastLED/comments/l8tp9y/sol_v2_420mm_165_wide_1600_rgb_leds_wallmounted/)**
>
> 73 votes and 23 comments so far on Reddit

Reddit user iscor said:

I recommend adding which “ring” the pixel belongs too as “z” coordinate in your Cartesian coordinate lookup table. I found using that value \* 0.01 or so as the z value in noise adds a little extra to the standard 2D noise pattern

---

<div class="post-metadata">

**Author:** ![Scruffynerf](https://forum.electromage.com/letter_avatar_proxy/v4/letter/s/34f0e0/32.png) [@Scruffynerf](https://forum.electromage.com/u/Scruffynerf)\
**Post date:** [February 1, 2021, 4:54am UTC](https://forum.electromage.com/t/concentric-rings-circle-mapping/649/20 "2021-02-01T04:54:44Z")

</div>

Another argument for non-concentric layout:

[![](https://img.youtube.com/vi/YNojft9xKd0/maxresdefault.jpg "3D Printed Phyllotaxis 128 Using 12mm Ws2811s and Wemos D1 Mini") ](https://www.youtube.com/watch?v=YNojft9xKd0)

3d printed design, hopefully they’ll share the STL

[Next page](https://forum.electromage.com/t/concentric-rings-circle-mapping/649.md?page=2)
