Instructables
Picture of LED matrix using shift registers
13 - 8x8 Box and Circle.JPG
LED-matrix-using-shift-registers_Tech.Jpg
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/
 
Remove these adsRemove these ads by Signing Up
1-40 of 136Next »
zx lee9 months ago

Thumbs up, great explanation, great instructables :D

fredkylam9 months ago

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?

MCUman1 year ago
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?
JHSTUBA1 year ago
Is the 10k resistor nescessary?
Kamilon1 year ago
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:

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.
jigs8592 years ago
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...
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.
'earl2 years ago
Should be "clamp" Just saying.
eriknyquist3 years ago
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...
axeman9113 years ago
how do u upload code in C++ to the arduino???
kimchhour3 years ago
Hi sir i need to make board for matrix 8×32 .
axeman9113 years ago
instead of mic2981 would a decade counter work, or could we just out the pins directly on the arduino?
Atmega16 ?code Help PLZ
shanakaplus3 years ago
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:
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 "B00000000, x32" 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.
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.
sun5803 years ago
thanks its good
kalasas183 years ago

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. :)
ca.le3 years ago
Does anyone know if the matrix would work with an Arduino board????
ji394su34 years ago
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...
Suresh.D.M4 years ago
can we add shift registers to the column and shift the bit
pontikakis34 years ago
Where is the Font Set at http://en.radzio.dxp.pl/ks0108/ ?? Anthony
DanielIt5 years ago
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.
Thank's and keep up the good work!!
Hi;
I too tried with expanding 8x32 , it doesn't works as expected., Any one can help me,
knektek4 years ago
Could you use a whole load of transistors? For switching something else? Maybe an array of motors or switching relays?
greekwow4 years ago
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)
ndinitz4 years ago
 can this be done using parallel load shift registers or does it have to be done with serial load.

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...
rammbo694 years ago
Both are 20 pF.
malth915 years ago
a very informative and interesting site
roketlights5 years ago
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!!!
jeff-o5 years ago
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?
roketlights5 years ago
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. :)
hype15 years ago
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 :)
(removed by author or community request)
u just posted your email on the internet! prepare for spam...
he has misspelled his email ;) i think it has to be GMAIL
1-40 of 136Next »