loading
This instructable is meant to be a more complete explanation than others available online. Notably, this will provide more hardware explanation than is available in the LED Marquee instructable by led555.

Goals

This instructable presents the concepts involved with shift registers and high side drivers. By illustrating these concepts with an 8x8 LED matrix I hope to provide you with the tools needed to adapt and expand to the size and layout your project calls for.

Experience and Skills


I would rate this project to be of medium difficulty:
  • If you already have experience programming microcontrollers and working with LEDs this project should be fairly easy for you to complete and to scale to larger arrays of lights.
  • If you are just starting out with microcontrollers and have flashed an LED or two you should be able to complete this project with some help from our friend google.
  • If you have little or no experience with microcontrollers or programming this is probably beyond what you should be getting yourself into. Try out a few other beginner projects and come back when you've got some more experience writing programs for microcontrollers.

Disclaimer and Credit


First, I am not an electrical engineer. If you see something that is wrong, or not a best practice, please let me know and I'll make the correction.

Do this at your own risk! You should know what you're doing or you can cause damage to your computer, your microcontroller, and even yourself.

I have learned a lot from the internet, particularly from the forums at: http://www.avrfreaks.net

I am using a font set that came with the ks0108 universal C library. Check that out here:
http://en.radzio.dxp.pl/ks0108/

Step 1: Parts

Parts List


General Parts

To make an 8x8 grid of LEDs and control them you will need:
  • 64 LEDs of your choice
  • 8 Resistors for the LEDs
  • 1 Shift register for the columns
  • 1 Driver array for the rows
  • 8 Resistors for switching the driver array
  • 1 microcontroller
  • 1 clock source for microcontroller
  • 1 prototyping board
  • 1 power supply
  • Hook-up wire

Specific Parts Used Here

For this instructable I used the following:
  • 64 green LEDs (Mouser part #604-WP7113GD)
  • 8 220ohm 1/4 watt resistors for the LEDs (Mouser part #660-CFS1/4CT52R221J)
  • 1 HEF4794 LED driver with shift register (Mouser part #771-HEF4794BPN)
  • 1 mic2981 High-Voltage High-Current Source Driver Array (Digikey part #576-1158-ND)
  • 8 3.3kohm 1/4 watt resistors for switching the driver array (Radio Shack part #271-1328)
  • 1 Atmel ATmega8 microcontroller (Mouser part #556-ATMEGA8-16PU)
  • 1 12MHz crystal for the microcontroller clock source (Mouser part #815-AB-12-B2)
  • 1 2200-hole prototyping board (Radio Shack part #276-147)
  • Converted ATX power supply: See This Instructable
  • Solid core 22-awg hook-up wire (Radio Shack part #278-1221)
  • Solderless breadboard (Radio Shack part #276-169 (no longer available, try: 276-002)
  • AVR Dragon (Mouser part #556-ATAVRDRAGON)
  • Dragon Rider 500 by Ecros Technologies: See This Instructable

Notes Regarding Parts


Row and Column Drivers: Probably the most difficult part of this project is picking the row and column drivers. First off, I do not think a standard 74HC595 shift register is a good idea here because they cannot handle the kind of current we want to send through the LEDs. This is why I chose the HEF4794 driver as it can easily sink the current present when all 8 leds are in one row are switched on.

The shift register is present on the low side (the ground pin of the leds). We will need a row driver that can source enough current to string multiple columns together. The mic2981 can supply up to 500mA. The only other part I have found that performs this task is the UDN2981 (digikey part #620-1120-ND) which is the same part by a different manufacturer. Please send me a message if you know of other high-side drivers that would work well in this application.

LED Matrix: This matrix is 8x8 because the row and column drivers each have 8 pins. A larger LED array may be built by stringing multiple matrices together and will be discussed in the "modular concepts" step. If you want a large array, order all of the needed parts at one time.

There are 8x8, 5x7 and 5x8 LED matrices available in one convenient package. These should be easy to substitute for a diy matrix. Ebay is a good source for these. Mouser has some 5x7 units available such as part #604-TA12-11GWA. I used cheap green LEDs because I'm just playing around and have fun. Spending more on high-brightness, high-efficiency LEDs can allow you to produce a much more spectacular looking display... this is good enough for me though!

Control Hardware: The matrix is controlled by an Atmel AVR microcontroller. You will need a programmer for this. Because I am prototyping I am using the Dragon Rider 500 for which I have written both assembly and usage instructables. This is an easy tool for prototyping and I highly recommend it.

<p>Thanks a lot </p>
instead of mic2981 would a decade counter work, or could we just out the pins directly on the arduino?
<p>You wouldnt want to use a ttl IC to power the LED's. The matrix would pull to much current for the IC to handle.</p>
<p>Thumbs up, great explanation, great instructables :D</p>
<p>The column driver is drive only ONE column at any one time, so the current load should not be more than 8 X 15 mA or 120 mA. It seems that one driver should suffice to drive any number of columns. Is this correct?</p>
Cool! There is a tutorial for a heart-shaped, shift register based LED matrix at <a href="http://lucidtronix.com/tutorials/18" rel="nofollow">http://lucidtronix.com/tutorials/18</a>
I recently saw this written up in EDN. It begs two questions. Is the latch really needed? What is the cost of this HEF4794? Given the POV of the human eye versus the speed of a microcontroller, I have never seen this as a problem using a old trusty 74HC164, which, BTW, drives LEDS very nicely. The cost of the HC164 is considerably cheaper over the cost of the 4794 by $2.00. How do I know this? I've used the HC164 in this mode for numerous successful designs that have gone to production, from toys to medical devices. This a great article to demonstrate to the HEF4794 but is it truly practical?
Is the 10k resistor nescessary?
I've been working on a very large LED matrix myself. If anyone wants to see a matrix that allows for direct drive (each LED individually controlled), check this out: <br> <br> http://blog.kamilon.com/?page_id=114 <br> <br>Well done on this tutorial. You can create a small matrix for much cheaper than buying one by following your instructions.
maybe i build this when i die. '-_-
i m doing this project....but addition in this, i m use a gsm module which receives the message send by any cell phone, and it display the message on the led display...so i need CIRCUIT DIAGRAM and CODE for this project....plz help me soon...<br>
Basically you want someone else to do your project for you then don't you? You'll learn a lot more by doing the research and the graft yourself.
Should be &quot;clamp&quot; Just saying.
I want to build something like this but I've noticed that most of the examples of code that I've found for LED- driving programs are written in an assembly language. Is there a reason for that? would like to avoid it if possible...
how do u upload code in C++ to the arduino???
Hi sir i need to make board for matrix 8&times;32 .<br>
Atmega16 ?code Help PLZ <br>
I'm using cad-soft eagle software. I could not find hef4794 shift register . can you help me to find in eagle?
or, if they dont match up, you can make your own part with this tutorial: <br>http://www.sparkfun.com/tutorials/110
if you check the datasheets for the hef4794 and the 74hc595, you can see if they have the same pinout and just use the eagle part for the 595
hi, im really interested in this project, specially in the 16x16 array, but I want to use it with an arduino, and also, that each LED is individually addressable (meaning that the code shuld have a place with lines with the text &quot;B00000000, x32&quot; and that each line has a total of 256 0 (Which can be changed to 1 to make tle LED light up) so each line would be a new frame with every LED individually addressable.<br>The problem is that Im kinda new with microcontrollers and can't write the code, Where can I get it?? can you help me write it?? <br>plz help,<br> really interested in ur project.<br>Thanks.
thanks its good
<br> I have a simple ASM program with a matrix display light just columns. <strong>An example:</strong><br> <br> ;-----------------------<br> LIST P=16F876<br> #include &lt;p16F876.inc&gt;<br> <br> __CONFIG _CP_OFF &amp; _WDT_OFF &amp; _PWRTE_ON &amp; _XT_OSC<br> ORG 0x2100<br> DE 0x00<br> ORG 0<br> <br> <br> cblock 0x20<br> d1<br> d2<br> d3<br> endc<br> <br> goto start<br> <br> Delay<br> ;999990 cycles<br> movlw 0x07<br> movwf d1<br> movlw 0x2F<br> movwf d2<br> movlw 0x03<br> movwf d3<br> Delay_0<br> decfsz d1, f<br> goto $+2<br> decfsz d2, f<br> goto $+2<br> decfsz d3, f<br> goto Delay_0<br> <br> ;6 cycles<br> goto $+1<br> goto $+1<br> goto $+1<br> <br> ;4 cycles (including call)<br> return<br> <br> loop:<br> movlw b'00000111'<br> movwf PORTA<br> movlw b'11110010'<br> movwf PORTB<br> movlw b'11111111'<br> movwf PORTC<br> call Delay<br> call Delay<br> call Delay<br> <br> goto loop<br> start:<br> bsf STATUS,RP0 ; select register page 1<br> movlw 0 ; put 0 into W<br> movwf TRISC ; set portC all output<br> clrf TRISA<br> clrf TRISB<br> <br> bsf STATUS,RP1 ; select Page 2,<br> bcf STATUS,RP0 ; by setting RP1 in Status register and clearing RP0<br> <br> clrf PORTC ; select Digital I/O on port C<br> <br> <br> bcf STATUS,RP1 ; back to Register Page 0<br> goto loop<br> <br> end<br> ;-----------------------<br> <br> <strong>This program code is OK</strong>. But I want the program to which I could display the words fleeing across the screen. Started, I tried to ignite a pair of columns on different sites but with the burning LEDs. But received some strange flashing, do not light longer ... Anybody know what's wrong ...<br> <strong>Programme code:</strong><br> <br> ;-----------------------<br> LIST P=16F876<br> #include &lt;p16F876.inc&gt;<br> <br> __CONFIG _CP_OFF &amp; _WDT_OFF &amp; _PWRTE_ON &amp; _XT_OSC<br> ORG 0x2100<br> DE 0x00<br> ORG 0<br> <br> <br> cblock 0x20<br> Delay1 ; delay loop 1<br> Delay2 ; delay loop 2<br> Delay3 ; delay loop 3<br> TimeDelay ; time delay x 0.001 s<br> EndCount ; used to tell PIC the end of the table is reached<br> Counter ; used as table counter<br> Line1 ; Line 1<br> Line2 ; Line 2<br> Line3 ; Line 3<br> Line4 ; Line 4<br> Line5 ; Line 5<br> sad<br> Line6 ; Line 6<br> Line7 ; Line 7<br> Line8 ; Line 8<br> Layer4 ; brightness, and time<br> Brightness ; LED brightness<br> Time ; time for each pattern to stay<br> Temp ; temp register<br> d1<br> d2<br> d3<br> endc<br> <br> <br> goto start<br> <br> Delay<br> ;999990 cycles<br> movlw 0x17<br> movwf d1<br> movlw 0x2F<br> movwf d2<br> movlw 0x03<br> movwf d3<br> Delay_0<br> decfsz d1, f<br> goto $+2<br> decfsz d2, f<br> goto $+2<br> decfsz d3, f<br> goto Delay_0<br> <br> ;6 cycles<br> goto $+1<br> goto $+1<br> goto $+1<br> <br> ;4 cycles (including call)<br> return<br> <br> loop:<br> movlw b'00000001'<br> movwf Line1<br> movlw b'11110010'<br> movwf Line2<br> call output<br> <br> <br> <br> call Delay<br> movlw b'11100000'<br> movwf Line1<br> movlw b'10101010'<br> movwf Line2<br> call output<br> call Delay<br> <br> goto loop<br> <br> <br> start:<br> bsf STATUS,RP0 ; select register page 1<br> movlw 0 ; put 0 into W<br> movwf TRISC ; set portC all output<br> clrf TRISA<br> clrf TRISB<br> <br> bsf STATUS,RP1 ; select Page 2,<br> bcf STATUS,RP0 ; by setting RP1 in Status register and clearing RP0<br> <br> clrf PORTC ; select Digital I/O on port C<br> bcf STATUS,RP1 ; back to Register Page 0<br> goto loop<br> <br> <br> <br> output:<br> movfw Layer4<br> andlw b'00000001'<br> movwf Time<br> incf Time,1<br> bcf STATUS,C<br> rlf Time,1<br> bcf STATUS,C<br> rlf Time,1<br> bcf STATUS,C<br> rlf Time,1<br> bcf STATUS,C<br> rlf Time,1<br> bcf STATUS,C<br> rlf Time,1<br> <br> <br> <br> clrf PORTB ; clear port B<br> movfw Line1 ; move layer1 to W<br> movwf PORTC ; put W onto PortC<br> <br> bsf PORTB,4 ; turn on layer 1 buy outputing bit 5 of PortB<br> <br> movfw Brightness ; put brightness into W<br> call Delayy ; call the delay<br> <br> bcf PORTB,4 ; turn off layer 1<br> <br> movfw Brightness ; put Brightness into W<br> sublw 4 ; sub W from 4<br> btfss STATUS,Z ; skip if the zero flag is set<br> call Delayy ; call the delay<br> decfsz Time<br> <br> clrf PORTB ; clear port B<br> movfw Line2 ; move Line2 to W<br> movwf PORTC ; put W onto PortC<br> <br> bsf PORTB,5 ; turn on layer 2 buy outputing bit 6 of PortB<br> <br> movfw Brightness ; put brightness into W<br> call Delayy ; call the delay<br> <br> bcf PORTB,5 ; turn off layer 2<br> <br> movfw Brightness ; put Brightness into W<br> sublw 4 ; sub W from 4<br> btfss STATUS,Z ; skip if the zero flag is set<br> call Delayy ; call the delay<br> decfsz Time<br> <br> decfsz Time ; decrement the Time regiester<br> return<br> <br> <br> Delayy:<br> movwf Delay3 ; put W into Delay 3<br> <br> Loop1:<br> ; After Delay2 decreses to 0, it is reset to..<br> movlw 0x1 ; put 1 into W<br> movwf Delay2 ; put W into Delay2<br> <br> Loop2:<br> ; After Delay1 decreses to 0, it is reset to E9h<br> movlw 0x1D ; put 80 into W<br> movwf Delay1 ; put W into Delay1<br> <br> Loop3:<br> decfsz Delay1 ; decrement Delay1<br> goto Loop3 ; jump back to Loop3<br> decfsz Delay2 ; decrement Delay2<br> goto Loop2 ; jump back to Loop2<br> decfsz Delay3 ; decrement Delay3<br> goto Loop1 ; jump back to Loop1<br> return<br> <br> end<br> ;----------------------------------------------------------<br> <br> Thanks for help. :)<br>
Does anyone know if the matrix would work with an Arduino board????
good article!!
what is the additional connection that should be made to make the LEDs glow individual letters???
how can we make the 8*8 led display the letters???? I'm stuck at this point...
can we add shift registers to the column and shift the bit
Where is the Font Set at http://en.radzio.dxp.pl/ks0108/ ?? Anthony
Hey there..nice project,easy to acomplish and lot of stuff to learn.Now that i am learning C,i enlarged the project to be 8x32 columns,but i cant get the code to work.Any hints where are the parts that needs to be worked?There are some parts in the code commented that need to be altered,but i cant figure out how.If you can jelp pls send me an PM,or ust reply here.<br />Thank's and keep up the good work!!<br />
Hi;<br /> I too tried with expanding 8x32 , it doesn't works as expected., Any one can help me, <br />
Could you use a whole load of transistors? For switching something else? Maybe an array of motors or switching relays?<br />
does the leds have good brighness? there is not problem with duty cycle? becouse i have that problem in my project, (i use 4017 decade counter)
&nbsp;can this be done using parallel load shift registers or does it have to be done with serial load.<br /> <br /> if it is to be doable with parallel load registers then the board doesnt have to display only one column at a time, right? that would be so much cooler and you could build modules and connect them with parallel in serial out to serial in parallel out.<br /> <br /> leme know what you think...<br />
Both are 20 pF.<br />
a very informative and interesting site
what are values for c2 and c3 ????? im relying entirely on this!! please? i got everything but this part and the programing part. please help!!!
Just to clarify, could I program in a bunch of phrases (like, 30-40) and call up any one of them based on certain inputs? What is the limit on phrase length without any external memory?
i just bought a butt load of registers. im trying to make a 32 x 32 any pointers? on how to connect 8x8 in rows and columns? any help would be apprecieated. :)
I am looking into your setup and I noticed this: Why do you use such a driver on the high-side when you are lighting one column at the time during multiplexing? Now you could source rows of 8 LED's at one time, but that isn't the case while multiplexing, right?
bro barney, can u help me to get HEF4794? i need the HEF4794?? 9 of them to controll my Solar Display. In my country there's no store sell that shift register :( :( Can I get it from u?? I'll pay it later. I'm in Jakarta, Indonesia. Please help me master, this is for my graduation project. thank you very much :)
I need help programming the micro controller could you please help i would like my display to scroll the following NBI..............VOI.............MBS over and over and can also be made to stop at one of the letters shown.
Could you use a MAX232 to connect it to a computer?
Im trying to get mine working from the COM port, so I am using a MAX232 to convert the data from -3V - 3V to 0V - 5V, then feeding it into a UART (ST16C1450) to get my 8 outputs. I havent had much any luck yet with it yet, as I'm still learning as I go. Right now I'm waiting on new caps for the uart.
Hi nice idea i was hoping to use this idea but enlarge the font characters where i could use four LEDs in place one LED is that possible
I have read and re-read the parts list, but I cannot find the spoon. Where is the spoon?
There is no spoon.
i m making a 16x80 display with 8051 (AT89S52) but as more and more characters scroll, flickering is there why?
It's not refreshing fast enough. With that size, it would take a lot longer to toggle the LEDs.
ok lets chek it out

About This Instructable

338,641 views

563 favorites

License:

More by barney_1: How to Make and Can Concord Grape Jam LED Hanukkah Menorah LED matrix using shift registers
Add instructable to: