My first task was to get these pixels working, and I soon found an appropriate library on GitHub. The pixels were mounted on a black cloth, which never hung quite right, so I remounted all 165 LEDs on a sheet of plywood with a frame and painted it black. This now hangs on my den wall and still gets fired up from time to time.
I only really ever wrote one program for this display, and that was a triangle bouncing off the edges -- similar to the way in which the old Microsoft Windows Misty screensaver worked. This was a little limited, with only a 15x11 display. I would love to have used anti-aliasing, but the math is way over my head.
I often looked on the Internet for other types of LED pixels. I longed for some of these after seeing what others could do with them, but at typically twice US prices they all seemed extremely expensive here in the UK.
Eventually, I discovered Adafruit and its 12mm RGB LED strands (25 pixels per strand). I took the chance of ordering a couple of lengths, since they were reasonably priced, especially with the exchange rate in my favor. In fact, they were about half what I could get them for in the UK. They arrived within a week and they were great, so I ordered another eight lengths. This time around I got stung for import duty, but they were still cheaper than I could get them in the UK.
These pixels have been used and re-used for various small projects, ranging from light columns on either side of the TV, to 100 of them strung across the garage door one Christmas and another 50 in the lounge window. They now permanently reside in a 16x12 panel (800mm x 600mm x 70mm) where I use them as an audio spectrum analyzer.
This uses an Arduino Uno and a couple of MSGEQ7 7-band graphic equalizer chips from SparkFun. The circuit can use either a standard 3.5mm stereo jack plug or the SparkFun microphone breakout board. The circuit board also has an op-amp circuit for beat detection that I use for other lighting projects.
This panel sits in my den on the desk and is almost always turned on when I have music playing -- sometimes just to provide ambient light. It does still need some work, since the display variations are somewhat limited. I did try a peak hold effect, but it never looked right. I must try that again someday.
More recently, Adafruit started supplying NeoPixel strips with 30 RGB LED's per meter. These are very reasonably priced compared to other strips. Initially they weren't available in the UK, so I purchased all 30 meters of mine directly from Adafruit.
The only drawback with the NeoPixels is the Adafruit library (available on GitHub), which generally only works on Arduino or Arduino-compatible microcontrollers. The pixels are very timing critical. The only way they can be driven reliably is by using machine code, so most of the library is written in assembly language. This library can be used on boards with 8 MHz or 16 MHz clocks. I've successfully used the library on the Arduino Uno, Arduino Mega, and Adafruit Trinket.
The other day, Max Maxfield informed me that he had heard of someone getting the NeoPixels working on a 32-bit, 80 MHz Teensy 3.1 ARM processor board using a clever DMA (direct memory access) routine. This means that the main processor can continue working while the DMA engine is updating the pixels. (The Arduino can't perform other tasks while the machine code is running.) I'd like to try that for myself. Maybe the code is available somewhere.
Well, that's all for this column. I hope I've conveyed my love of flashing lights in general, and microcontroller-controlled tri-colored LEDs in particular. In my next column I will start to describe a hallway lighting project using an Arduino and Adafruit's NeoPixels. In the meantime, I welcome any questions and comments.