Introduction: Led Matrix Project Using Shift Register and Pic16f628a Micro

Picture of Led Matrix Project Using Shift Register and Pic16f628a Micro

This is aproject to move words on led matrix display
we use
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
4-uln 2803
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

Picture of 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

Picture of 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.
 2-clock pin8
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.0=0 
porta.1=0 serial input low
porta.0=1
delay_ms(500)
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

Picture of ULN 2803 Ic


Description:
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.
Note:
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

Picture of Software and Programming

Hardware:
I use pic16f628a and made asimple programmer for it .
This programmer exist in this site :
https://www.instructables.com/id/Simple-JDM-PIC-Programmer/
it is very good and simple it can work with pic1684a,pic16f628a
Software:
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
http://www.mikroe.com/eng/categories/view/12/pic-books/

Step 5: Complete Circuit Diagram

Picture of Complete Circuit Diagram

I forget to add 8 resistance at portb 120ohm is good

Step 6: How to Show Words on Led Matrix

Picture of 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
delay_ms(500) delay
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 :
xn=x1
x1=x2
x2=x3
...
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

Picture of 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

Comments

AshkanK1 (author)2016-01-14

hi ... how we can Add a column in this project???

dulari (author)2013-03-28

hllo.. cn i get data sheet for 8x8 led dot matrix?
cn u gv link fr dat?
we r prform same dis project at our university

alzrc_13j (author)2011-04-02

hi sir gudevening...im also planning to make a 8x8 led matrix......but im using PIC16f877A and micro c for my program...somehow i got the scanning for the columns but i dont know how to make my image appear fixed.....i, using proteus also to simulate the program and my clock is 4mhz...i tried to make my code run in a 8mhz clock but the program is still the same..i used 10us sec for the delay but its still the same...hope you could help me

mansman (author)alzrc_13j2011-04-03

Hi
You don't want to move the words isn't it you want to display words only and not move

About This Instructable

60,357views

33favorites

License:

More by mansman:led matrix project using shift register and pic16f628a micro
Add instructable to: