Speeding up LPD8806 show() without hardware SPI @ Michael Noland’s Blog.
Hi, I made a method to update LPD8806 strips about 5x faster than the current library on GitHub. It’s about the same speed as the hardware SPI implementation, but can be used when those pins are dedicated to other hardware (e.g., Ethernet boards).
It requires that the clock and data pin assignments are known at sketch.
If you’re using LPD8806 LED strips and you can’t use the hardware SPI port (e.g., when using an Ethernet board), there are two other options in the Adafruit library: the default mode and ‘slowmo’ mode. The default mode is decent, but the flexibility of being able to choose the pins at runtime comes with a cost. However, you can still get a decent speedup by defining your pin usage at compile time in a replacement show() function.
This tutorial is interesting because its the first time we’ve seen the use of compile-time templates to set interface pins via a sketch. Traditionally, Arduino users use digitalWrite() or digitalRead() to interface with the pin registers. Hardk0re hackers sometimes like to use pointers to the registers which still allows for flexible pin numbering in the sketch but this technique takes it to the next level!
Digital Addressable RGB LED with PWM waterproof flexi strip. These LED strips are fun and glowy. There are 32 RGB LEDs per meter, and you can control each LED individually! Yes, that’s right, this is the digitally-addressable type of LED strip. You can set the color of each LED’s red, green and blue component with 7-bit PWM precision (so 21-bit color per pixel). The LEDs are controlled by shift-registers that are chained up down the strip so you can shorten or lengthen the strip. Only 2 digital output pins are required to send data down. The PWM is built into each chip so once you set the color you can stop talking to the strip and it will continue to PWM all the LEDs for you
Built in 1.2 MHz high speed 7-bit PWM for each channel – that means it can do 21-bit color per LED (way more than the eye can easily discern). Once you set the brightness level for the LEDs, your microcontroller can go off and do other things, no need to continuously update it, or clock it. The best part is that compared to the WS2801 which can only run one LED at a time, this chip can drive 2 RGB LEDs which means the price stays the same as the older HL1606 strip, nice!
The strip is made of flexible PCB material, and comes with a waterproof sheathing.
You can cut this stuff pretty easily with wire cutters, there are cut-lines every 2.5″/6.2cm (2 LEDs each). Solder to the 0.1″ copper pads and you’re good to go. Of course, you can also connect strips together to make them longer, just watch how much current you need! We have a 5V/2A supply that should be able to drive 1 or more meters (depending on use)
They come in 5 meter reels with a 4-pin JST SM connector on each end, and are sold by the meter! If you buy 5m at a time, you’ll get full reels. If you buy less than 5m, you’ll get a single strip, but it will be a cut piece from a reel which may or may not have a connector on it.
Digital Addressable RGB LED with PWM waterproof flexi strip!
I suggest you take a look at the digitalWriteFast() library, as it is all pre-processor macros for direct port poking using Arduino pin numbering. Includes fail safes for misuse and support for must Arduino platforms. It’s been around for a while now.
2 years ago I took a look at various methods for changing a pin, and this library is as fast as direct port access, because it compiles to direct port access.
Link for library: http://code.google.com/p/digitalwritefast/downloads/list