Scrolling Marquis: more fun with timers

After spending the last week playing around with the timers and interrupts of the AtMega328P Microcontroller (see my previous KITT post!)  I’ve decided it’s time to “move up in Farmville” and build myself a new multi-function prototyping device.  up until now, I’ve been playing with buzzers, 4×7 numeric displays, keypad matrices, and just plain LED’s and I’ve decided my next move is to hack together an 8×8 LED matrix.  LED matrices are double plus awesome because they provide you the flexibility of displaying relatively complex output.  The theory behind them is you create a square (or rectangular) grid of LED’s, tie all of the columns low and all of the rows high, and bam you have X number of uniquely addressable LED’s.  Now, the problem with this layout is if you have an 8×8 matrix, you are going to need 16 IO pins to address all of the LED’s (8 for the columns, 8 for the rows)  this would be the easiest to code together since no multiplexing is involved, however, your design is going to be drawing a ridiculous amount of current and use up a huge number of valuable IO pins on your micro.  So, to work around this problem we use multiplexing.  the theory behind this is that you only turn on one row or column at a time REALLY fast, the human eye cannot discern this at >20Hz! thereby reducing the amount of current drawn but increasing the code complexity.  I considered designing my matrix using double multiplexing between 2 3-8 muxes one for the rows and one for the columns, this would drop the number of IO pins used to address the LEDs to 6, and provide the best performance for power, however the complexity of implementation in code is a little too crazy. why not make things easy on our selves and multiplex the columns and then directly address each row!  it’s the best of both worlds.  So here’s my final prototype for my 8×8 LED Matrix:

matrix pcb

matrix pcb

It’s going to be a little while before I can work with this guy. It’s going to take a month to fab the board and get all of the parts necessary. but I’ve got loads of ideas for working with this device. First of all, I’m designing a scrolling marquis that can be programmed via the serial port, and I’m also working on creating a “snake” game that uses a 2D accelerometer for directional input.

also, this design, and all code for it were designed on an arch linux box using the gEDA design suite, and the gcc-avr compiler, with vim as my text editor and avrdude as my programmer.

more to come when I have a functional prototype (I’m so excited!)

Leave a Reply