Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 3 of 3

Thread: OctoWS2811 pixel layout questions

  1. #1
    Junior Member
    Join Date
    Apr 2020

    OctoWS2811 pixel layout questions

    Hello and good day,

    I have been reading a lot of the examples on the OctoWS2811.

    I have a few questions.

    Every example I've seen, seems to specify height of pixels must be in multiples of 8.

    While I have found an example of masking for what this person was trying to do, it was still in multiples of 8:

    I am interested in building an audio visualizer, and due to physical space limits, I'd like to use 38 pixels as my height.

    I am planning to arrange the pixels in a vertical (up and down) orientation - where a lot of the examples of what people have built are showing pixels orientated left to right.

    Lastly, is there any magic to how the pixels are shared across the 8 outputs? From what I've read, it appears as though they simply connect to the next pair on the cat6 (blue, green, brown) - and all outputs should have equal amount of pixels.

    Thank you for your help!!


  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Yes, every output transmits the same number of pixels. So if you configure for 100 pixels per pin, the pixels transmitted by the first pin will be index 0 to 99, the pixels sent on the 2nd pin will be index 100 to 199, and so on.

    With Teensy 3.x the output is always the same 8 pins. On Teensy 4.x you can choose to send on any pins (less than 8, exactly 8, or more than 8), though the default is the same 8 pins that Teensy 3 uses. To see how to configure the pins, in Arduino click File > Examples > OctoWS2811 > Teensy4_PinList.

    You can connect any number of LEDs to any pin. Teensy does not "know" how many LEDs you really have. It just sends the pixels. Connecting more LEDs than the pixels transmitted would be rather silly, since those extra LEDs will just sit there doing nothing. But if you are transmitting 100 pixels on every pin but only need some number like 75 on a specific pin, it's perfectly fine to just connect a shorter strip of 75. The other 25 pixels just won't be seen. Imagine if you had connected 100 but covered up the last 25 with duct tape. That's exactly what will happen if you just connect 75 (except the ugly duct tape...)

    OctoWS2811 deals with index numbers. Many of the examples use an xy() function which takes 2D coordinates and compute the index. OctoWS2811 itself doesn't "know" the mapping of your LEDs, but that little xy() function does! If you want to physically arrange your LEDs some other way, just edit that code. You can do it either with algebra or with as many if-else conditions as you need.

    There is no hard rule to do things in multiple of 8. That's just commonly done because it's physically easier to build a maximum size output. But if you arrange your LEDs into 38 rows, you could connect the first 5 rows in a serpentine manner and wire that to the first output. Then the next 5 rows to the 2nd output, and so on, until you have only 3 rows left which you'd wire to the 8th output. However you actually wire the LEDs, you will need to create your own xy() function. If you connect 60 in each row, then the first 300 will be the first output, where the first 50 might be left to right, the next first right to left, and so on. The examples show how to write an xy() for this sort of serpentine, where the even rows use one equation and the odd rows use another. You would probably do something similar, but again reverse things depending on whether the y coordinate is in rows 0-4 versus 5-9 versus 10-14, etc...

  3. #3
    Junior Member
    Join Date
    Apr 2020
    Thank you so much for the info Paul!
    As I thought about the "hard rule 8", and simple math of how things will be connected, I have landed on 13 vertical strips per output, for a total of 104 strips.
    The 38 will make up the "height" and 104 "wide".

    I will need to get a few 4.x units around the lab for ongoing development.

    Appreciate the help!

    Take care,


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts