5x faster updating of LPD8806 strips without hardware SPI

Digitalledstrip Lrg-4

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!


Adafruit publishes a wide range of writing and video content, including interviews and reporting on the maker market and the wider technology world. Our standards page is intended as a guide to best practices that Adafruit uses, as well as an outline of the ethical standards Adafruit aspires to. While Adafruit is not an independent journalistic institution, Adafruit strives to be a fair, informative, and positive voice within the community – check it out here: adafruit.com/editorialstandards

Join Adafruit on Mastodon

Adafruit is on Mastodon, join in! adafruit.com/mastodon

Stop breadboarding and soldering – start making immediately! Adafruit’s Circuit Playground is jam-packed with LEDs, sensors, buttons, alligator clip pads and more. Build projects with Circuit Playground in a few minutes with the drag-and-drop MakeCode programming site, learn computer science using the CS Discoveries class on code.org, jump into CircuitPython to learn Python and hardware together, TinyGO, or even use the Arduino IDE. Circuit Playground Express is the newest and best Circuit Playground board, with support for CircuitPython, MakeCode, and Arduino. It has a powerful processor, 10 NeoPixels, mini speaker, InfraRed receive and transmit, two buttons, a switch, 14 alligator clip pads, and lots of sensors: capacitive touch, IR proximity, temperature, light, motion and sound. A whole wide world of electronics and coding is waiting for you, and it fits in the palm of your hand.

Have an amazing project to share? The Electronics Show and Tell is every Wednesday at 7pm ET! To join, head over to YouTube and check out the show’s live chat – we’ll post the link there.

Join us every Wednesday night at 8pm ET for Ask an Engineer!

Join over 36,000+ makers on Adafruit’s Discord channels and be part of the community! http://adafru.it/discord

CircuitPython – The easiest way to program microcontrollers – CircuitPython.org


Maker Business — “Packaging” chips in the US

Wearables — Enclosures help fight body humidity in costumes

Electronics — Transformers: More than meets the eye!

Python for Microcontrollers — Python on Microcontrollers Newsletter: Silicon Labs introduces CircuitPython support, and more! #CircuitPython #Python #micropython @ThePSF @Raspberry_Pi

Adafruit IoT Monthly — Guardian Robot, Weather-wise Umbrella Stand, and more!

Microsoft MakeCode — MakeCode Thank You!

EYE on NPI — Maxim’s Himalaya uSLIC Step-Down Power Module #EyeOnNPI @maximintegrated @digikey

New Products – Adafruit Industries – Makers, hackers, artists, designers and engineers! — #NewProds 7/19/23 Feat. Adafruit Matrix Portal S3 CircuitPython Powered Internet Display!

Get the only spam-free daily newsletter about wearables, running a "maker business", electronic tips and more! Subscribe at AdafruitDaily.com !



2 Comments

  1. 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.

  2. Link for library: http://code.google.com/p/digitalwritefast/downloads/list

Sorry, the comment form is closed at this time.