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/
Remove these ads by
Signing UpStep 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.










































Visit Our Store »
Go Pro Today »




http://blog.kamilon.com/?page_id=114
Well done on this tutorial. You can create a small matrix for much cheaper than buying one by following your instructions.
http://www.sparkfun.com/tutorials/110
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??
plz help,
really interested in ur project.
Thanks.
I have a simple ASM program with a matrix display light just columns. An example:
;-----------------------
LIST P=16F876
#include <p16F876.inc>
__CONFIG _CP_OFF & _WDT_OFF & _PWRTE_ON & _XT_OSC
ORG 0x2100
DE 0x00
ORG 0
cblock 0x20
d1
d2
d3
endc
goto start
Delay
;999990 cycles
movlw 0x07
movwf d1
movlw 0x2F
movwf d2
movlw 0x03
movwf d3
Delay_0
decfsz d1, f
goto $+2
decfsz d2, f
goto $+2
decfsz d3, f
goto Delay_0
;6 cycles
goto $+1
goto $+1
goto $+1
;4 cycles (including call)
return
loop:
movlw b'00000111'
movwf PORTA
movlw b'11110010'
movwf PORTB
movlw b'11111111'
movwf PORTC
call Delay
call Delay
call Delay
goto loop
start:
bsf STATUS,RP0 ; select register page 1
movlw 0 ; put 0 into W
movwf TRISC ; set portC all output
clrf TRISA
clrf TRISB
bsf STATUS,RP1 ; select Page 2,
bcf STATUS,RP0 ; by setting RP1 in Status register and clearing RP0
clrf PORTC ; select Digital I/O on port C
bcf STATUS,RP1 ; back to Register Page 0
goto loop
end
;-----------------------
This program code is OK. 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 ...
Programme code:
;-----------------------
LIST P=16F876
#include <p16F876.inc>
__CONFIG _CP_OFF & _WDT_OFF & _PWRTE_ON & _XT_OSC
ORG 0x2100
DE 0x00
ORG 0
cblock 0x20
Delay1 ; delay loop 1
Delay2 ; delay loop 2
Delay3 ; delay loop 3
TimeDelay ; time delay x 0.001 s
EndCount ; used to tell PIC the end of the table is reached
Counter ; used as table counter
Line1 ; Line 1
Line2 ; Line 2
Line3 ; Line 3
Line4 ; Line 4
Line5 ; Line 5
sad
Line6 ; Line 6
Line7 ; Line 7
Line8 ; Line 8
Layer4 ; brightness, and time
Brightness ; LED brightness
Time ; time for each pattern to stay
Temp ; temp register
d1
d2
d3
endc
goto start
Delay
;999990 cycles
movlw 0x17
movwf d1
movlw 0x2F
movwf d2
movlw 0x03
movwf d3
Delay_0
decfsz d1, f
goto $+2
decfsz d2, f
goto $+2
decfsz d3, f
goto Delay_0
;6 cycles
goto $+1
goto $+1
goto $+1
;4 cycles (including call)
return
loop:
movlw b'00000001'
movwf Line1
movlw b'11110010'
movwf Line2
call output
call Delay
movlw b'11100000'
movwf Line1
movlw b'10101010'
movwf Line2
call output
call Delay
goto loop
start:
bsf STATUS,RP0 ; select register page 1
movlw 0 ; put 0 into W
movwf TRISC ; set portC all output
clrf TRISA
clrf TRISB
bsf STATUS,RP1 ; select Page 2,
bcf STATUS,RP0 ; by setting RP1 in Status register and clearing RP0
clrf PORTC ; select Digital I/O on port C
bcf STATUS,RP1 ; back to Register Page 0
goto loop
output:
movfw Layer4
andlw b'00000001'
movwf Time
incf Time,1
bcf STATUS,C
rlf Time,1
bcf STATUS,C
rlf Time,1
bcf STATUS,C
rlf Time,1
bcf STATUS,C
rlf Time,1
bcf STATUS,C
rlf Time,1
clrf PORTB ; clear port B
movfw Line1 ; move layer1 to W
movwf PORTC ; put W onto PortC
bsf PORTB,4 ; turn on layer 1 buy outputing bit 5 of PortB
movfw Brightness ; put brightness into W
call Delayy ; call the delay
bcf PORTB,4 ; turn off layer 1
movfw Brightness ; put Brightness into W
sublw 4 ; sub W from 4
btfss STATUS,Z ; skip if the zero flag is set
call Delayy ; call the delay
decfsz Time
clrf PORTB ; clear port B
movfw Line2 ; move Line2 to W
movwf PORTC ; put W onto PortC
bsf PORTB,5 ; turn on layer 2 buy outputing bit 6 of PortB
movfw Brightness ; put brightness into W
call Delayy ; call the delay
bcf PORTB,5 ; turn off layer 2
movfw Brightness ; put Brightness into W
sublw 4 ; sub W from 4
btfss STATUS,Z ; skip if the zero flag is set
call Delayy ; call the delay
decfsz Time
decfsz Time ; decrement the Time regiester
return
Delayy:
movwf Delay3 ; put W into Delay 3
Loop1:
; After Delay2 decreses to 0, it is reset to..
movlw 0x1 ; put 1 into W
movwf Delay2 ; put W into Delay2
Loop2:
; After Delay1 decreses to 0, it is reset to E9h
movlw 0x1D ; put 80 into W
movwf Delay1 ; put W into Delay1
Loop3:
decfsz Delay1 ; decrement Delay1
goto Loop3 ; jump back to Loop3
decfsz Delay2 ; decrement Delay2
goto Loop2 ; jump back to Loop2
decfsz Delay3 ; decrement Delay3
goto Loop1 ; jump back to Loop1
return
end
;----------------------------------------------------------
Thanks for help. :)
Thank's and keep up the good work!!
I too tried with expanding 8x32 , it doesn't works as expected., Any one can help me,
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.
leme know what you think...