Best library for ledstrips

Hello,

Im about to start a project where I want to control 36 indiviual leds, based on an input value (on/off)
Hardware wise I was thinking about getting an rgb ledstrip and program every indiviual led.

I know fastled is a common used library, but I am wondering what library is best for controlling indiviual leds on a ledstrip?

Thanks for your advise.

How good are you at programming? Adafruit's library is slower than FastLED but contains more 'guardrails' for sloppy programming, I've heard.

Not very good.
The project will consist of two parts: read sacn (e1.31) from ethernet shield.
Then write the led:
If channel 1 is >127, led01 = green

Since my programming skills are limited, I need the easiest way to control indiviual leds.

Both libraries mentioned come with examples and just by studying them you will see what example comes close to your needs.

Think I used Fastled last time (long ago). Worked very well

As did I, until I wrote my own minimalist function to avoid library overheads, etc.
However, as we've seen in threads on this forum, beginners get into trouble with FastLED with things like buffer indices out of bounds, for example.

If our OP is comfortable with indexing arrays, controlling for loop boundaries, etc. then that particular problem isn't relevant(I know there were other risks, but I don't recall what they were). Otherwise, the OP should expose their code here early and often, so that forum members can spot when the troubles begin.
Just one opinion. There will be others, no doubt!

Another consideration is the 'approach' each library takes (examine what functions are available, for example) - one may lend itself to the OP's needs more clearly, or readily, than others. Problem is, that evaluation itself may require a level of familiarity our OP does not yet have.

1 Like

so you get DMX512 lighting data over IP and then you have a simple test to light up a led. Both libraries will be fine, Adafruit's will not crash if you try to address a LED that does not exist. With fastLed you need to ensure the led you want to target does exist within the bounds of the led array.

1 Like

Usually an application with the Adafruit_Neopixel library will crash the application if you use too many pixels and run out of memory without being informed about it by the IDE.
36 RGB pixels will need 108 bytes so you need to add that to the reported memory usage and maker sure you stay within reasonable limits.

With the FastLED library the IDE will at least report the true memory usage.

This is just a minor thing to be aware of.

They have guards against crashing - your strip won’t be allocated

1 Like

is your function available somewhere?

I find that the Fast Led library confuses beginners, and they often get stuck selecting individual colours as there are so many ways of doing this. There are other difficulties as well basically because there are many ways to do most things.

Personally I find the Adafruit library the simplest to use on an Arduino.

What board were you intending to use ?

  • For an AVR (UNO, Mega, Nano, Pro-mini etc. Adadfruit_Neopixel or fastLED will work just fine with minor differences

They both bit-bang the signal, (which is the only way really on those7 processors) and the vast majority of the processor time is spent doing that, and they both do it real-time from the pixel-buffer. I don'y think there is any difference in speed.

  • For an ESP (32 or 8266) Makuna Neopixelbus is the best in my opinion. It's I2S method is in the background making sure WiFi remains stable.
  • Other processors ? Probably again Neopixelbus, but FastLED will also have usable methods.

Which ethernet shield ?

it depends on the pixels. If you go APA102 and the likes (my favorites) then the Adafruit NeoPixel library uses bit banging, while FastLED for APA102 uses hardware SPI when available, avoiding bit banging.

Ill be using an Uno (non official) and a Keyestudio W5500 shield.

Maybe when I get it all working I will move to something smaller, but only if its not too much recoding.

Fair enough, I did not look at the library. So the program will not do anything and the new user will have no idea why.

Yes, which is of course not great.

Those are (seriously) more expensive, but anyway a lot faster of course. In the case of the OP

hwSPI will be used for the ethernet shield i guess, and sharing the bus will complicate matters (and slow things down)

No, but once it has been, and you start putting other stuff on the heap or the stack, it may still crash due to lack of memory.

Again in the case of the OP probably not for a while.

The crash as a consequence of writing beyond the size of the array when using FastLED is the most common newbie mistake still, by quite a bit.

Yes, but I find them more friendly especially if you have lots of leds as they don’t lock interrupts for a long time which can create all sorts of issues with other equipment (IR command, motors, radio, gps serial frames,…)

Fair point.

That would happen too then in the case of static allocation since the total memory is what you play with, isn’t it ?

Yes but it can cause some confusion since the dynamic allocation can be quite big (3 bytes per LED) and does not get reported at compile time, but yes it can always happen.

This is of course only the case on an MCU that can not send the signal using one of it's peripherals. Hence i use ESP's mainly for this purpose, and the I2S bus in particular. (UART is also an option and even RMT on an ESP32, which in theory can also be used for reception of WS281x) The extra amount of memory available is just an added bonus. When using loads of LEDs the price becomes also more of an issue.

Yes on an ESP32 you are better off

on an ESP8266 as well !