LED Grid: Blinking lights!

This week and last, we’ve been working hard to set a budget and optimize the design for the physical object side of the LED grid project. Branden has been developing a list of parts and is starting to lay out the circuit board design (maybe I’ll convince him to do a guest post for that part?).

In the meantime, I’ve been teaching my 8-LED prototype a few tricks.

First, I started with some sketches of the kinds of things that I thought I could teach it to do using really basic functions that would be fairly simple to implement. (Each sketch shows the 8-LEDs drawn from right to left. As you read down the sketch, you can see how the pattern changes with time.)


The thing that I like about this collection of functions is that it starts out really simple and gets progressively more complex. For the first two designs, I only need to create a couple of variables to teach my program where the ends of the LED strip are, and then I need to tell it to “bounce” the light pattern off of the ends of the strip. Logically, that task is pretty simple, so it’s a fairly easy place to start programming.

Once that’s working, I can start adding fancier colors, and come up with some kind of a gradient by controlling the different R, G, B values for each LED.

The later sketches use sine waves or some kind of beat detection (a chance to learn about sound files) to make more complicated patterns. Those will definitely be the hardest to execute, but with a good idea of where I’m going I should be able to design a code structure that can handle all of these different things.

There have already been quite a few head-scratching moments along the way, and it took several revisions of the code to get the screen display and the LED display to match. Thanks to a lot of persistence and several long troubleshooting conversations with Branden, I did get it working in the end.

I have gone through 3 or 4 major reorganizations of my code in the past week or so, but I’m beginning to settle into a framework that I think will work well and that should be easily extensible to include more features as I build them.  Today, I broke the code apart into separate functions using the tabs feature in Processing, so that the individual pieces can operate independently of one another. That should make it a lot easier to keep track of what’s going on.

I also created an auto-selector that lets the LEDs cycle through each display mode, one after another. Here they are, performing all their tricks in a row:

Of course, the ultimate goal is to extend these functions to a 2D grid of LEDs, but for now it’s really useful to have a very simple display to play with while I figure out the basics. It’s exciting to think about how these routines could be extended or combined to run on the more complicated setup, once it’s available.