I’ve finally gotten to dig in to a major rewrite that the FastSPI_LED library has been needing for a while. The goal is to simultaneously make the library smaller, faster, more flexible, more portable, more maintainable, more easily extensible, and more.
I know at one point I railed against software bitbanging, and for the highest performance, that is still the case. The new version of the FastSPI_LED library pushes the hardware SPI port up to over 6.6Mbps (up from 5Mbps). However, if you want to use the SPI port for something else, the library will silently fall back to a bitbanging mode. Of course, this wouldn’t be my library if it wasn’t fast – and it can push data out at 3.1Mbps when bitbanging. This is faster than some other code can manage their hardware SPI!
The new library is also more split out into components. Doing something where you’re writing data out to SPI, but not using LEDs? You will be able to use the high performance SPI code independently of the rest of the library for your SPI data output (I will add support for reading over SPI in time), and this version of the SPI library will use channel select lines (though you may need to add some hardware to make it all work).
Yes – that was lines plural, up there. Another feature of the new library is the ability to support multiple chipsets and multiple sets of output simultaneously. Want to drive a WS2811 strip and a WS2801 strip on hardware SPI and an LPD8806 on software SPI at the same time? You can.
The chipsets that have no clock line (TM1809, WS2811, UCS1903, etc…) have also gotten some love. The timing for these chips is not rock solid and consistent. Even better, I’ve made it dead simple to add support for new chipsets in this style in the future. I simply instantiate a template with 3 pieces of timing info in nano-seconds et. voila! Support for new chipset. By using ns timing values for tuning the code, it also means supporting different clock rates is automatic (avr’s run at 8Mhz, 16Mhz, 20Mhz, and the teensy 3.0 can run at 24Mhz, 48Mhz, or even 96Mhz – now, I don’t need to change code at all to support a new clock speed with a new chipset!)
The library also includes a high-performance pin access library. Set a pin in as few as 2 clocks (1 clock if you do some setup work beforehand, useful in tight loops, like, say, when bitbanging SPI output!). Here’s what a simply blink app will look like:
void setup() { Pin<13>::setOutput(); }
void loop() { Pin<13>::hi(); delay(20); Pin<13>::lo(); delay(20); }
The core code is written and undergoing testing now on the various arduinos I have access to (uno, mega, nano, pro-mini), as well as some arduino derived platforms (have both a teensy 2.0 and teensy 3.0 handy). I still have some high level support code to make things easier to work with, and then it should be all wrapped up and ready to go.
In addition, over the next few weeks I hope to write up a number of posts describing the various ways that I squeezed nearly every last clock cycle out of the arduino to give you more CPU time to spend coming up with interesting things to paint your LEDs with.

fantastic news! the future is growing exponentially
Very Exciting!
Out of curiosity, how many LEDs do you expect to be able to handle / line ? Is there an upper limit to how many lines total? The reason I ask is that I have an art project in mind with multiple strips of ws2801 LEDs, and it would be awesome to be able to drive them all with a single arduino.
The number of LEDs is really limited by memory. You need at least 3 bytes per rgb led. If you have multiple strips hooked up, you could save some memory by only having one strip’s worth of rgb data in memory at any given time, though that may stutter your output a little bit. I’ve done 450 LEDs with simple RGB data using just an arduino pro mini with 2kb of memory. If I want to use HSV data and/or more LEDs, then I go up to the Arduino Mega 2560 which has 8kb of memory.
hey, I can’t find anything on google so I’m asking here ^_^. Is the LPD8806-52 (52 leds/meter) supported by your library? thx
Yes! It’s simply the LPD8806 as far as my library is concerned.
any news on when it will be released ?
im not happy with alans ws2811 library…
i really would like to use my ws2811 ambilight without flickering
Hopefully within the next couple of weeks. The core is working on arduino and teensy 2.0′s, I still need to work on the public interface and teensy 3.0 support (though I might release it once the public interface is done, and before teensy 3.0 support is finished). It’s just a matter of getting the time to wrap stuff up!
I’m curious why you are seeing flickering with Alan’s library? In theory, you shouldn’t be – have you checked power levels/connections?
sorry the flickering was meant by the use of fastspi.
im to stupid to convert alans code to arduino.
im not able to run his code so far.
its all new to me.
i have decided to waii for your great library.
Hi, I’m trying to use your library to drive WS2811 led pixels but I cannot find a sample anywhere. I’ve tried this but I get errors:
#include
#define NUM_LEDS 150
CRGB leds[NUM_LEDS];
void setup() { LEDS.addLeds(leds, NUM_LEDS); }
void loop() { LEDS.showColor(CRGB::Blue); }
I think some of your brackets got removed by the commenting system. Also – I am, alas, not a mind reader (as much as I wish that were so!) – what errors are you getting?