LED Matrix Display Project Report
Short Description
LED Matrix Display Project Report...
Description
KATHMANDU UNIVERSITY SCHOOL OF ENGINEERING DEPARTMENT OF ELECTRICAL & ELECTRONICS ENGINEERING
PROJECT REPORT
LED Matrix Display
Submitted To: Mr. Jeevan Shrestha Project Supervisor Department of Electrical and Electronics Engineering School of Engineering Kathmandu University
Submitted By: Kabool Neupane (EE1, 22017) Bigyan Chapagain (EE2, 22031) Praveen Shrestha (EE2, 22042) Manish Prajapati (EE2, 22048)
June 27, 2010
ABSTRACT The project LED Matrix Display is concerned with the construction of a two dimensional arrangement of LEDs in a rectangular arrangement for the purpose of displaying English Alphabets (Upper Case) and decimal numerals. The characters to be displayed are entered using a computer. Therefore, in this project the computer functions as an input device and LED Matrix Display functions as an Output device. A computer program shall also be included in the project to create a user-interface environment to enter the characters and numbers to be displayed.
i
ACKNOWLEDGEMENT We express our sincere thanks to our project supervisor Mr. Jeevan Shrestha for his kind support, encouragement and guidance throughout the course of our project work. It is because of his continuous support we were able to acheive much in this project work. We would also like to express our sincere gratitude to our project coordinator Mr. Samip Malla for his guidance on this project course. Similarly we would like to thank all the teachers and lab incharges who have helped us in every possible way. This project has helped us a lot in our understanding and experience. Besides, it has been a great excitement doing this project and we hope to achieve much more in future. We, therefore look forward to your kind support in the years to come.
ii
SYMBOLS AND ABBREVIATIONS A. Symbols Symbol Ω KΩ µs mA
Description Ohm Kilo ohm Micro second Milli ampere
B. Abbreviations Abbreviation LED PC IC PCB
Full Form Light Emitting Diodes Personal Computer Integrated Circuit Printed Circuit Board
iii
LIST OF FIGURES Fig. No. 1. 2. 3. 4. 5.
Title Block Diagram Parts of a LED The inner workings of LED Eye response to color LED Matrix
Page No. 2 4 4 5 6
6. 7. 8. 9. 10.
Transistor as a switch Pulse driven LED Pin configuration of 4017 Timing diagram of 4017 Cascade 4017
7 8 9 10 11
11. 12. 13. 14.
Parallel port Parallel port configuration IC 74244 Block diagram
11 12 13 14
15. 16. 17. 18. 19. 20. 21. 22.
Cascaded counter implementation Cascaded LED Matrix Code Protection circuit Flowchart of the program Flowchart to detect the column of matrix LED Matrix component setup Master transistor switch setup Output waveform from data pin 6
15 16 17 19 20 21 21 22
23. 24. 25. 26.
Output waveform from data pin 1 LED Matrix display LED Matrix display in PCB Gantt chart
23 24 27 29
iv
LIST OF TABLES Table No. 1. 2. 3. 4. 5.
Title Pin configuration of 4017 Ring counter sequence Port pins in our project Address of registers Cost Estimation
Page No. 9 10 12 13 26
v
TABLE OF CONTENTS
Abstract Acknowledgement Symbols and Abbreviations List of Figures List of Tables
i ii iii iv v
Chapter 1: Introduction 1.1 Background theory and Objectives 1.2 System overview 1.3 Methodology 1.4 Overview of the Report
1 1 2 2 3
Chapter 2: Technology and Literature Survey 2.1 Components used 2.1.1 LEDs 2.1.2 LED Matrix configuration
4 4 4 6
2.1.3 Transistor as a switch 2.1.4 LED Driving Circuit 2.1.5 Counter IC 4017 2.1.6 Parallel port 2.2 Software used
7 7 9 11 13
Chapter 3: System Analysis and experiments 3.1 System Analysis 3.1.1 System analysis
14 14 14
3.1.2 Overall description of the circuit 3.1.3 Computer Program 3.2 Mathematical calculation and experiments 3.2.1 Mathematical calculation 3.2.2 Experimental observation
15 18 21 21 22
Chapter 4: Product description and performance 4.1 Product description 4.1.1 Physical description 4.1.2 Cost Estimation
24 24 24 26
4.2 Product performance 4.3 Final product
27 27
vi
Chapter 5: Discussion and performance 5.1 Gantt chart Biblography Appendix A: Mathematical Calculations Appendix B: Computer program Appendix C: PCB Circuit Appendix D: Datasheets of components D1: Datasheet of BC548 D2: Datasheet of 1N4148
28 29 30 31 33 50 52
D3: Datasheet of SL100 D4: Datasheet of 74244 D5: Datasheet of 7408 D6: Datasheet of 74175 D7: Datasheet of 4017
vii
CHAPTER 1
INTRODUCTION 1.1 Background Theory and Objectives 1.1.1 Background Nowadays, we can see various ways of visual information everywhere. One of the most common sights that we can see today is the LED Matrix Display. Nowadays these are extensively used in streets, malls, buildings, parks and other public places. LED Matrix Displays have become a basic way of visual information since they are cheaper and more reliable than LCD displays and other expensive display devices. Now, considering the growing popularity of the LED Matrix display, we decided to construct a small home based PC controlled LED Matrix display so that it could be used for small household purposes as well as for various entertainment purposes. Therefore our project deals with the construction of a LED Matrix display whose input device is a computer. 1.1.2 Objectives This project mainly focuses on the following topics To study existing concepts and required materials related to a LED Matrix Display To design a proper circuit, for a LED Matrix Display, which is most suitable for our case. To create a computer program to enter data to be displayed by the LED Matrix Display. To make the program an user interface program.
1
1.2 System Overview
Control Row
Counter
Computer Control
Control Column LED Matrix Display
Power Flow Figure 1: Block Diagram
Signal Flow
The Operational framework of the LED Matrix display is shown in Figure 1. The figure illustrates that the computer port controls the rows of the matrix and the columns are controlled by the counter. Furthermore, Computer triggers the counter of the circuit. This helps in synchronizing the timing pulse of counter with the computer signal.
1.3 Methodology In order to complete this project work we have taken help from various books, magazines, websites, and by consulting to teachers and seniors. The procedure taken for the successful design and operation of LED Matrix Display comprises of mainly two parts i.e.
Hardware part Software part
1.3.1 Hardware Part For hardware part, the following procedures were taken: - Firstly literature survey was conducted. - Different approaches to the circuit design were considered and the best was chosen. - The circuit was implemented on a bread board. - Various experiments were undertaken. - The overall system was analyzed. - Constantly, the circuit in bread board was upgraded to get the best performance. - Finally, the circuit was completed in PCB, obtaining successful output.
2
1.3.2 Software Part For software part, we applied the following procedures. - The user interface program was decided to be implemented in C programming language. - The algorithm for the program was discussed. - Then the program was written and implemented in virtual LED Matrix environment. - For simplicity and user friendliness, the program was further modified with function modules. - The program was implemented in the hardware part. - Various problems were encountered, and solved. - Finally the successful output was obtained.
1.4 Overview of the report This report gives an overview of the project “LED Matrix Display”. In the next pages, we will discuss about the processes involved in the project. We will also be dealing with the technologies used. This report also discusses about the C program implementation on accessing and controlling the parallel port. To sum up, this report gives any reader a complete overview of our project on “LED Matrix Display”.
3
CHAPTER 2
TECHNOLOGY AND LITERATURE SURVEY
This project can broadly be divided into two sections: Software part: Software part includes programming design for the system. In this part, a C program is developed in order to send information to LED Matrix from PC via the parallel port.
Hardware part: Hardware part includes the design and construction of the hardware parts of the system. Design of LED Matrix and construction of supporting elements like development of ring counter, implementation of transistors as switch and LED driving circuits are included in this portion. Firstly, we will discuss about main components used in the circuit and their structure. Later on, their working mechanisms and their effect in the circuit will be discussed.
2.1 Components used 2.1.1 LEDs As the name implies, a Light Emitting Diode (LED) is a diode that gives visible or invisible (infrared) light when energized. LEDs are diodes usually constructed by GaAs. In such semi-conductor p-n junction, during the recombination of holes and electrons, the energy is dissipated in the form of photons resulting in the emission of light.
Figure3: The inner workings of LED
Figure2: Parts of a LED aaaaALELlLLED
4
The color of the LED used for the LED Matrix Display is red. The reason we have selected this LED is because it is known that human eyes are least sensitive to red color. In other words, shades of red light are least sensitive to our eyes. This implies that slight variation in the brightness of the red LED lights will mostly go unnoticed by our eyes. This fact is crucial in our product since we require constant brightness of all LEDs. Even though considerable thought and careful designing has been done to maintain constant brightness, it is nevertheless probable that slight error will arise, due to imperfect and non-uniform electronic components, which is inevitable. Therefore, red lights provide the perfect solution for this problem. GREEN
RED BLUE
Figure 4: Eye Response to color Figure 4 illustrates that RED and Blue lights are least sensitive to human eyes. While this fact is advantageous to our product as discussed earlier, it however implies that a red LED must have a much stronger efficiency than a green one to be visible at the same intensity. It means that sensitivity to wavelength and sensitivity to intensity are different. For a green LED and red LED to be of equal intensity, the latter‟s efficiency should be greater or in other words power transfer should be greater. Considering this fact it is ensured that optimum intensity of the red LEDs used in the product has been maintained under safe limits. Generally Red LEDs are constructed using GaAsP and their threshold voltage is usually 1.3 V.
5
2.1.2 LED Matrix Configuration: The dimension of LED Matrix chosen for our project is 5×5. It is chosen since it is relatively easy to design a character or a number in such configuration. Furthermore, since the project implies the use of parallel ports with 8 output pins, the matrix can be friendly for the port interface. In any case, a LED matrix with 5×5 dimension implies controlling of 25 LEDs at any time. To reduce this difficulty the configuration of the LED matrix is done in following way:
Figure 5: LED Matrix Configuration The configuration shown in figure 5 allows reduction of points to be controlled for the LED Matrix Display. Instead of controlling each individual LED, the configuration allows us to control entire row and column at any instance. In the configuration, the anodes of the LEDs are connected along a row and the cathodes are connected along a column. This allows control of an individual LED in any instance. For example, if we wish to control a LED at position 2×2, we can do it by controlling voltage supply at 2nd row and ground supply at 2nd column. In this way any LED in the matrix can be controlled. In case of 5×5 LED matrix, this configuration reduces the control points to 10 from 25. For further reduction of number of control pins, we have used a counter to automatically control entire column. By doing so, the control pins are further reduced to half.
6
2.1.3 Transistor as a Switch Transistor is a three layer semi-conductor device consisting of either two n- and one p-type layers of material or two p- and one n-type layers of material. Both types can be used for switching purpose. In such application a transistor works in saturation and cut off mode. The transistor we have used in the project is an npn type transistor BC548. This transistor has been used for switching purpose. It is set in common emitter configuration. The reason behind the use of transistor as switch is to control the power supply to the LEDs. VCC VCC
1
3
2
0
Figure 6:2 Transistor as a switch Common configuration for tran
istor as a switch 2.1.4 LED Driving Circuits: LEDs are current driven elements. It requires a constant current in order to maintain constant brightness. A LED Driving Circuit is a circuit that is designed to maintain constant brightness in LEDs.
LED Driving Circuit: - Delivers a constant „average‟ current under all conditions. - Controls ripple current at acceptable level under all conditions. - A LED Driving circuit is a type of power conversion circuit that delivers constant current instead of constant voltage.
If a constant current is not maintained, a pulse circuit can be designed to generate maximum brightness from a LED without damaging it.
7
Pulse Circuit: - A sufficient current pulse for the maximum brightness of a LED is sent at a suitable frequency. - The pulse duration saves a LED from over heating by sending the average of current pulses while maintaining the brightness of a LED. - The pulse duration and synchronization is maintained by providing the same timing pulse of computer signal to the counter. 11
Column connected to counter output Code protection output 1
Rows controlled via parallel port
2
3
4
5
7
VCC 5V
Figure 7: Pulse Driven LED
8
Brief Description: The previous diagram represents the configuration of the LED driving circuit at any instance of time. Since any column is controlled by a counter, no two columns can be active at a same time. Therefore at any instant only one such column is active. Now the transistors controlled by the parallel port provide a constant current to each LED connected to it. This configuration is thus better than the previous ones, which we have implemented, which failed to ensure constant current to each LED at all conditions. The new configuration along with the pulse driving circuit thus ensures better results. 2.1.5 Counter (IC 4017)
Figure 8: Pin configuration of IC 4017 PIN NO.
SYMBOL
NAME AND FUNCTION
3, 2, 4, 7, 10, 1, 5, 6, 9, 11
Q0 to Q9
decoded outputs
8
GND
ground (0 V)
12
Q5-9
carry output (active LOW)
13
CP1
clock input (HIGH-to-LOW, edgetriggered)
14
CP0
clock input (LOW-to-HIGH, edgetriggered)
15
MR
master reset input (active HIGH)
16
VCC
positive supply voltage
Table 1: Pin configuration of IC 4017
The 4017 counter has ten outputs which go high in sequence when a source of pulses is connected to the clock input and suitable logic is applied to Reset and Enable inputs. Internally 4017 contains five bistable subunits. These are interconnected in a pattern known as Johnson counter. The Johnson Counter is a counter in which the Q‟ output of last F/F is connected to the serial input of the first stage. The outputs of bistables are then decoded to give ten individual outputs. 9
The timing diagram for the 4017 counter is shown below:
Figure 9: Timing Diagram of 4017
The behavior of a 3 stage Johnson Counter can be understood as following: (ALL F/F is reset in the beginning) Clock Pulses
D Input
Output A
Output B
Output C
0
1
0
0
0
1
1
1
0
0
2
1
1
1
0
3
0
1
1
1
4
0
0
1
1
5
0
0
0
1
6
1
0
0
0
Table 2: Ring Counter sequence
5 stage Johnson counter has 10 decoded outputs (2n output states). The decoder uses 2 input NOR gates to give 10 decoded outputs.
10
Cascading 4017:
Figure 10: Cascaded 4017
It is essential not to enable the counter on CP1 when CP0 is HIGH, or on CP0 when CP1 is LOW as this would cause an extra count. We cascade the 4017 IC for extending the number of decoded outputs. Decoded outputs are sequential within each stage and from stage to stage with no dead time (except propagation delays). 2.1.6 Parallel Port Introduction Parallel port is a type of interface located at the back of PC used for communication and device control. Usually, it is used for connecting printer, so also called printer port or centronics port. The type of parallel port present in the computer is D-Type 25 Pin female connector. There may be also be D-Type 25 pin male connector. Since it is easy to program and faster compared to other ports, nowadays it is very much popular for controlling external devices. But the main disadvantage of parallel port is it requires more number of transmission lines, so it cannot be used for long distance communication and is so used for short distances only. In our project, it is used as the bridge between the hardware component and the software component.
Figure 11: Parallel Port
11
Pin Configuration In parallel port, all 8 bits of a byte will be sent to the port at a time and an indication will be sent in another line. For the accomplishment of this task, the 25 pins are grouped to various groups to accomplish the parts of this task. The below given figure illustrates it better.
Figure 12: Parallel port configuration For the above figure, it is clear that the port is composed of 4 control lines, 5 status lines and 8 data lines and the rest of pins are for ground. The data lines send the data from port to the external device. Status lines give the information about the current status of the port and control lines control the port access. The control lines and status lines are uni-directional i.e. they can feed data only into one direction, whereas the data ports are bi-directional. Under our project, the port pins are used for respective purposes: Register
Pin No.
Connected to
D0 to D4
2 to 6
Each row of the LED matrix starting from the bottom row.
D5
7
CP0 (CLK) of counter
D6
8
MR(Master Reset) of counter
D7
9
Clock to D Flip flops
S6
10
Any one counter output connected to a column.
GND
18 to 25
Ground
Table 3: Port pins in our project Brief Description on parallel port setup The data pins connected to the rows of the LED matrix (D0 to D4) are used to send data to the Led Matrix. D0 is connected to the lowest row, D1 is connected to the row above the one connected to D0 and so on. D5 data pin is connected to the CP0 of the counter. This pin thus provides the necessary clock pulse to the counter. 12
D6 data pin controls the Master Reset pin of the counter. This pin when high resets the counter to its starting condition irrespective of its present state. D7 data pin provides the clock pulses to the D flip flops which are used in the product for code protection of the LED Matrix. This is further discussed in the sections to be followed S6 status pin is used to detect an output pin of a counter which is connected to a column of the matrix. This status pin is used to determine the number of columns of the matrix. Pins 18 to 25 are shorted internally to provide a complete circuit for other pins. Thus they are used as ground for the parallel port. Besides these other pins are not used in the project. Port address For the programming, we require the address of the registers present in port. Usually, the port address starts with 0x378 in most of the computers. The addresses are in hexadecimal number system. The addresses for the different registers are given below. Registers Data (+0) Status (+1) Control (+2)
Address 0x378 0x379 0x379A
Table 4: Address of registers Parallel Port protection Parallel Port protection is necessary since it can supply and sink very limited amount of current. A little high current above certain limit may damage the parallel port. In our case parallel port protection is done using the buffer IC 74244.
Figure 13: IC 74244 2.2 Computer Program A C program was used to create a user interface program to control the parallel port. The two functions used to control the parallel ports are: outportb(PORT ADD,Data); (Sends one byte of data) inportb(PORT ADD,Data); (Reads one byte of data)
13
CHAPTER 3
SYSTEM ANALYSIS AND EXPERIMENTS 3.1 System Analysis 3.1.1 System Analysis
Computer Control
Control Row
Counter
Control Column LED Matrix Display
Power Flow Signal Flow Figure 14: Block Diagram The LED Matrix display has rows and columns connected separately in order to reduce the control bits. The rows are connected via transistors, used as switch, to the parallel port. So the rows of the matrix are controlled by the computer. Similarly the columns of the matrix are connected via transistors, used as switch, to the counter. Therefore, the columns are controlled by the counter. The counter consists of 3 cascaded 4017 with 23 working output pins. Therefore, the cascaded counter is used to produce 23 bits ring counter. In order to display certain character, it is necessary to synchronize the counter triggering and data sent via parallel port. A certain combination of data is sent through the port and displayed on first column. When another bit combination is sent it is necessary to trigger the counter so that the bit pattern is displayed on second column and so on. A particular problem may arise when the computer is restarted. Whenever a computer is restarted, the BIOS sends high bits to all parallel port pins. This may cause a problem to the LED matrix since the first column is lit at this condition. In order to prevent this we have designed a circuit which we have named code protection. In this method we have used two D flipflops whose outputs are Anded and given to a master transistor switch which acts as a switch to the whole Matrix. Now a certain bit pattern to clock input and D input of the D FFs will only set the transistor. Therefore, a particular bit pattern which acts as a code will only initialize the LED Matrix and prevent unnecessary lighting of the matrix.
14
3.1.2 Overall description of the circuit In this section, description and working of the entire circuit is provided. The description is done in separate parts of each major components of the circuit. Counter:
14 13 15
CP0 ~CP1 MR
O0 O1 O2 O3 O4 O5 O6 O7 O8 O9
3 2 4 7 10 1 5 6 9 11
~O5-9
12
4017BD_5V
14 13 15
CP0 ~CP1 MR
O0 O1 O2 O3 O4 O5 O6 O7 O8 O9
3 2 4 7 10 1 5 6 9 11
~O5-9
12
4017BD_5V
14 13 15
CP0 ~CP1 MR
O0 O1 O2 O3 O4 O5 O6 O7 O8 O9
3 2 4 7 10 1 5 6 9 11
~O5-9
12
4017BD_5V
CLOCK
Figure 15: Cascade Counter Implementation In cascading, the first decoded output of 1st IC resets the second 4017 IC and so on. Similarly, the last decoded output of the IC is ANDed with the master clock. Hence, the second IC gets clock as soon as the last decoded output of first IC is high. Since we have used 4 LED Matrix we require 23 output counter bits. So 9 bits are taken from first counter, 8 bits from second counter and 6 bits from third counter. Therefore the master reset of first counter is connected to output 7 of third counter. Therefore we have 23 bits output counter. The clock input the counter is given via the parallel port. Also, the Master Pin is also connected to the parallel port in addition to output 7 of third column.
15
LED Matrix display To Counter Ouputs O0
O1
O2
O3
O4
O5
O6
O7
O8
O9
LED MATRIX SWITCH
To Parallel Port via Buffer IC
R0 .....
R1 .....
R2
.....
..... R3 ..... R4
VCC 5V
Figure 16: Cascaded LED Matrix The transistors connected to the buffer IC control the Vcc supply to the LEDs. Similarly the transistors connected to the counter control the ground to the LEDs. Furthermore, the anodes of LEDs in a particular row are connected together to a single transistor controlled by parallel port. Similarly, the cathodes of LEDs in a particular column are connected together to a single transistor controlled by the counter. Therefore, we have a setup where we can control any particular row and column which was our objective. In order to display a certain character we need to synchronize the triggering of counter and the data sent through the parallel port. When a certain bit pattern is supplied one of the columns is lit. Now before the next pattern is supplied it is necessary to trigger the counter so that next column is initiated. Therefore when the next bit pattern arrives it is displayed on next column and so on. In order to synchronize the counter and the parallel port, the clock pulse to the counter is taken from the computer itself and not by external timer. The Master LED Matrix switch is used in order to control the entire LED Matrix Display. This is used in the code protection component which is described in the following section.
16
Code protection The code protection is used in order to prevent unnecessary switching on of the LED Matrix Display. One such condition arises when computer is restated. Similarly when operating software is loaded the parallel port may have unpredictable bit patterns. Furthermore, certain noise voltages may also initialize the LED Matrix. So, it is of prime importance that a design be made to prevent unnecessary lighting up of the LED Matrix Display. The design used for this purpose in our product is illustrated below: VCC 5V
LED MATRIX 10 11
SET
From data pin 7
8
Q
CLK
0
D
~Q
Master LED Matrix Transistor
Q
CLK
RESET 7
9
SET
D
12
~Q
RESET
D_FF
D_FF
From data pin 8
Figure17: Code Protection circuit In order to initialize the LED Matrix we need to supply logic 1 to data pin 7 and clock pulse to data pin 8 so that both FFs have high outputs. At this condition the transistor is on and the LED Matrix display has ground supply. Similarly in order to disable the LED Matrix display, we need to supply logic 0 to data pin 7 and clock pulse to data pin 8 so that any one of the FFs has 0 output. At this condition the transistor is off and the LED Matrix is relinquished from ground supply. When the LED matrix is in working condition, i.e. when characters are being displayed, the data pin 8 is at 0 pin all the time. Therefore there is no clock pulse to the D FFs and they are not affected. In this way we can control the entire LED Matrix Display at any time.
17
3.1.3 Computer Program: Considerable time in the course of this project work has been dedicated to the construction of a computer program to control the outputs of LED Matrix display. We have constructed a C program to control the LED Matrix. The features of our program are listed below: 1. Real-Time Display: Allows user to display characters on the matrix display in real time. 2. Scrolling Display: Allows user to scroll the characters on the matrix display. 3. Automatic detection of number of columns: A status feedback discussed above detects the number of columns automatically. This also detects if the hardware is turned on or not. It also follows that the program supports any number of columns as long as it can maintain a good clock frequency for persistence of vision. 4. Flexibility: The program is flexible in terms of variations. Any variation such as modifications to font style can be easily achieved. 5. Alphanumeric characters: Allows user to enter uppercase alphabets (A to Z) and numerals (0 to 9) along with few special characters (+, -, =).
Functions used in the program and their descriptions: int essentials() : Determines and Sets pre-requisites of the program void det_col(): Determines number of columns void det_mat(): Determines number of matrices void initials(): Sets default characters void real_time_disp() : Real-Time Display int real_time_screen(int *chlen): Real-Time's Menu Screen int scroll_disp(): Scrolling Display int scroll_screen(): Scrolling's Menu Screen void char_select(char tempch[],int strno): Selects entered characters and determines the bit pattern void extract(int *bit[],int chlen): Extracts the bit patterns and stores them separately void byte_dec(int *bit[], int dec[]): Generates decimal equivalence of the extracted bits sequentially void real_matrix(int dec[]): Sends data to data port void initmat(): Enables LED Matrix display void stopmat():Disables LED Matrix display
18
Flowchart of the program:
START
Esc
Menu Choice
STOP
1 or 2 Call essentials() Call det_col() YES
Column Detected ?
NO
Try Again ?
NO
YES Call det_mat() Call initmat()
2
Check Menu Choice
1
Call scroll_disp()
Call real_time_disp()
Call scroll_screen()
Call real_time_screen()
Call char_select() Call extract() Call byte_dec() Call real_matrix() 19 Figure 18: Flowchart of the program
Call stopmat()
Flowchart to detect the column of the matrix:
START
Status = 0?
NO Clock Pulse
YES Status = 1 Clock Pulse Count=Count+1
Status = 0?
NO
YES Column = Count
STOP Figure 19: Flowchart to detect the columns of the matrix The status line is connected to one of the counter outputs which is connected to one of the columns. When the output pin is high status becomes low. This initiates the counting sequence and it continues until the next state when status is again 0.
20
3.2 Mathematical Calculations and Experiments We have performed several mathematical calculations and experiments under this project in order to achieve correct outcomes. These calculations and experiments include: 3.2.1 Mathematical Calculations (All detail calculations are shown in Appendix A) 1. Required instantaneous current for maximum brightness = 0.2A 2. Calculation for Resistors i. For LED Matrix resistors
VCC VCC 5V
RC 5
RB1
Port via buffer
8
4
3.1V
1
0
2V 2
RB2 6
Counter
3
0
Figure 20: LED Matrix component setup RC = 15Ω RB1 = 333Ω RB2 = 2.2kΩ ii.
For Master Led Matrix transistor
VCC 5V
LED MATRIX RB
1
0
Master LED Matrix Transistor
Figure 21: Master Transistor switch setup RB = 645Ω
21
3.2.2 Experimental Observations Experiment 1: Output Pins of Parallel Port and Buffer IC Direct Port: 5.15V Corresponding Buffer Output: 6.1V Experiment 2: Voltage Drop across Diode (Red) Voltage Drop: 1.81V ≈ 2V Experiment 3: Frequency from the parallel port when data is sent From Data Pin 6 (Clock input):
Figure 22: Output waveform from data pin 6 Frequency observed: 1.515kHz.
22
From Data Pin 1 (Controls Row 1 of LED Matrix):
Figure 23: Output waveform from data pin 1 Of any particular column On time ≈ 600us Total time period ≈ 14ms
23
CHAPTER 4
PRODUCT DESCRIPTION AND PERFORMANCE 4.1 Product Description 4.1.1 Physical Description The main purpose of this project “LED Matrix Display” is to display the alphanumeric characters. It is used as a basic way of visual information. These are best used to advertise, display news on streets, malls, buildings, parks and other public places. However our product is designed for small purposes such as calculators and games. The final product consists of LEDs arranged into 2 dimensional, 5×5 matrix. There are 4 such matrices with three additional columns, a D25 male connector for connection between the parallel port of pc and the display device, LED Matrix Display.
Figure 24: LED Matrix Display in PCB
Feature of LED Matrix Display The final product of LED Matrix display can be divided into two parts: They are: Hardware part and software part. Hardware part Code protection: The code protection feature prevents unwanted lighting of the LED Matrix under certain conditions such as computer restart and noise. This therefore ensures safety of LEDs.
Maintenance of constant current in the LEDs: The constant current is maintained in each LEDs of the LED Matrix, Hence this provides equal brightness of LEDs when it is on.
Absence of high level circuits: The circuit is build up by using simple electronic components like transistors and counter ICs. Advanced components such as microcontrollers which are usually used to construct LED Matrix display are not used. Hence, this feature helps to reduce the price of our final product.
24
Software part
Real-Time Display: Allows user to display characters on the matrix display in real time.
Scrolling Display: Allows user to scroll the characters on the matrix display.
Automatic detection of number of columns: The computer program detects the number of columns automatically. This also detects if the hardware is turned on or not. Similarly it indicates if the parallel port is connected or not. It also follows that the program supports any number of columns as long as it can maintain a good clock frequency for persistence of vision.
Flexibility: The program is flexible in terms of variations. Any variation such as modifications to font style can be easily achieved.
Alphanumeric characters: Allows user to enter uppercase alphabets (A to Z) and numerals (0 to 9) along with few special characters (+, -, =).
25
4.1.2 Cost Estimation Cost Estimation of “LED Matrix Display” Hardware Cost Item LEDs Transistor (BC548) Transistor (SL100) IC 74244 IC 4017 IC 7408 IC 74244 Holder IC 4017 Holder IC 7408 Holder Zener Diode Resistor (2.2kΩ) Resistor (10Ω) Resistor (300KΩ) Resistor (450Ω) Resistor (3.3KΩ) PCB Board (6‟×6‟) TOTAL
Quantity 150 29 1 1 5 1 1 5 1 5 23 5 5 3 1 1
Rate 1.5 4 20 65 40 30 30 10 10 5 1 1 1 1 1 300
Table 5: Cost Estimation Software Cost LED Matrix Software = Rs.2500 Labour Cost Labour cost per hour = Rs. 8 Total hour worked per week = 6 hours Labour cost per week = Rs. (8×6) = Rs. 48 Labour cost per month = Rs. (48×4) = Rs. 192 TOTAL LABOUR COST of 8 months = Rs. (192×8) = Rs. 1536 TOTAL COST without profit = Rs. (1108+2500+1536) = Rs. 5144 Profit 5% profit = Rs. 257.2 TOTAL COST with profit = Rs. (5144+257.2) = Rs. 5401.2
26
Price (Rs.) 225 116 20 65 200 30 30 50 10 25 23 5 5 3 1 300 Rs. 1108
4.2 Product Performance Algorithm 1. Connect the parallel port cable to parallel port of the computer. 2. Give 5V DC supply to the circuit. 3. Run the program and follow the menu instructions. When the above procedure was followed the LED Matrix display worked properly. The LEDs were lit with constant brightness and the Matrix did not turn on in unwanted conditions.
4.3 Final Product.
Figure25: Final Product
27
CHAPTER 5
DISCUSSION AND CONCLUSION The final product of our project has been done on a PCB board. The final product represents the design concept of our product. The same concept can be utilized to construct other LED Matrix displays for other purposes such as calculators and LED Matrix display game. We have tried to make our product better in every possible way. For this we have spent considerable time and put on a lot of effort on it. In the course of the construction of the LED Matrix display we feel that we have achieved much knowledge and acquired immense experience. The following is the list of work accomplished during the project course: Work accomplished: - Literature survey on existing LED matrix displays and related materials. - Designing a proper LED Matrix display circuit most appropriate for our purpose. - Creating a C program to enable user interface between the hardware and the computer. - Fabrication of the circuit on a PCB board. Though we have tried to make the product as complete as possible there is always room for improvements. The major improvement that can be done in the software portion is constructing a proper delay function to ensure proper frequency. In our case we have devised a proper way to maintain appropriate frequency which however can be computer dependent. When a proper delay function is devised one can also create a program which can set the on-time and off-time automatically to set proper frequency automatically for any number of columns. In further improvements, the C program can be made compatible for Windows NT and higher systems. In hardware portions suitable parallel port slot and dc supply slot can be created to make the product portable. Therefore considering all the facts discussed in this report, it can be assured that our product works properly and is reliable. The product is quite unique in the sense that the design concept is in many ways different from that of existing LED Matrix displays. Thus in the allocated time we have successfully completed our project work and come up with a fine product.
28
5.1 Gantt Chart March
April
May
June
Proposal writing Proposal defense Literature review Prototype design Testing and Implementation Final presentation
Work Completed Work Remaining
Figure 25: Gantt chart
29
Bibliography • • • • •
Boylestad, Robert L & Nashelsky, Louis. „Electronic Devices and Circuit Theory‟. 9th edition. Prentice Hall. India. 2008 http://en.wikipedia.org/wiki/Led http://www.doctronics.co.uk/4017.htm http://electrosofts.com/parallel/parallelwin.html http://logix4u.net/Legacy_Ports/Parallel_Port/A_tutorial_on_Parallel_port_Int erfacing.html
30
APPENDIX A
MATHEMATICAL CALCULATIONS 1. Calculation for required instantaneous current for maximum brightness V
t
600us Iav = Since Iav =
14ms
=8mA
Iins =
=0.18A =0.2A
2. Calculation for Resistors (i) For LED Matrix resistors
VCC VCC 5V
RC 5
RB1
Port via buffer
8
4
3.1V
1
0
2V 2
RB2 Counter
6
3
0
We have, Isat = 0.2A Now, RC = =15Ω IB1 =
=
=5.2×10-4A
31
We take IB1, slightly greater i.e. IB1 =6×10-4A Now, RB1 =
=333.33Ω
So, we have used 310Ω resistor. Similar for RB2, RB2 =
(ii)
=2.6kΩ ≈2.2kΩ
For Master LED Matrix transistor
VCC 5V
LED MATRIX RB
1
0
ICsat =0.2×5 =1A IB1 = =6.67×10-3A Therefore, RB =
=645Ω
32
Master LED Matrix Transistor
APPENDIX B
COMPUTER PROGRAM /*LED MATRIX DISPLAY PROGRAM FOR MATRIX OF 5 ROWS*/ #include #include #include #include #include #include #include #define PORT 0x378 /* PORT'S REGISTER ADDRESS */ #define ON_TIME 1 #define OFF_TIME 0 #define ROW 5 int **byte; char check; int COL; int MAT; int charlen=100; char ch[100];
/* Stores character patterns */ /* Checks choice in menu */ /* No. of columns */ /* No. of matrices */ /* Maximum number of characters */
int essentials(); void det_col(); void det_mat(); void initials();
/* Determines and Sets pre-requisites of the program */ /* Determines number of columns */ /* Determines number of matrices */ /* Sets default characters */
void real_time_disp() ; int real_time_screen(int *chlen); int scroll_disp(); int scroll_screen();
/* Real-Time Display */ /* Real-Time's Menu Screen */ /* Scrolling Display */ /* Scrolling's Menu Screen */
void char_select(char tempch[],int strno); determines the bit patterns */ void extract(int *bit[],int chlen); them seperately */ void byte_dec(int *bit[], int dec[]); extracted bits sequentially*/ void real_matrix(int dec[]); void initmat(); void stopmat();
/* Selects entered characters and /* Extracts the bit patterns and stores /* Generates decimal equivalence of the /* Sends data to data port */ /* Enables LED Matrix */ /* Disables LED Matrix */
33
int main(){ while(1){ clrscr(); gotoxy(30,20); printf("Please enter a choice:\n"); gotoxy(31,22); printf("1: Real Time Display\n"); gotoxy(31,24); printf("2: Scrolling Display\n"); gotoxy(36,28); printf("Esc: Exit:\n\n"); gotoxy(40,30); check=getch(); delay(100); if(check=='\033') return 0; if(essentials()==0) continue; initmat(); if(check=='1') real_time_disp(); if(check=='2') scroll_disp(); stopmat(); outportb(PORT,0); } outportb(PORT,0); free(ch); free(byte); return 0; } void initmat(){ outportb(PORT,0); outportb(PORT,64); delay(10); outportb(PORT,192); delay(10); outportb(PORT,64); delay(10); outportb(PORT,192); delay(10); outportb(PORT,64); delay(10); outportb(PORT,0); }
34
void stopmat(){ outportb(PORT,0); outportb(PORT,0); delay(10); outportb(PORT,128); delay(10); outportb(PORT,0); delay(10); outportb(PORT,128); delay(10); outportb(PORT,0); delay(10); outportb(PORT,128); } int essentials(){ int i; char chtry; while(1){ det_col(); if(COL==-1){ /* Column not detected */ clrscr(); gotoxy(33,20); printf("Column not detected\n"); gotoxy(24,23); printf("Please check the connection and try again"); gotoxy(30,28); printf("Press any key to try again"); gotoxy(29,30); printf("Press Esc to return to menu"); gotoxy(42,32); chtry=getch(); if (chtry=='\033') return 0; else continue; } det_mat(); initials(); byte=(int *)malloc(charlen*sizeof(int*));/*Create memory to store bit patterns*/ for(i=0;i
View more...
Comments