Max WS2812 pixels than can be used in Mega2560

What is the max WS2812 pixels than can be used with one Mega2560?

Hi,

The Neopixel and Fastled libraries both require 3 bytes of ram per led, plus some overheads, if i remember. Mega2560 has 8K bytes of ram, so in theory you could control over 2,500. But I expect you would encounter other limitations long before you get to that limit. For example the update rate would become very slow because of the Mega’s maximum speed.

Paul

And just in case you ever became confused, you cannot power the NeoPixels from the 5V output of the Arduino Mega 2560 though you could power the Mega 2560 from the same power supply as the NeoPixels if it is adequately rated and fully regulated.

@PaulRB.

Yep it is 8KB. so at a glance it will be better to use the AtMega1284P instead as it is 16KB ram and 20mhz. wonder if the flash memory will have something to do... What if I want to cascade some of these to reach up to 20K pixels?

Yes I know that it will become a really hugh display and possibly a headache project (I think something like 1mX1.5m) but this challenge keeps me excited and at the end, I already managed to build a 60x40 pixel matrix, but I am trying to build my own cinema as I keep learning this great stuff. You know this...

Wonder if there is a useful link over here to learn about cascading micros.

Also, as a rookie, I wonder also if there is another type of RGB Led that can be used standalone along with any given controller (as the ws2811) but that can control the same qty of LEDs (20k).

I barely remember in my student days I did an animation just using a 555 clock, some buffers and an eeprom. I don´t know if it will be the same process but to show movie animations instead.

@Paul__B

Yes. I lerned this the hard way. Also I am getting into account this for the final design. (I am planning to make a PCBa with all the needs to control and power up this screen).

Thanks both.

If you want to use the LED strip to make a video display then the Mega is not going to be fast enough.

The Teensy 3 however, has a project on their web page that does exactly that.

DarthVic:
better to use the AtMega1284P... What if I want to cascade some of these to reach up to 20K pixels?

Still not anywhere near fast enough. Like Mike says, you need to be looking at a Teensy 3.1, or maybe a Mapple Mini clone, but if it were my project I would be looking into Raspberry Pi or something like that.

DarthVic:
I wonder also if there is another type of RGB Led that can be used

Have a look at APA104 leds. Similar concept to WS2812B, but with a faster PWM frequency, which may be important for video, and a faster data speed. The APA104 have separate clock and data lines, which may allow you to connect them to the SPI outputs of your controller. The WS2812B have a combined clock & data line, which makes data transfer slower, as I understand it.

There’s also WS2803, supports 6 RGB LEDs, and WS2801 for single RGB LEDs.
Both can load data at 8 MHz clock with SPI transfer and SPI clock divisor set to 2.

WS2801.pdf (423 KB)

WS2803-preliminary-En.pdf (437 KB)

but with a faster PWM frequency, which may be important for video, and a faster data speed.

The faster PWM on the LEDs is only useful if you are moving the LEDs, that is on something like a hoop:-

More than +-1k WS2812 on one data line makes no sense because of the lame update speed.

For large installations use APA102 and parallel output from an ARM processor like on a Teensy 3.1 (120 MHz, 64kB RAM...). And it's cheaper than a Arduino Mega2560 by the way.

Cheers,

H.

P.S. Say hello in the FastLED G+ community in case you are serious about your project.

Raspberry Pi 2 B has impressed me. I will follow this even is more expensive than the others. My kit is in route now.

I am seeing now the big constraint at the LED controller (Saw that most of the APA102/4 and also the WS2812 use the WS2811 chip controller.

WS2801 has its own clock input (what is the max clock those LEDs can support?).

How in any case, can I increase the refresh rate?

@Helmuth

I am very serious, as the biggest the screen, as the better for my ego :slight_smile:

Thanks all!

Note you can not use the Raspberry Pi 2 for driving these LED strips the drivers only work with the Pi 1 models.

RasPis are useless for driving clockless chipsets. The can not provide the constant tight timing on the data line.

Saw that most of the APA102/4 and also the WS2812 use the WS2811 chip controller.

Wrong. The protocol from the APA104 is similar but not the same like on the WS2811. And it is definetly a different chip.

Yes, WS2812 is WS2811 based. APA102 is entirely different (but similar to LPD8806...)

Clocked APA102 I drove (short strands) sucessfully with 20+ MBit on the clockline. For large installations +-8 MBit seems to work reliable.

WS2801 has its own clock input (what is the max clock those LEDs can support?).

Datasheet says 25 MHz, but it's a theoretical thing. With just a bunch of leds it might work but with 100+ leds you have no chance to drive them that fast. In the FastLED community you find very long discussions about the unexpected problems that will occur and ways how to fix them. It's not trivial.

How in any case, can I increase the refresh rate?

A) By using a fast led chipset. Clocked ones are way faster then the clockless stuff which is limited to 800 kBit.
B) By having as few leds as possible on one data line and drive several data lines parallel instead. You need an ARM based platform to do so.

I am very serious, as the biggest the screen, as the better for my ego :slight_smile:

I so get this. But in order to have a big, fast AND working matrix i recommend to start with something smaller. It's not as easy as it seems. Your questions show that you have very little experience yet - so improve your skills and knowledge step by step.

Again: The FastLED community on G+ and the PJRC Forum from Paul are the best places to get help for this kind of project or - for now - to realize which challenges you will have to face.
There are a lot of people arround who already build LARGE setups. You find me on both recommended places, too.

Helmuth aka Stefan Petrick

Helmuth:
RasPis are useless for driving clockless chipsets. The can not provide the constant tight timing on the data line.

Wrong.

There is a driver by AdaFruit that uses the shift register combined with the DMA controller block to produce flawless background output of very tight timing constraints. The problem is that it has not been updated to the new processor in the Raspberry Pi 2.

For an example see the August issue of the MagPi which has two articles relating to using these LEDs with the Pi. One from Simon Monk and the other from myself.

My video is here:-
String Pong

Thanks Mike, very interesting, that's new to me. Is there any known way for parallel output, too?

Helmuth:
Is there any known way for parallel output, too?

Not sure what you mean.

I mean, it's nice to be able to drive one strand of leds on a Raspi.

The more leds I have in one strand - the less fps I get, right?

So people tend to use different strands on different data-pins and write them at the same time ("parallel") in order to improve the fps.

Like Pauls Octo-adapter lib (up to 8 strands) or Daniels FastLED providing true 16/24 pin parallel output on ARM Cortex M4.

If the computing power and RAM of a Raspi could be used to drive large led setups with many strands it would be just awesome.

Well 1000 LEDs can be updated about 30 times a second. There are not enough hardware shift register resources to get another string driver. So yes if that is not enough then look somewhere else or parallel up Raspberry Pis the Model 1s are quite cheap at the moment.

I agree that 30 fps are enough for many applications.

Personally I found that 200 fps is not enough for really snappy light-to-sound animations or for really smooth transitions which need temporal dithering to get rid of the 8 Bit/color limitation. For POV displays we talk about kfps. But yes, these are very special usecases.

It would be a different topic and discussion.

I just read the question

What if I want to cascade some of these to reach up to 20K pixels?

and that is simply impossible with one long strand.

That’s why I came up with the general parallel driving recommendation. The Octo board is meant to be cascaded AND output to parallel strands for large installations. Here a 60x32 video wall from Paul.

How to provide and distribute up to 1200A power consumption for 20k leds would be another interesting challenge…

Grumpy_Mike:
Note you can not use the Raspberry Pi 2 for driving these LED strips the drivers only work with the Pi 1 models.

I'll find something to play with it then. In route a Pi 1.

Helmuth:
RasPis are useless for driving clockless chipsets. The can not provide the constant tight timing on the data line.

I so get this. But in order to have a big, fast AND working matrix i recommend to start with something smaller. It's not as easy as it seems. Your questions show that you have very little experience yet - so improve your skills and knowledge step by step.

The fact is that I already have up and running a 40x30 matrix using 60led/m WS2812S (1200 LED). I am able to display very blur swf files using my Mega2560 and playing with the swf resolution I made it to see what I exepect.

Helmuth:
How to provide and distribute up to 1200A power consumption for 20k leds would be another interesting challenge...

Yes, there I will have to overhaul my power electronics skills.

At the end, just look at some advertising displays over aliexpress (really expensive BTW) and found an image of what I am trying to do:

I am even thinking if this kind of LED cotroller (or something similar) can be used through a video shield.

So the basic is that it can be done, the 'how', is the challenge and this is why I am here.

Really thanks for your inputs, I expect to have it up and running in no more than a month, (plus the shipping times for the goods).

I am just devouring the readings and will be back.

Please keep posting your inputs.

I am able to display very blur swf files using my Mega2560 and playing with the swf resolution I made it to see what I exepect.

Sounds like there is some Gamma-Correction needed.

If you do so you might find, that it sucks to have only 8 Bit/color - it causes a lack of perceived color resolution the closer you come to black. If your fps allow it, try temporal dithering to improve the dark colors.

Btw: Diffusion matters a lot for such displays. Try some thin paper or - way better - translucent acrylic in front of your leds. Something between 5 and 15 mm distance uses to look great.

Here an example of my 32x32 with and without diffusion. The animations you see are real time calculated on an overclocked Teensy 3.1. They run all with more than 200 fps. The leds are gamma corrected and use temporal dithering, too.

P.S. The flickering in the video is caused by an interference between the multiplexed leds and the cameras fps. In reality it looks just smooth and soft.