Introduction: Led Matrix Project Using Shift Register and Pic16f628a Micro
This is aproject to move words on led matrix display
1-pic16f628a as microcontroller :cheap,program memory 2k,has internal oscillatror,two ports A,B and alot of things.
2-led matrix 8*8 rows common anode and columns common cathode
3-shift register i use 74ls164 it is simple than 74595 his job is scanning columns activate one at atime
every time maximum of eight led work so current=8*(15ma for every led=120ma
shift register can't sink this much current so we use uln .it can sink current up to 500ma
5-eight resistors 120ohm,pack resistors 10k
The Complete Circuit diagram is Shown
Step 1: Led Matrix Construction
ledmatrix is shown in pictures
to light aspecfic led we apply logic high(1) to anode and logic zero to cathode
so we make anode as data source and cathode as scanning (activate cathode of aspecfic column) so we connect anodes(rows) to portb and cathodes to uln and shift register
we discuss this later
Step 2: Shift Register 74ls164
We must shift register very well to make this project.In general shift register is used to extend microcontroller terminals he take 3 terminals from any port and give us 8 terminals.
This shift register is serial input parrel output takes data serially and output it by clock
shift register in simple words consist of :
1-two serial input A,B pin number(1-2)
two serial input is anded so we connect one of them to vcc (1) and other is serial input controlled by pic16f628a.
3-eight outputs QA to QH
4-clear pin 9 connect to vcc when connect to ground it clear output pins
5-vcc and ground pin 7 - 14
How it Works?
In the clock transition (0 to 1) it takes serial input and output it apply asecond clock make it shift first ouput to second and take input to first ouput and so on .
let porta.0 connected to clock of shift register
and porta.1 connected to serial input in order to make first ouput high we write this code in basic or c
porta.0=0 clock zero
porta.1=1 serial input
porta.0=1 clock high
delay_ms(500) delay period in ms to show ouput
porta.1=0 serial input low
this code shift first out to second and make first low and so on until 8 transitions
here is an example of using shift register simulation on proteus 7.6 program and code in basic language and hex file basic is very similar to c language and is easy
Step 3: ULN 2803 Ic
Eight-channel NPN Darlington array used to interface logic ciruits (i.e., microcontroller) to high-voltage, high-current devices like lamps, relays, and solenoids. The ULN2803A is capable of driving 500 mA into a single channel, up to 250 mA per channel with four channels active, and up to 125 mA with all eight channels active. ULN2803A outputs use clamp diodes for transient suppression to protect low-power microcontroller circuitry.
In this project we use ULN to sink current of leds because shift register can't sink this much current.
UlN is eight channel npn darlington transistor with open collector so aresistance (10k or 1k)must be connected to collector and then to vcc.
ULN acts as abuffer and inverter at the same time so we must consider that carefully because our code will inverted also.
In electrical terms, the ULN2803 uses the low level (TTL) signal to switch on/turn off the higher voltage/current signal on the output side.
uln is ic don't have vcc terminal in our case common pin don't connect to vcc just ground only. common is connected in case of driving motors which have back emf in coils.
Step 4: Software and Programming
I use pic16f628a and made asimple programmer for it .
This programmer exist in this site :
it is very good and simple it can work with pic1684a,pic16f628a
i use basic llanguage and mikrobasic pro for pic as compiler
basic is very simple and easy and there aren't big differences between it and c language.
There are very useful books for programming pic with basic language on this site
Step 5: Complete Circuit Diagram
I forget to add 8 resistance at portb 120ohm is good
Step 6: How to Show Words on Led Matrix
To illuminate specfic led we apply to it's anod 1(other anodes 0)and it's cathode 0(other cathodes 1) and so if we want to illuminate complete row or column .
if we want o illuminate first column
assume anodes connect to portb,cathodes to porta
code in basic:
porta=0xf7 activate first column
portb=0xff activate row
I think you understand the idea .In our project porta wil be replaced by shift register and uln .
To show words we activate first column and ouput data from portb take delay too small in microseconds (300us)
activate second column and output data take delay 300us and so on until eighth column and repeat this process by software the word will appear fixed .
we can do alot of amazing things with led matrix as we can draw any shape on led matrix and control it as we want.
I attach showing word simulation (hex file,schematic,code)
Simulation works on proteus 7.6 and may be 7.2
Step 7: How to Move Aword?
Ok we can show words,patterns on ledmatrix fixed not moving .The moving operation is simply shifting data to right or left according to direction of motion we want.
we make kinescope (like negative in camera ) we make any data we want to move like this
and will be more than 8 as we want and memory of microcontroller.
we represent it by x1,x2....................................xn
To move simply :
so on until end of our bar.
i wish you understand you must make effort and try this this will make you good and happy.
I will attach my code and simulation on proteus 7.6 and hex file
Avery important note ULN will not work on proteus so on proteus connect shift register directly to cathodes and anodes to portb and arrange code to again
when connect uln to experiment it really just invert code as uln is inverter i attach source code with uln inverted and worked with me.
Step 8: MY SHOw
This is my final project ,this is my first time to make atopic on instructables.
I did this because this project i make alot of effort to understand everything in it .
I wish this is good.
*E (-E/ 'DDG
We have a be nice policy.
Please be positive and constructive.