PDA

View Full Version : Very Large WS2812B LED Project Using Parts of OctoWS2811 Library Help



MatrixWriter
12-26-2013, 06:32 PM
I was told by Paul to post my questions related to the OctoWS2811 libraries here.

So I am making an LED display for my university's senior engineering project. This is my first large scale LED project for me. Nothing has been built so far as I am still in the design phase, but I hope to get some questions answered before I buy materials.

Basic idea: Need to control thousands of LEDs to run various applications such as video, displaying text, and small programs.

Specifications of the project:
1) 96 x 60 resolution (5760 LEDs!) as it needs to display text and images as clearly as possible. This is also a 16:10 display aspect ratio which is preferred for the type of applications the should be ran on it.

2) Will be using the latest Teensy boards, version 3.1 as they can each power up to 4000 LEDs.

3) Will feature a Beaglebone Black board (latest one) or a Raspberry Pi controlling the two Teensy's via USB (unless I need more Teensy board -- See 2nd question below)


Now for the part I would like some help on for the project:
1) I could not find any documentation on the forum or site on this:
How many LEDs can the Teensy 3.1 fit on each pin? Can each pin (I call it channel) do 96 LEDs in a row?

2) I understand that the OctoWS2811 is designed to run 8 strips of LEDs of equal length.
Just for ease of the project, should I buy 8 Teensy microcontrollers and assign the each row of LEDs it's own pin on the Teensy. Ex: Row #1 goes to LED 1, Row #2 goes to LED 2, and so on.

Or do I want to have some of the rows "serpentine" to the next one? Wouldn't this make the video display complicated or does the library know how to do this?

Ex:
Rows #1 to #3 go to LED 1 pin
Row 1 (96 LEDs): ----------------------------------------------------------------------------
|
Row 2 (96 LEDs): ----------------------------------------------------------------------------
|
Row 3 (96 LEDs): ----------------------------------------------------------------------------


Rows #4 to #6 go to LED 2 pin
Row 4 (96 LEDs): ----------------------------------------------------------------------------
|
Row 5 (96 LEDs): ----------------------------------------------------------------------------
|
Row 6 (96 LEDs): ----------------------------------------------------------------------------

....

3) Does the number of LED pixels in the array have to be divisible by 8 (I know the name Octo means 8) or does the 8 refer simply refer to the fact that the library is designed ONLY to run 8 led stripes up equal length with up to 4000 LEDs on Teensy 3.1? This is sort of redundant somewhat to question #2.

4) Going off the response from questions #2 and #3, should I change the resolution to a factor of 8? So instead of 96x60 should be 96x64? Just note that the slight resolution change increases the LED count as well as power/cost by a ton!

5) How do you know what size resistor to put on the data line of the WS2812 LEDs when attaching to the Teensy board.
You mention values between 47 ohms to 220 ohms. Should I use an oscilloscope to measure or is that LED count (as well as wiring) dependent - or is it based on experimentation?

6) Last question: can the Teensy boards be controlled from a main controller board such as a Raspberry Pi or Beaglebone? I see people mentioning it but haven't really seen good answers unless someone can redirect me to the page.
I want to basically hook up the Teensy boards to one main board where the main board will end up interfacing with a PC (or mobile device). The main board shall convert the commands from the PC and then send it out to the Teensy boards.
The Teensy boards in my case are simple used to convert the user input into the code where the Teensy board does the actual running and output to the LEDs.
I just think this layout is cleaner for my application and I can send all the code to one place. Is this even possible?
I am missing something such as you only send code to one Teensy board and the video frame sync port will have the other boards run? Or do I have to end up having to load code to every single board? Help!?


Sorry for so many questions as I am new to this stuff. I appreciate any help and feedback that anyone has to offer.
If there are more questions, I'll post.

Here is a diagram of what I want my system to be like.

PaulStoffregen
12-26-2013, 08:44 PM
Now for the part I would like some help on for the project:
1) I could not find any documentation on the forum or site on this:
How many LEDs can the Teensy 3.1 fit on each pin? Can each pin (I call it channel) do 96 LEDs in a row?


Teensy 3.0 is recommended for up to 1000 LEDs, and 3.1 up to 4000 (though 3.1 is quite new and 4000 is untested).

For 1000 LEDs on 8 pins, that's 125 per pin.




2) I understand that the OctoWS2811 is designed to run 8 strips of LEDs of equal length.
Just for ease of the project, should I buy 8 Teensy microcontrollers and assign the each row of LEDs it's own pin on the Teensy. Ex: Row #1 goes to LED 1, Row #2 goes to LED 2, and so on.


Presumably you're asking about the VideoDisplay & movie2serial example that comes with OctoWS2811?

It's well documented on the OctoWS2811 page (http://www.pjrc.com/teensy/td_libs_OctoWS2811.html). Scroll down to "VideoDisplay Example Program".



Or do I want to have some of the rows "serpentine" to the next one? Wouldn't this make the video display complicated or does the library know how to do this?


This stuff is explained on the web page. Please look again. This image shows the recommended ways to connect more than 1 row to each pin:

http://www.pjrc.com/teensy/td_libs_OctoWS2811_6.png

You set LED_LAYOUT to indicate if the rows begin left to right, or right to left. If the width of the display is shorter than the strip length, then movie2serial assumes a multiple row zig-zag arrangement, as shown in this image.

Please, re-read the web page. It's all explained in detail.


These comments from the VideoDisplay code have the more info:



// The actual arrangement of the LEDs connected to this Teensy 3.0 board.
// LED_HEIGHT *must* be a multiple of 8. When 16, 24, 32 are used, each
// strip spans 2, 3, 4 rows. LED_LAYOUT indicates the direction the strips
// are arranged. If 0, each strip begins on the left for its first row,
// then goes right to left for its second row, then left to right,
// zig-zagging for each successive row.
#define LED_WIDTH 60 // number of LEDs horizontally
#define LED_HEIGHT 16 // number of LEDs vertically (must be multiple of 8)
#define LED_LAYOUT 0 // 0 = even rows left->right, 1 = even rows right->left

// The portion of the video image to show on this set of LEDs. All 4 numbers
// are percentages, from 0 to 100. For a large LED installation with many
// Teensy 3.0 boards driving groups of LEDs, these parameters allow you to
// program each Teensy to tell the video application which portion of the
// video it displays. By reading these numbers, the video application can
// automatically configure itself, regardless of which serial port COM number
// or device names are assigned to each Teensy 3.0 by your operating system.
#define VIDEO_XOFFSET 0
#define VIDEO_YOFFSET 0 // display entire image
#define VIDEO_WIDTH 100
#define VIDEO_HEIGHT 100

//#define VIDEO_XOFFSET 0
//#define VIDEO_YOFFSET 0 // display upper half
//#define VIDEO_WIDTH 100
//#define VIDEO_HEIGHT 50

//#define VIDEO_XOFFSET 0
//#define VIDEO_YOFFSET 50 // display lower half
//#define VIDEO_WIDTH 100
//#define VIDEO_HEIGHT 50



The actual code that transforms ordinary pixels into the format for OctoWS2811 is in movie2serial. Here's the relevant code:



// image2data converts an image to OctoWS2811's raw data format.
// The number of vertical pixels in the image must be a multiple
// of 8. The data array must be the proper size for the image.
void image2data(PImage image, byte[] data, boolean layout) {
int offset = 3;
int x, y, xbegin, xend, xinc, mask;
int linesPerPin = image.height / 8;
int pixel[] = new int[8];

for (y = 0; y < linesPerPin; y++) {
if ((y & 1) == (layout ? 0 : 1)) {
// even numbered rows are left to right
xbegin = 0;
xend = image.width;
xinc = 1;
} else {
// odd numbered rows are right to left
xbegin = image.width - 1;
xend = -1;
xinc = -1;
}
for (x = xbegin; x != xend; x += xinc) {
for (int i=0; i < 8; i++) {
// fetch 8 pixels from the image, 1 for each pin
pixel[i] = image.pixels[x + (y + linesPerPin * i) * image.width];
pixel[i] = colorWiring(pixel[i]);
}
// convert 8 pixels to 24 bytes
for (mask = 0x800000; mask != 0; mask >>= 1) {
byte b = 0;
for (int i=0; i < 8; i++) {
if ((pixel[i] & mask) != 0) b |= (1 << i);
}
data[offset++] = b;
}
}
}
}


This stuff is all on the website or in the actual code.

PaulStoffregen
12-26-2013, 09:04 PM
If you read many other OctoWS2811 threads on this forum, you'll see a consistent theme: powering such a large LED array is quite a challenge. You should plan on locating the power supplies as close to the LEDs as possible, and use large wires. Running 6 to 10 feet (or more) of wire between the power supplies and LEDs rarely works. Even with short wires, the current is very high, so many separate wires are usually needed, often #18 or larger. Don't underestimate the wire size requirements!

The other thing that can really help, or prevent problems, is the 74HCT245 buffer to get the signals up to 5V. This is documented on the OctoWS2811 page. It's so cheap compared to everything else, so I'd suggest you plan on using the buffer from the beginning.

MatrixWriter
12-27-2013, 01:29 AM
Hi Paul,

Thanks for the answers to my question. Much appreciated. I figured that I might be able to use this PSU:
http://www.usledsupply.com/shop/5v-300w-5-60a-power-supply-mean-well-hrpg-300-5.html

So I'll probably have to use 7 PSUs - that's alot. As mention in the forum, LEDs do use quite a bit of power - I'm surprised.
I'll use very thick wiring and I plan to have the PSUs behind the array to reduce wire distance.

As for the 74HCT245 buffer, do I really need to use it if I decide to go with the Teensy 3.1 and a solid 5V PSU? I figured that the buffer was only for the 3.0 board.


Also, for testing out the resistance needed between the data line that connects from the Teensy to the LED row what is a good method to test out for resistance. I notice that 47-220 ohms is mentioned and that you did use a scope to measure the signal.

http://forum.pjrc.com/threads/15620-WS2811-on-Teensy-3-0-using-FastSPI_LED-library/page4

Should I simple hook up the array to a scope and test out different resistance values between 47-220 ohm that will give me the least noise?


Also, I'm still a little confused about when I use multiple Teensy boards and a Beaglebone. When I use the Beaglebone as the main controller and the Teensy's basically control the LEDs with the OctoWS2811 library, do I have to connect every single Teensy board (obviously there isn't enough USB ports on the Beaglebone unless you use a hub) to the main controller.

Or is it just simply I use the video frame sync pin #12 and it will sync all the boards together and I only connect one board to the Beaglebone?

Headroom
12-27-2013, 01:28 PM
I'd say yo need the buffer chips. The Teensy 3.1 is a 3.3V board. While it's INPUTS are 5V tolerant that does not mean that its OUTPUTs will supply 5V. Even if it would be somewhat workable at 3.3V the signal to noise ratio is better at 5V.

I'd suggest that you start inhaling and digesting all the info that is in the extensive online documentation that has several links to very detailed forum threads. That will answer many of your question.

PaulStoffregen
12-27-2013, 07:06 PM
Usually 3.3 volt signals work with a small number of LEDs.

Sometimes they work with larger numbers. When I built the 1920 LED test board for developing OctoWS2811 (the one you see in the photos on the OctoWS2811 web page), it had trouble without the series resistors. I added 220 ohm resistors and all but one worked great. I changed that one to 100 ohms and it started working.

But many large scale projects have more trouble with the 3.3V signals. How your ground wires are arranged can make a tremendous difference. The larger the project and the longer your wires, the more trouble you're likely to encounter. My test board had relatively short data wires and 32 separate pairs of #22 wire to the three power supplies.

If you're connecting thousands of LEDs, I would highly recommend using the 74HCT245 buffer *and* plan on resistors between the '245 output pins and wires to your LEDs. That might end up being overkill, but it's so cheap and small compared to everything else, and relatively easy to do while you're still building stuff on your desk (versus trying to troubleshoot at the large installation). Don't skimp on the cheapest and easiest part that can make your project much more reliable.

MatrixWriter
12-28-2013, 12:49 AM
Thanks for all the responses! I see why the buffer is important. I think I know what I need to do.

I'll post a photo of the project when it is completed. Now time to order the Teensy boards :D !

tetsuo
01-02-2014, 03:20 PM
Running 6 to 10 feet (or more) of wire between the power supplies and LEDs rarely works. ... Don't underestimate the wire size requirements!

In my current iteration of my (apparently never-ending) project, I ended up running multiple 4AWG conductors to cover most of the distance and then breaking that out into multiple 16AWG pairs for the strips. I'd started with 2AWG (which was technically what I needed to keep the drop under 5%) but try as I might, I could not make everything fit in the rather limited space I had available. Anyway, run the numbers before you buy the wire! http://en.wikipedia.org/wiki/Voltage_drop#How_to_calculate_voltage_drop or http://www.calculator.net/voltage-drop-calculator.html?material=copper&wiresize=0.5127&voltage=5&phase=dc&noofconductor=1&distance=10&distanceunit=feet&amperes=50&x=41&y=17


Anyway, here are some other considerations regarding making the WS2812b's happy in less-than-ideal voltage situations:

- the voltage at the strip is LESS IMPORTANT than the voltage difference between DIN and the strip power. For example, at my furthest strips where conductor gauge and load really become a big issue, voltage drops to 4.6V under full load but is 5.2V-5.3V otherwise. I found that if I lowered the Vcc of the 74HCT245 to 4.6V, I eliminated flickering in those strips.

- you could potentially alter the voltage of each 74HCT245 individually, but I've found that 4.6V works for the entire range of 4.4V-5.5V at the +5 of the strip.

- IMO, grounding issues will be your biggest source of problems with such a large setup. I feel like I've been playing a never-ending game of whack-a-mole where I can get 95% of the array working beautifully, only to find that one strip flickers. change where/how that strip is grounded, and the flicker moves somewhere else.

In any case, as a fellow large-project attemptee... I wish you the best of luck!

matt79
03-04-2014, 02:54 AM
I just got my WS2812B LED (http://www.ledlightinghut.com/ws2812-5050-rgb-led.html) and Teensy 3.1 board. It looked pretty simple to do with the OctoWS2811 lib. I got the Basic RGB LED Test for the lib loaded without difficulty. I wired pins 15 and 16 together hooked up the NeoPixel strip (just 10) with D1 on pin 2. I'm powering the whole thing from 3 D cells. When I plug it in the LEDs all flash then nothing. As far as I can tell everything should be fine but I don't see any blinking lights and I don't know where to start debuting this. Any suggestions would be much appreciated.

PaulStoffregen
03-04-2014, 09:42 AM
When I plug it in the LEDs all flash then nothing. As far as I can tell everything should be fine but I don't see any blinking lights and I don't know where to start debuting this.

Maybe post a photo of what you've wired up? Are you using the 74HCT245 buffer chip?

You mentioned a "NeoPixel strip" but posted a link to what looks like the raw LEDs.