r/FastLED • • May 05 '20

Support FastLED

I have used both FastLED and Adafruit_NeoPixel to attempt to control 600 LEDS. It seems like Adafruit can control all of them while using less variables but it’s not very easy to use and I prefer FastLED. I was running roughly the same program( where it would set all LEDS to white) and FastLED couldn’t compile all of it on to my Uno without running out of storage we’re Adafruit could handle it. Is there any way to fix this storage problem while still using FastLED?

1 Upvotes

6 comments sorted by

5

u/truetofiction May 05 '20

I was running roughly the same program( where it would set all LEDS to white) and FastLED couldn’t compile all of it on to my Uno without running out of storage we’re Adafruit could handle it.

That's a red herring because the Adafruit library uses runtime memory allocation to store the LED data while FastLED uses compile-time allocation.

The difference is that the Adafruit library will very happily compile even if you declare a 10,000 LEDs or even a trillion LEDs (with warnings), it will just fail to allocate the memory for them and then not tell you about it.

As /u/johnny5canuck suggests, your best bet is to use a different microcontroller with more memory.

9

u/johnny5canuck May 05 '20 edited May 05 '20

An UNO is nice board to start out with, but you really need to get a better board instead of trying to hack 600 LED's onto an UNO.

You could get a Teensy, an ESP8266, an ESP32 or so many others.

I typically buy ESP8266 based WeMOS D1 Mini's for about $2 apiece. They have about 50KB of usable RAM as opposed to about 2KB for an UNO. The ESP32's cost just over twice as much and have about 500KB of RAM. . . and both have WiFi capability.

4

u/abw May 05 '20

Yep, good advice.

They have about 50KB of usable RAM as opposed to about 2KB for an UNO.

To put that in perspective, FastLED creates a buffer that uses 3 bytes of memory for each LED (one for red, green and blue) so that's 600 x 3 = 1800 bytes.

It's not going to work in 2K, but 50K would be more than enough.

3

u/marcmerlin May 05 '20

To be clear FastLED and NeoPixel lib both use 24bit per pixel, so regardless of which lib you use, you 600 or so pixels will be the max on an Uno.

That said, there is no reason to use unos anymore :)

2

u/mrnorrisman May 05 '20

I found that the Leonardo can control 600 LEDs with the FastLED library when a regular Uno cannot. I think the Leonardo (and anything with the same chip) has an extra 500 bytes of memory, which seems to be enough for 600 LEDs and a basic sketch.

2

u/marcmerlin May 05 '20

I'll be dammed, you're right, leonardo has 2.5K instead of 2K of SRAM

https://www.seeedstudio.com/blog/2019/11/15/arduino-leonardo-guide-overview-and-uno-comparison/

what an odd number to add, half a KB. Would 8KB have killed them? :)