Go Down

Topic: Arduino & LPD8806 RGB LED strip (Read 2762 times) previous topic - next topic


Hi there,

I've been playing with an Arduino Nano and one of Adafruit's LPD8806 addressable RGB LED strips. I wanted a smooth flowing pattern for the ambient mode on a project that I'm working on. I tried Perlin noise (from Mike Edward's Perlin Noise generator http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1191768812). Sorry Mike, but too slow at 10 ms per LED per colour. I tried simplex noise (converted from Stephen Carmody's implementation http://stephencarmody.wikispaces.com/Simplex+Noise) and it was faster at under 2 ms per LED, but still not quite up there when I've a 96 LED strip that I'd like to update every 50 ms or so. I like it smooth, so that means frequent updates.

After thinking about it for a while and asking some real programmers who know what they are talking about, I plumped for controlling some of the LEDs with simplex noise and interpolating across the gaps between. Interpolation takes under 0.1 ms per LED, so with six simplex nodes spread the length of the strip and interpolation across the gaps, that gives 96 LEDs in 50 ms.

(If you watch this at less than 720p, it looks jerky, but that's just Youtube's compression. It's pretty close to perfectly smooth in real life.)

I'd post the code for the above video here, but apparently it's too long. Instead you can find at over here: http://forums.adafruit.com/viewtopic.php?f=47&t=24554&start=0. It's not the tidiest, but it's been a decade since I was paid to write code and I'm getting a tad rusty.

I'd love for there to be a library of shiny patterns like these. There seem to be a decent number of people using the Arduino & LPD8806 combination and together we could put a handy package together.


This is really interesting.  I hadn't thought about this too much.  The cubic optimization may help me beat some of the speed issues I'm expecting for any long strands.  I probably don't need 50ms, but nice to know it's attainable.

Go Up