Step 4: Designing the Drivers

At first thought, driving an LED matrix is a simple endeavor. Simply hook the anodes to one set of microcontroller (uC) pins and the cathodes to another and there you go, right? Well that would be nice but it's a big problem for two reasons. One, the if we wanted to expand this to large matrices we would quickly run out of pins. Second, when multiple LEDs are lit up at the same time with set-up we run the risk of the current draw on the uC pins being so high that we damage unit. So how do we get around these problems? Which the use of extra integrated circuits and little trick in the software.

Here we'll be discussing how hardware helps us solve the above problems and we'll discuss the software trick a little later on. 

So I know that my LED Etch-a-Sketch will require four 8x8 LED matrices. That means I have 256 LEDs that need to be individually addressed. That's quite a bit. So how to we do it? Well first we need to understand how the LED matrix works. The particular matrix I used is called a common cathode LED matrix. It may make understanding what this means if I add a little to the name. Lets call it a common cathode row LED. So now we know that all the cathodes in each row are on the same line (see the first image). This allows us to control a single LED by simply supplying a positive voltage to the column and ground to the row corresponding to the LED we want lit. For example if we want to light the LED at (4,4) we would apply ground to row 4 and a positive voltage to column 4 as seen in the second image. From this we know we need so control all the column lines. But what about the row lines? If we just tied all these to ground then we would never be able to have different LEDs lit on each row. This tells us that we also need to control the row lines.

We'll look at the entire 16x16 display as an 8x32 display as that's how it will be wired up. You  can see this in the third image above. To control a display of this type we will need to control 32 lines for the columns and 8 for the rows. Row control is no problem; we have  eight pins available to us on the uC. The only thing to be concerned about is how to sink the current without damaging the uC. I'll address that in a second. But first let's figure out how we are going to control 32 lines when we clearly don't have 32 uC pins available.

The trick is to use the handy 74HC595 serial-in parallel-out 8-bit shift register, or, as I'll refer to it from now on, the 595. This IC allows us to serially send a byte of data to be stored in the register and then when signaled that data will appear in parallel (at the same time) on the output pins. It also allows for multiple 595s to be cascaded or connected together to accept an input larger than 8-bits. I'm not going to send time discussing the theory behind this device, as there are many resources available online that will do it. But at this point I'm sure you can guess where we are going with this. If we cascade four of these 595s together we can serially control all 32 column lines with just a few uC pins.

Let's quickly get back to the rows. As mentioned above we need to be careful not to send all the current through the uC to ground so we'll use a ULN2803 at each matrix. This will allow us to control the row lines while at the same time sinking the current.

We'll talk about how these ICs is used in conjunction with the software to successfully control the the LED matrices. But first let's get everything wired up properly.
Thanks for taking the time to make a very detailed able, its Great, explained everything so it was Easy to understand..cant wait to get started ..Awsome....Thanks very much..
Great project! :) congrats!
this is awesome, thanks for the ible!!! <br>
great instructable! I'm glad you posted the whole thing! awesome idea.
I Agree
Thanks again! I'm glad you like it!

About This Instructable




Bio: A materials scientist gone electrical engineer my hobbies include experimenting with electronics and making fun and interesting things. I rarely know what I'm doing ... More »
More by cmonaco3:Pom-pom Flowers Sugru Iron Man Armor for you LEGO Minifigure Wooden Tray from Wood Scraps 
Add instructable to: