As prep for future projects, I’ve built a simple 2D array of individually addressable LEDs. This canvas will ultimately serve as the platform for some games (snake, pong, etc), but I’m hopeful that other people will find this useful and come up with some cool applications.
I previously wrote about different types of LED strips. For this project, I went with the cheaper (HL1606-based) strip, because I am probably going to use up a lot of the ribbon, and it’s significantly cheaper. The downside to using this over the more expensive strip is that I’ll have fewer colors, but I think that’ll be ok for the projects I have in mind. To make the array, I cut an LED strip into 8-LED segments, and then wired those segments serially. Electrically this means there was no change, but it allowed me to lay the strips side-by-side, to form an 8 LED by 8 LED canvas, where each LED is individually controllable by a microcontroller.
The Protocol (Low Level)
Because the strips alternatively go up and down, I am able to use adafruit’s HL1606strip library. The only difference is that every other segment gets written backwards, since it is oriented in the opposite direction.
I’ve introduced an additional layer of abstraction for this platform: HL1606grid (requires the external library HL1606strip). The API is (hopefully) straightforward. Once you instantiate the grid, you set a particular LED like:
grid.setLEDcolor(row, col, RED);. If you’re familiar with the 1D HL1606strip library, that should look familiar.
The library comes with an example project, which you can see running above.
Get The Code
The code is open source, on github. If you make something cool, please let me know. Bug reports & pull requests encouraged!