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

Thread: OctoWS2811 LED Library Help

  1. #1

    OctoWS2811 LED Library Help

    Hello Paul, I am working on a LED display project using 1500 LEDs and Teensy 3.1 board. I will be using 25 meters of the addressable WS2811 strips. I'm planning on making little 17x90 pixel animation video files and playing them from a micro SD card. I need a little help because this design is not rectangular. I haven't started playing around with the library in Arduino yet because I still need to order the parts and put everything together. I'm just trying to get a few simple questions answered before I begin.

    In your YouTube video, you mention that 8 different pins can drive 8 strings of LEDs simultaneously. For my project to work, the longest signal string would need to be around 220-250 LEDs long. Each string number would vary. Would I be able to control that amount of LEDs without getting voltage drops on the signal line? Since I am only allowed to make video files in rectangular format, do you have any suggestions to how I should go about it? (I attached an image at 4x resolution to show you how I want the right corners to be excluded)

    If you need me to make a diagram to further understand what I'm trying to do, just let me know. Thank you.

    **EDIT:
    I will also never be running this display on full brightness. High brightness settings will only be used in single frame bursts.
    Last edited by HauntedCircuit; 03-01-2015 at 09:04 AM.

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    23,089
    The easiest way to do this project involves treating everything as if it were a rectangle. Just create your video with black pixels in the locations that don't exist.

  3. #3
    Quote Originally Posted by PaulStoffregen View Post
    The easiest way to do this project involves treating everything as if it were a rectangle. Just create your video with black pixels in the locations that don't exist.

    I'm looking in the VideoSDcard example and it gives an area to put width and height. I'm not really sure how I would be able to create blank spots for LEDs that won't exist. Would I be able to type out some sort of array which can change the sequencing of the LEDs before the width and height get calculated?


    Attached, is a diagram showing how I want to wire it. Each signal pin will have to control a different number of LEDs. Is there any way I can manually set an array to assign each pixel their own number?

    the bottom part of the diagram shows two different examples. The one on the left shows how they are physically wired. The example on the right shows how I want to program them. So, instead of them going 1,2,3,4,5,6 I want them to go 1,2,9,10,11,12 (3,4,5,6,7,8 will not be existing LEDs).
    Last edited by HauntedCircuit; 03-01-2015 at 09:05 AM.

  4. #4
    Actually, I'm not sure if this library will be too complicated for what I need it for because I just want to play animated GIFs from an SD card. The GIF image resolution would literally be 24x87. I was looking at the adafruit website and saw a library for animated GIFs on an LED matrix. I'm not sure how well I could set it up for ws2811 strips with a weird shape like mine.

    Since your library requires each of the 8 outputs to control an equal number of LEDs, I came up with a new diagram showing how I would maybe want to wire it. Only 7 of the 8 outputs would be connected to LEDs

    If I would be able to program it like in the diagram, I would want to assign LED#1 to be pixel#175 because all of the "pixels" before #175 would not exist. Maybe someone can shoot me the code to help me out. Kind of how leds.setPixel(1, color) will make LED#1 a set color value. Maybe something to do with leds.numPixels?

    (Top example is how I would wire it, Bottom example is how it would programmed)
    Last edited by HauntedCircuit; 03-01-2015 at 09:05 AM.

  5. #5
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    23,089
    To deal with the "missing" pixels where the signal loops back to the other direction, you'll need to write code somewhere to deal with which pixels go into which positions.

    For example, if you decode the GIF to a buffer one line at a time, you could create a table for the starting index where each line gets copied into OctoWS2811's buffer.

    Using the first of those 2 diagrams for actual wiring, line y=0 gets copied starting at OctoWS2811 index 0. Because the first output drives only 1 row and the longest (ledsPerPin) is 87+85+83 = 255, you'd copy the pixels for line y=1 starting at OctoWS2811 index 255. From your diagram, the top row look like 70 pixels and the 2nd row looks like 71. So for line y=3, you'd copy the pixels into OctoWS2811 using setPixel() starting at index 255+71. Repeat for all 17 rows as you decode the GIF (likely decoding 1 line at a time to save memory).

    While this involves only simple arithmetic and storing 17 index offsets into a lookup table, getting all 17 of them right could be a challenge. I'm recommend composing a small test program where you try some very simple code to turn on a single pixel. What could be simpler? Just use leds.setPixel() and leds.show(). If the very first pixel in the line turns on, you got it right. If some other pixel turns on, try again. Repeast until you've create a known-good lookup table for the starting index of each row.

    Also, keep in mind half of your rows will be right-to-left. As you copy pixels from the GIF line buffer to leds.setPixel(), start at the correct index and decrement the index, instead of increment. Yes, another small detail, but there's only 17 rows, so even an inelegant solution can be used for knowing which rows need the index incremented and which need it decremented.

    Of course, as you decode your GIF, you'll get full-length lines. You'll need an equation or lookup table, or even just the same code copied 17 times with minor edits, to know how many of the GIF's pixels to copy into OctoWS2811's buffer (starting at the specific index you found from previous math or guess & ckeck testing).

    Hopefully you can see how this is indeed possible. Neither OctoWS2811 nor GIF format natively handles non-rectangular shape. But you can compose your code to "know" how many pixels and LEDs are actually implemented in your hardware, and how to move the data around so the desired pixels end up on the correct LEDs. It's pretty simple math, and if you don't have a taste for composing algebraic equations, since it's only 17 rows, you can easily use lookup tables or just make 17 copies of the code with the right numbers.

    When you do get it running, I hope you'll post a youtube video or at least some photos. Big LED projects are always awesome to see.
    Last edited by PaulStoffregen; 01-11-2015 at 11:09 PM.

  6. #6
    Wow Thank you! That is a lot of helpful info to get me started. I just ordered my Teensy, so I'll get started as soon as I receive everything. I'll definitely taking a lot of photos and videos of my progress.

  7. #7
    I decided to go with MOV files instead of GIF files. I found another post on this forum about someone trying to do the same thing for a non rectangular matrix. It involved editing the movie2sdcard file.

    https://forum.pjrc.com/threads/24699...ular-LED-array In this thread you gave an example line of code ledImage[i].copy(m, 10, 20, 400, 15, 0, 0, 20, 1);

    I need some help understanding this code for a 87x24 .MOV file. Using the last diagram, I want to be able to light up the very top row of 69 LEDs (going right to left) which starts on pixel #174(counting first pixel as #0) or coordinates x=0 y=2. So...I want pixel#174 to control LED#0 and continue on to pixel#242 at LED#68.

    ledImage.copy(m, 0, 2, 68, 1, 0, 0, 174, 1); This is probably wrong...but would it look something like this?

    Would I need to copy and edit this line 19 times to light up all rows? If so, what would it look like for LEDs on the odd rows? So...second row of leds is on y=3 (second data line/wired right to left) and would start at LED#139 and end at LED#69. I need coordinates x=0/y=3 all the way to x=70/y=3 to control that row of LEDs. I'm also a little confused because each of the 8 data lines is supposed to control 3 rows of pixels that are serpentined.
    Last edited by HauntedCircuit; 01-16-2015 at 02:17 AM.

  8. #8
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    23,089
    I'm not sure if Teensy can decode MOV. That's a complex format with a lot of different options and intense codecs.

    Your best option is probably using movie2sdcard.pde to convert MOV to an uncompressed binary file.

    Then you could use VideoSDcard.ino to play the binary data to your LEDs.

    As I suggested earlier, your first step is probably getting the LEDs wired up, and some simple test programs that simply turn on a single LED, so you can figure out the index for the left-most pixel in each row.

    Next, I'd try using movie2sdcard.pde and VideoSDcard.ino as-is, and get a file playing onto your LEDs, even if many of the pixels are in the wrong offsets / locations. Once that's working, it should be fairly easy to fiddle with the code, probably in movie2sdcard.pde, to move the pixels around so they end up in the desired locations on your non-rectangular array.

Posting Permissions

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