A 64-by-8 Scrolling Led Matrix Display System
-
Upload
samson-kayode -
Category
Technology
-
view
2.017 -
download
6
Transcript of A 64-by-8 Scrolling Led Matrix Display System
64-BY-8 SCROLLING LED MATRIX
DISPLAY SYSTEM
BY
KAYODE SAMSON O.
PHY/08/5031
A FINAL YEAR PROJECT REPORT SUBMITTED TO
THE DEPARTMENT OF PHYSICS (ELECTRONICS),
SCHOOL OF SCIENCES,
FEDERAL UNIVERSITY OF TECHNOLOGY, AKURE, ONDO STATE, NIGERIA.
IN PARTIAL FULFILMENT OF THE REQUIREMENT FOR THE AWARD OF
BACHELOR OF TECHNOLOGY (B.TECH) IN PHYSICS.
MARCH, 2014.
DECLARATION
I, KAYODE SAMSON OLUWATOYOSI, a student of the department of physics,
school of sciences, Federal University of Technology Akure, hereby declare that this practical
project was done by me and my colleague, OGUNLOWORE BUSAYO, under the
supervision of Dr. E.A ODO, in partial fulfillment of the requirement for the fulfillment of
bachelor of Technology (B.Tech) in Physics. All sources of information quoted and otherwise
were duly acknowledged.
…………………………
KAYODE SAMSON O.
(PHY/08/5031)
i
CERTIFICATION
I certify that this project work was carried out, prepared and reported by KAYODE
SAMSON O. with matriculation number PHY/08/5031 at the Department of Physics, Federal
University of Technology, Akure, Ondo State, Nigeria.
………………………….
KAYODE SAMSON O
Student
……………………………………..
DR. E. A. ODO
(Project Supervisor)
ii
DEDICATON
This project is dedicated to Lt. ALADE FISAYO
He was a friend and he was like a brother. He was also the founder of a music ministry
tagged Zion Dwellers Acappella in which Kayode Samson is part of.
iii
ACKNOWLEDGEMENT
Beautiful helps from expensive wells of beautiful minds at different Futa-times. To
constellation of mentors and teachers, who taught the cumulate art of writing, speaking, fast
and accurate thinking, this write-up owes its success.
And the guiding and well concerned supervisor- Dr. E.A. Odo, with his patient
attitude of taking a step at a time, trained my hand, improved my intellects and made the
work less mysterious; just as easy and unique as he is.
With a few other names in mind amongst a legion: Ogunlowore Busayo, my project
colleague, for his all supportive attitudes; my roommate for his advice and encouragement;
my parents Mr. and Mrs. Kayode for their encouragement and financial support; and Physics
class thirteen: a wonderful inspiration of colleagues.
Most importantly, I am acknowledging the Almighty God for his loving kindness over
me during this work.
iv
ABSTRACT
For this project, a prototype of a 64 x 8 LED matrix, capable of displaying a maximum of
eight (8) characters at a time was constructed. Then, scrolling the characters to show the
remaining part of the message and repeating the same loop over and over again was achieved.
This process can be interrupted by failure in the power supply or when the reset button is
being pushed and released. The system can easily be expanded to handle more characters.
The control of this LED matrix is based on a PIC18F4520 microcontroller. This
microcontroller was programmed using C language. The number of the microcontroller’s pins
used in controlling the LED matrix was strictly minimized to three by adopting the serial to
parallel mode of signal transmission. The design of the project was done and simulated with
Proteus software. The LED matrix was constructed on a vero board. The drive circuitry
which consists of the microcontroller, two ULN2803s, nine 74HC595s and other peripherals
was constructed on a printed circuit board. This was done to ensure the project was compact
as possible. Cost efficiency was also given a priority in the implementation of this project.
The project works as projected.
v
TABLE OF CONTENTS
Pg. no
Declaration i
Certification ii
Dedication iii
Acknowledgment iv
Abstract v
Table of contents vi
List of figures viii
List of tables x
Chapter one
1.0 Introduction
1.1 Motivation
1.2 Aims/Goals
1.3 Project report organisation
1
1
1
2
2
Chapter two
2.0 Literature review
2.1 Embedded System
2.2 Theory of LED matrix display
2.3 SPI bus interface
2.4 Printed Circuit Board (PCB)
2.5 A predisposition into this project
4
4
4
4
6
7
7
Chapter three
3.0 Detailed design and procedure (1)
9
9
vi
3.1.0 Hardware design
3.1.1 constructing the LED matrix
3.1.2 MCU
3.1.3 Reset/MCLR circuit
3.1.4 Oscillator circuit
3.1.5 Others
3.1.6 Shift registers
3.1.7 Column drivers
3.1.8 Row drivers
3.1.9 Power supply unit
3.2 The firmware
9
10
10
11
12
12
13
14
14
15
15
Chapter four
4.0 Detailed design and Procedure (2)
4.1.0 PCB design and fabrication
4.1.1 The design
4.1.2 Printing the design
4.1.3 Transferring image onto the copper-cladded board
4.1.4 Etching process
4.1.5 Drilling process
4.1.6 Board statistics
4.1.7 Mounting and soldering of components
4.2 Test and Result
20
20
20
20
20
21
23
23
23
23
26
Chapter five
5.0 Conclusion and recommendation
5.1 Conclusion
5.2 Recommendation
28
28
28
28
References
Appendix A: the main code block and the function code block
Appendix B: the SPI library- “74595ODODRV2_3matrix.c”Appendix C: ASCII font source code
29
30
32
33
vii
LIST OF FIGURES
Pg. noFigure 1.1: project organization using block diagrams 3
Figure 2.1: schematic view of 8 X 8 LED matrix 5
Figure 2.2: Display of letter A on a LED matrix 5
Figure 2.3: The two SPI slave configuration options 6
Figure 3.1: basic functional blocks of the design 9
Figure 3.2: joining the LED matrix boards after arrangement 10
Figure 3.3: PIC18F4520 pin description 11
Figure 3.4: Reset/MCLR circuit 12
Figure 3.5: oscillator circuit 12
Figure 3.6: LED circuit 14
Figure 3.7: power supply unit 15
Figure 3.8: SPI library code 16
Figure 3.9: detailed schematic view (1)
Figure 3.10: detailed schematic view (2)
18
19
Figure 4.1: proposed PCB top view in 3-D 22
Figure 4.2: proposed PCB bottom view in 3-D
Figure 4.3: PCB bottom layer design
Figure 4.4: PCB top layer design
Figure 4.5: image transfer on board using a laminating machine
Figure 4.6: Quenching process and removing paper
22
23
23
24
24
Figure 4.7: Removing paper from bottom layer 24
Figure 4.8: Top layer after paper removal 24
viii
Figure 4.9: Etching process showing the bottom layer 24
Figure 4.10: Etching process showing the top layer 24
Figure 4.11: Toner removed from surface before drilling 25
Figure 4.12: Drilling process 25
Figure 4.13: Board statistics 25
Figure 4.14: simulated design on Proteus 27
Figure 4.15: The actual completed PCB 27
Figure 4.16: Actual result of the project 27
ix
LIST OF TABLE
Pg. no
Table 3.1: MCU SPECIFICATION 11
x
CHAPTER ONE
1.0 INTRODUCTION
In optoelectronics, the use of light emitting diodes (LEDs) has been of great
importance. They are widely used in our day-to-day activities; as indicator light in power
supply devices; for information and image display in supermarkets, school campuses,
recreational centres, along roads and highways, in offices, residential buildings, in vehicles,
in aircrafts, etc. These devices that employ the use of LEDs are mostly microcontroller-based
systems. They appear very beautiful to the eyes. This 64 x 8 scrolling LED matrix display
system is a microcontroller based system.
From the name or title given to this project, it can be explained that the project entails,
firstly, the dimension, 64 x 8 which can be simply said as 64 columns by 8 rows arrangement.
Secondly, scrolling is the movement of text or graphics up or down or across a display screen
as if unrolling a scroll (Merriam Webster dictionary). Thirdly, LED is semiconductor diode
that emits light when a voltage is applied to it and that is used especially in electronic devices
(as indicator light) (Merriam Webster dictionary).Matrix, in this case, can be refers to as a
rectangular arrangement of circuit elements for performing a function. Display can be an eye-
catching arrangement by which something is exhibited. And finally, System is a regularly
interacting or interdependent group of items forming a unified whole.
Thus, it can be inferred that this project consists of 64 columns by 8 rows arrangement of
LEDs (forming a rectangular arrangement) and exhibiting an eye-catching movement of text
or graphics in which all group of required components interacts regularly forming a unified
whole.
1.1 MOTIVATION
This project was motivated by the proliferation of unprofessional matrix display seen
around the campus of FUTA. This signals a need for the design of a cheap but efficient
matrix display with capabilities captured in high technology matrix systems.
1
1.2 AIMS/GOALS
The aim of this work is to design a 64 x 8 LED matrix system with the under-listed
features.
Controlling the led matrix using Serial Peripheral Interface Input / Output SPI I/O transfer
technique only.
Minimizing, as possible, the number of I/O pins used on the microcontroller to control
512 (64 X 8) LEDs.
The display of any character or symbol contained in a message no matter how lengthy
the message might be as long as the EEPROM of the microcontroller will take.
Providing a learning curve on how to program a microcontroller using C language
Manufacturing a home-made PCB
And finally, getting the project work as projected.
1.3 PROJECT REPORT ORGANISATION
Five chapters were covered in the course of design and development of this project. The
chapters and their contents are as follows:
Chapter one is the introductory chapter that gives the motivation and aim of this work and an
overview of the project organization. Chapter two is the literature review. It deliberates on the
related works done by several authors with dates. It also discusses the theory of LED matrix.
It discusses the research work carried out on SPI bus interface and printed circuit board.
Chapter three discusses the detailed design procedure. It specifically illustrates how the
hardware design and the firmware were achieved. Chapter four discusses the continuation of
the detailed design and procedure. It elaborates more on the PCB fabrication. Test and results
are also discussed in this chapter. Finally, the summary of this project is discussed in chapter
five. It also contains the conclusion and recommendation.
2
..
Figure 1.1: project organization using block diagrams
3
PROJECT INTRODUCTION LITERATURE REVIEW DETAILED DESIGN AND PROCEDURE (1) –
HARDWARE AND THE FIRMWARE
DETAILED DESIGN AND PROCEDURE (2)-
PCB FABRICATION, TEST AND RESULT
CONCLUSION
AND
RECOMMENDATION
CHAPTER TWO
2.0 LITERATURE REVIEW
2.1 EMBEDDED SYSTEM
Definition: An embedded system is one that has computer hardware with software embedded
in it as one of its important components.
Typical examples of such embedded applications include common domestic appliances, such
as video recorders, microwave ovens and fridges. Other examples range from cars through
combine harvesters to aircraft and numerous defence systems.
There are four important features of many embedded applications.
1. Embedded applications employ microcontrollers for implementing complex processes in
a flexible and cost-effective way.
2. Unlike microprocessors, microcontrollers are required to interact with the outside world,
not via keyboard or graphical user interface but via switches, small keypads, LEDs and so
on.
3. Most microcontrollers are required to perform particular tasks at precise time intervals or
particular instant of time.
4. Embedded applications have safety implications. Hence, reliability is a crucial
requirement in many embedded application. (Michael, 2001).
From the four key features, it can be inferred that
Microcontroller is a key feature in an embedded system.
In the next few sections, the basic principle underlying LED matrix display is discussed
2.2 THEORY OF LED MATRIX DISPLAY
A dot matrix is a dimensional patterned array, used to represents characters, symbols
and images. Every type of modern technology uses dot matrices for display information,
including cell phones, televisions and printers. A LED matrix or LED display is a large
resolution form of dot-matrix display useful both for industrial and commercial information
displays. It consists of a 2-D diode matrix with their cathodes joined in rows and their anodes
joined in columns (or vice versa). By controlling the flow of electricity through each row and
column pair it is possible to control each LED individually. By multiplexing, scanning across
4
rows, quickly flashing the LEDs on and off, it is possible to create characters or pictures to
display information to the user. By varying the pulse rate per LED, the display can
approximate levels of brightness. The refresh rate is typically fast enough to prevent the
human eye from detecting the flicker. This was cited from Wikipedia (2014). Figure 2.1 is an
example of a common LED matrix design.
Figure 2.1: Schematic view of 8X8 LED matrix
Furthermore, figure 2.2 shows the alphabet A being displayed on a 5 x 6 LED matrix
Figure 2.2: Display of letter A on a 5X6 LED matrix.
5
To display the alphabet A as shown in figure 2.2, both column C1 is turn on while a sequence
of R1 = 1, R2 – R6 = 0 is placed on row R1 – R6. This enables the LED on rows R2 to R6 to
be turn ON while the LED or R1C1 is turned off. By placing appropriate sequence of bits
value on the rows while the desired pattern needed to display the alphabet A is executed.
2.3 SPI BUS INTERFACE
This is because it is the method used to completely control the LED matrix.
The Serial Peripheral Interface (SPI) bus dates back to the 1980. SPI is used for serial communication between a microcontroller or microprocessor and its peripheral ICs. SPI has the following four signal lines: Serial Clock (SCKL), Chip Enable or Select (CS), Serial Data Input (SDI), and Serial Data output (SDO). The microprocessor drives the CS & SCKL signal lines. SPI slave devices get their clock and chip select inputs from the microprocessor. SPI interface hardware contains shift registers. One shift register is used to receive data. The clocks are all synchronous and they use SCKL.
Multiple SPI devices can be connected in one of two ways. In a cascaded connection only one chip select is used. One device’s SDO line connects to another device’s SDI line as figure 2.3.
Figure 2.3: The two SPI slave configuration options
In the second SPI configuration, each device has its own chip select and they all function as independent shift registers. If a device is not selected it tri-states its output, so the output can be connected together but only one device at a time can be enabled. This allows independent reading and writing of the SPI devices. The disadvantage is that more than one output lines are needed for the chip selects. Note that SPI devices are designed for shorter distances such as on a single PCB. (James, 2007)
In this project, the cascaded connection as seen in the first configuration was used.
6
2.4 PRINTED CIRCUIT BOARD (PCB)
“A printed circuit board, or PCB, is used to mechanically support and electrically connect electronic components using conductive pathways, tracks or signal traces etched from copper sheets laminated onto a non-conductive substrate.” This is the definition as stated in Wikipedia and it is indeed true.
PCB fabrication can be fit into any one of the following:
Non-chemical methods Chemical methods
Using the second method employs the printing of the PCB design on a photo paper such as white glossy paper. This glossy paper is effective and recommended for PCB fabrication due to its nature. This photo paper is a category of inkjet paper designed specifically for the reproduction of photographs, which is extremely bright white due to bleaching or substances such as titanium dioxide, and has been coated with a highly absorbent material such as highly refined clay.
Review of previous studies reveals that many of the LED matrix controller design make possess many footprints. The use of 3-of-8 decoders, counters are also common. For instance, Ethan Byrd and Suneil Hosmane in 2003 designed a 16 x 8 LED matrix controller. The design of graphical user interface that can communicate with the controller was made. Some of the components used were M74C164 as shift registers and 74LS138 for scanning the rows. Also, Abu Ariu as a final project worked on the design and contruction of an electronic moving charge in the year 2012. Abu controlled a 30 x 7 LED matrix using AT89C52 microcontroller, 74HC54, 74HC244 and a counter 7460. Abu used assembly language to program microcontroller.
2.5 A PREDISPOSITION INTO THIS PROJECT
The correlations and inferences drawn from the review of various studies are listed
below:
Too many footprints was noticed in most of the works reviewed
From their line of codes, limitation in the amount of characters that can display at ones
was noticed. For instance, Abu’s led matrix controller can only process a maximum of
200 characters.
LED matrix dimensions are small which limits the number of characters that can be seen
at any given time.
Decoders such as 74LS138 or counters for scanning the rows were common amongst
these projects and many others.
7
Thus, with the above inferences and what seem to be mostly seen as common
features. The questions that arose out of many were
Must there be many foot prints?
Can a larger LED matrix be controlled with a microcontroller and shift registers only?
Can a unique code for making this SPI I/O transfer technique using C language be
written?
Can the design of a PCB for this work be achieved?
The above questions, as also partly seen in chapter 1 predisposes into this project.
In the next chapter and beyond, it will be seen in details how this was achieved, the
components selected and why these components were chosen.
8
CHAPTER THREE
3.0 DETAILED DESIGN AND PROCEDURE (1)
Before the detailed design and procedure, figure 3.1 shows an overview of the basic
functional blocks of the design.
Figure 3.1: basic functional blocks of the design
9
MCU
SPI DEVICES
ROW DRIVERS
LED MATRIX
ANODES
(COLUMNS)
CATHODES
(ROWS)
REGULATED POWER SUPPLY
3.1.0 HARDWARE DESIGN
The first step taken on the hard ware design was to build a LED matrix on a vero board.
3.1.1 Constructing the LED matrix
A 64 X 8 LED matrix was constructed on three vero boards. The boards were joined
together to fit using some adhesive and soldering methods. Figure 3.1 shows the joining
process of the vero boards.
As in most prototypes, the LEDs arrangement was done such that anodes form the columns
and the cathodes form the rows.
The method applied in doing this in order to avoid the use of connecting wires as jumpers
was to use dotted vero boards. And on these boards, the LEDs’ cathodes were soldered
together first for each row, and the anodes were bent over the cathodes with a reasonable
clearance to avoid shorted circuits. Then the cathodes were then soldered together to form
each columns.
Figure 3.2: Joining the LED matrix boards after arrangement
3.1.2 MCU
The Microcontroller Unit is the heart of the whole system.
Component Selection: As seen in the previous chapter, reliability is a crucial requirement of a
microcontroller. Other criteria in choosing a microcontroller are
Low cost and widespread availability
Reasonable ROM and RAM size
Small packaged size (foot print)
10
Easily reprogrammable
Low cost development tools with high-quality C compiler
Out of many others, the microchip PIC 18F4520 was chosen because it meet the above stated
criteria. Table 3.1 and figure 3.3 tells more about the PIC18F4520
Table 3.1 MCU SPECIFICATION
Parameter Name Value
Program Memory Type Flash
Program Memory (KB) 32
CPU Speed (MIPS) 10
RAM Bytes 1536
Data EEPROM (bytes) 256
Digital Communication Peripherals 1-UART,…,1-SPI…
Temperature (C) -40 to 125
Operating Voltage Range (V) 2 to 5.5
Pin Count 40
Figure 3.3: PIC18F4520 pin description
Detailed Design: the necessities for the MCU which constitutes a major part of the hardware
design are described in the next few subsections
3.1.3 Reset/MCLR circuit
This circuit is used to put the microcontroller into a ‘known’ condition. That
practically means that microcontroller can behave rather inaccurately under certain
undesirable conditions. In order to continue its proper functioning it has to be reset, meaning
11
all registers would be placed in a starting position. Pin 1 of the PIC18F4520 is the
reset/MCLR pin. Figure 3.4 shows the design for the Reset circuit.
In order to keep the ‘master clear’ or MCLR pin on a logical one as a preventive, a pull-up of
10k ohms was connected from the MCLR to the positive supply. A push-button was used as
the reset switch.
Figure 3.4: Reset/MCLR circuit Figure 3.5: Oscillator circuit
3.1.4 Oscillator circuit
This is the ‘heartbeat’ of the system. It is a crucial circuit which the MCU must have.
The type of oscillator we made use of in this project is called crystal oscillator. This crystal is
made of quartz.
Quartz is a common mineral and is the main component of most sand grains. It has a
useful quality that it is piezoelectric in nature, which means that if pressure is applied to a
piece of quartz, it will generate an electric current at a particular frequency. In some
materials, the converse is also true: application of an electric field will cause a mechanical
deflection in the material. This behaviour is what is used as the basis of a useful oscillator.
So in this project, an 8MHz oscillator with two 22pF ceramic capacitors to pins 13 &
14 of the microcontroller were used. Figure 3.5 shows the oscillator circuit.
3.1.5 Others
The MCU needs a regulated power supply. As seen from the pin description, we
connect pins 11 & 32 to +5V terminal of the power supply. And pins 12 & 31 are connected
to the ground terminal of the power supply. The capacitor between pins 12 and 31 is a
filtering capacitor. The capacitors are used to provide a steady state condition.
12
Other circuit to the controller is the ‘blink alive’ circuit. We added this to the design
so as to monitor the microcontroller i.e. to know if it is alive and running. If the
microcontroller is running, the two LEDs toggle between their ON and OFF states.
Pins 33, 34, & 35 were used in this project as the SPI interface to the shift registers.
3.1.6 SHIFT REGISTERS
As discussed earlier in this primer, that the basis of controlling the 64 by 8 LED
matrix is on the good application of the principle behind the SPI input/output transfer
technique. In achieving this for this project, shift registers were used. The kind of shift
registers used are known as SIPO (or serial input parallel output) devices. That is, they can
take data in through pin 14 and with a change of logic state from zero to one at pin 11; data is
shifted into the shift registers of the SIPO device. The SIPO devices used for this project
were 74HC595.
In order to control the 64 x 8 LED matrix, 64 + 8 = 72 control lines were employed.
Putting the goals in mind, one of the peripherals used to control the LED matrix is the shift
registers.
How was the control achieved? Each 74HC595 has 8 parallel output pins (i.e. pins 15, 1, 2…
7). Pin 9 is the data output pin. 74HC595 is an 8-bit shift registers. This implies that we have
to use 9 shift registers. 8 of these registers will responsible for sending the patterns to the
columns while the other one will be responsible for scanning the 8 rows.
Note that only three pins of the microcontroller were used to control these SIPO
devices. The shift registers were daisy-chained as seen from the schematic view in figures 3.9
and 3.10. The shift register and the storage register of 74HC595 have separate clocks: SH_CP
(pin 11) and ST_CP (pin 12). Data is fed serially into the register through the DS pin 14 and
shifted on the positive going transitions of the SH_CP. However, data in each register does
not appear at the output pins of 74HC595 unless it is transferred to the storage register of the
same device. This happens on positive going transition of the ST_CP input. The serial output
of the first shift register (pin 9) is connected to the serial input of the second shifted register
the trend follows like that till the ninth shift registers. This requires 72 clock pulses on the
SH_CP followed by a clock pulse on the ST_CP.
Note that the SH_CP of all the shift registers were paralleled before connecting to the
required microcontroller pin, likewise the ST_CP pins and the Enable pins. Pin 10 was
permanently connected to +VCC. See figures 3.9 and 3.10 for the detailed schematic view.
13
3.1.7 COLUMN DRIVERS
From the schematic design, shift registers; IC3, IC4, IC5, IC6, IC10, IC11, IC12, and
IC13 serve as the column drivers. They act as a current sourcing device for each column. At
the columns, logic 1 is required to forward bias the LEDs. A current limiting resistor of 150
Ohms was used on each output pin of the shift register.
3.1.8 ROW DRIVERS
Shift register (IC2) was used to control the LED matrix rows. But be reminded that
logic 0 is required at the row to switch on the required LEDs on that row. This implies that
IC2 must be able to sink current of at most 64 LEDs at a time. But this is impossible. Hence
we employed the use of two current sinking devices; ULN2803.
The inputs of the two ULN were paralleled and then connected in series with the
output of the shift register IC2. ULN2803 can sink a current up to 500mA and 600mA as its
absolute maximum. It is also an inverting device. Thus, the input into the ULN from the
required shift register must be at logic 1 which the ULN then inverts to activate the required
row.
Why the use of multiple Row drivers?
Calculation:
The complete circuit of each LED is shown as a schematic below:
Figure 3.6: LED circuit
The ULNs provide the ground path for each LED.
From the schematic above, 20 microampere and 2V is the current and voltage respectively
designated to reasonably light up each LED.
Applying the voltage law:
5V = 2V + 20 X 10-6 X R1
R1 = (5 – 2) / 20 X 10-6
R1 = 150Ω (Hence, the reason for choosing this for the resistor value to limit the flow of
current to about 15µA)
If on a row, the whole 64 LEDs were to be lighted up at the same time (though, this cannot be
possible). Then that implies that the total current that will be sunk to the ground will be:
14
15 X 64 = 1280 µA. But the ULN2803 can only sink a maximum of 500µA and 600µA on an
absolute. This is why multiple row drivers were chosen.
3.1.9 The Power Unit
An embedded system is as stable as its power supply. Hence a good choice of power
supply was made and the analysis of the design is given in figure 3.7.
Figure 3.7: power supply unit
A centre tap transformer was used. Four diodes were appropriately arranged as seen in the
full schematic design to give a full wave rectification. Two capacitors were used for better
smoothing and LM7805 was used to produce a regulated +5V.
3.2 THE FIRMWARE
Controlling the 64 LEDs with just 3 pins of the microcontroller and with the support of the
nine shift registers has made this firmware a spectacular one.
The C language is the programming language used for this project.
Why was C language chosen?
This language was chosen because
We are in the age of C.
It is great for putting ideas behind this work down.
It is very flexible.
Its development tools are readily available; we had choices.
The principle of lighting a LED in the matrix per time and doing that very fast at a high
frequency, say over a 100 cycles per second has been understood. The code becomes easier to
write. But the hitch arises in controlling the 64-by-8 LED matrix with only three I/O pins of
the microcontroller using SPI I/O transfer technique only.
Noting the following,
Nine shift registers were daisy-chained together in the schematic design
A signal is sent into the shift register if and only if the shift clock pulse pin (PIN 11)
of the shift register must change state from high to low.
15
An 8-bit value is serially transmitted into each shift registers until it got to the farthest
from the microcontroller if necessary.
Thus, this means a total of 74 bits will be sent from the MCU to the data pin of the
nearest shift register as seen in the schematic design.
Since a register can store only 8 bits, an overflow of bits into the next shift register
occurs.
A 74-bit pattern is sent and latched out of the nine shift registers at once to display on
each row.
This algorithm is transformed into the SPI code block. Figure 3.7 shows the SPI library
developed from the algorithm described above.
Figure 3.8: SPI library code
The codes were written using CCS C Compiler IDE. The main program block and the
scrolling function code block can be found in appendix A. A special library was written to
perform the whole SPI I/O transfer of the 74 bits pattern for each of the eight rows. And this
library was included in the main source file. The SPI library can be seen in appendix B as
well. A special library tagged ASCII.c was also included. Check appendix c for the ASCII.c.
This library contains the entire ASCII font characters in form of a table. Each character
pattern is represented by an 8-by-7 array.
16
The algorithm below explains and summarizes how the code was written.
Start
Initial configurations like variable declarations, including necessary header and source
files, and constants declaration, setup timers, enable interrupt both locally and globally,
etc.
Take the length or the number of characters contained in the string to be displayed.
For each row (starting from the first row) of each character contained in the string to be
displayed,
Call from the ascii table; the 8 bits that represent the pattern for that row
Move to the next character as long as the LED matrix can contain (about 8)
Shift the bits one after the other through the designated data pin of the
microcontroller by changing the state of designated shift clock pulse pin from up
to down.
Then latch out, at once, the overall pattern for that row by changing the state of
the designated storage clock pulse pin from up state to down state.
Repeat these processes until the 7th row pattern is displayed.
Then delay the display to make it appear stable to the eyes (persistence of vision).
Scroll the display until the whole character in the string to be displayed is displayed.
Loop over the whole process again and again forever. The process never terminates
until when interrupted either by the Master clear/Reset button or during power failure
interruption.
17
Figure 3.9: detailed schematic view (1)
18
Figure 3.10: detailed schematic view (2)
19
CHAPTER FOUR
4.0 DETAILED DESIGN AND PROCEDURE (2)
Before the continuation of the detailed design and procedure, figure 4.1 and 4.2 show the 3-D
view of the proposed PCB design. This was done using Proteus software.
4.1.0 PCB DESIGN AND FABRICATION
The under-listed processes show the step-by-step fabrication of the PCB.
4.1.1 The design: The development tools used for the design of the PCB were Easily
Applicable Graphical Layout Editor (EAGLE) and Proteus 8.0. EAGLE is a schematic
capture and PCB layout tool which was used for this project in designing the PCB layout.
First, the design of the schematic capture was done as seen in figures 3.9 and 3.10. Then we design the PCB layout using EAGLE. In order to reduce footprints and reduce the clumsiness of tracks, a double-layer PCB design was adopted and vias were designed to connect the two layers together on one board piece. Holes/drills dimension is about1mm in diameter. Hole-to-hole clearance is about 2.54mm, hole-to-pad clearance is about 1mm. Reasonable clearance was adopted for the easy manufacture of the PCB using chemical method. Signal trace is about 1 mm and the power trace was about 1.22mm. Power/ground plane is included in the design for good heat dissipation. The bottom layer design is shown in figure 4.3. The top layer is shown in figure 4.4. In order to visualize the PCB in 3-D, Proteus was used. Figures 4.1 and 4.2 show the top layer and bottom layer of the PCB in 3-D respectively.
4.1.2 Printing the design: The printing of the design was done on white glossy papers. Any magazine paper
could have been used. But for better and assured nice printing job, a white glossy unused paper was used. As seen in the literature review, the method employed in this project is what is known as toner transfer method. The printing on the glossy paper using an inkjet printer is not an option to adopt. This is because the image on the paper remains permanent on the paper and can never be transferred on the board. Hence, a perfectly functioning laser jet printer was used. Touching the surface of the paper before printing was avoided in order to prevent oil/finger prints on the paper.
Before sending the design to printer, the top layer was mirrored while the bottom was not mirrored. The design was finally sent to the laser jet printer with a magnification factor of 1
4.1.3 Transferring Image onto the copper-cladded boardThings are a little tricky here because the bottom layer has to be perfectly aligned
with the top layer. The following steps were followed in order to transfer the image on the board:
The double sided copper-cladded board was cut to the appropriate size.
20
The board was gently sandpapered to remove debris that can impede the proper transfer of toner.
The board was washed and rinsed with water. A white paper or a clean white piece of cloth was used to ensure that the surface was
clean. Though, acetone is preferable. The two glossy papers that contain the bottom and top layer designs respectively were
aligned unto the surfaces of the board. For proper heating and for uniform application of pressure, a laminating machine was
used to transfer the toner from paper to the board as seen in figure 4.5. We ascertained that the toner has been uniformly and completely transferred on the
surfaces. While still very hot from the laminating machine, the heated board + paper is dropped into a bucket full of water to undergo a quenching process.
After a few minutes, the paper is removed gently away from the board. The toner has now been successfully transferred from the paper to the board as seen in fig 4.6 through fig. 4.8.
21
Figure 4.1: proposed PCB top view in 3-D
Figure 4.2: proposed PCB bottom view in 3-D
22
4.1.4 Etching process: This process involves the remover of copper from areas which are not exposed to the toner. The areas exposed to the toner are the wanted area. The etching chemical used comprises of hydrochloric acid (HCl) and hydrogen peroxide (H2O2). The chemical is diluted with a little proportion of water and then poured into a flat tray. A Ferric Chloride solution can also be used.The board was dipped inside the etching solution as seen in fig. 4.9 through 4.10.Precautions taken, out of many, were wearing of gloves, not inhaling the fumes being emitted during the etching process and a close monitoring of the etching process was ensured.
After the etching process, the board was rinsed properly with water to remove every trace of the etching solution.
4.1.5 Drilling Process: After the etching process, the toner was gently sandpapered away to see the beauty of the traces and the board as a whole before drilling as seen in fig. 4.11 A small drilling press machine was used to make 497 drill holes on the board as seen in fig 4.12
4.1.6 Board statistics: Figure 4.13 shows the summary of the board statistics.
4.1.7 Mounting and soldering of componentsThe components were mounted on the top layer side of the PCB. The use of sockets was employed. Tiny wires were used as vias in ensuring continuity between the bottom and top layers.
Figure 4.3: PCB bottom layer design Figure 4.4: PCB top layer design
23
Figure 4.5: image transfer on board using a laminating machine
24
Figure 4.6: Quenching process and removing paper
Figure 4.7: Removing paper from bottom layer
Figure 4.8: Top layer after paper removal
Figure 4.9: Etching process showing the bottom layer
Figure 4.10: Etching process showing the top layer
25
Figure 4.11: Toner removed from surface before drilling
Figure 4.12: Drilling process
Figure 4.13: Board statistics
4.2 TESTS and RESULT
TEST
The first test that was carried out was to ensure the program will run as desired with the basic
Components using Proteus 8.0 software. Figure 4.12 shows the simulation of the design on
Proteus.
Several other tests were carried out after integration of the various subsystems together. Few
of these tests were the continuity test, power supply test, reset/master clear test, current
measurement, voltage measurement, etc. These were all carried out to ensure the proper
functioning of the components.
Challenges were encountered during this test but most of them were overcome. Challenges
encountered were broken tracks, the high amount of heat dissipated by voltage regulator, the
high overall amount of current sourced by the shift registers. LEDs malfunctioning due to
manufacturing problem. The transformer low output current was also a big challenge during
testing. Because this causes some LEDs not to be lighted up. Hence, a transformer with a
high current rating of 1000mA is used.
RESULT
The ideal result or the simulated Proteus design is shown in figure 4.10. This design does not
show the ULN2803s which serves as row drivers. This is because the LED matrix cannot
function as expected with ULN on Proteus. This is one of the software’s errors. Another
simulation without the LED matrix but using the ULN also works. The actual result of the
complete PCB manufacture is shown in figure 4.15.
Varying the refresh rate of the LED display from the code was carried out to choose the most
suitable refresh rate to the eye. For instance, when the refresh rate of the LED was 50 Hz, the
flicker was detected by the human eye. The display was very shaky to the eye, not attractive
and unreadable. When the refresh rate was adjusted to 80 Hz, the shakiness reduces. But
when increased to 100 Hz, the display appears perfectly still to the eyes. No flicker was
detected by the human eye. Figure 4.16 shows the actual result.
26
Figure 4.14: Simulated design on Proteus
27
Figure 4.15: actual completed PCB
28
Figure 4.16: actual result of the project
CHAPTER FIVE
5.0 CONCLUSION AND RECOMMENDATION
5.1 CONCLUSION
The set goals within this primer have been achieved, proving the feasibility of the display.
The prototype was extremely developed economically using vero boards and PCB on which
the components were mounted. Through this type of construction, modifications could be
easily made before entering into the development of larger scales, and more costly
prototypes.
Also, grateful knowledge was gained for approaching the programming of the
microcontroller in a way which is uniquely different from every other types of display
system. Manufacturing of the PCB was done using the toner transfer method. This document
details the process used in creating the design, detailing how it functions and suggest future
improvements and a basis for which a viable device of this kind can be develop in the future.
5.2 RECOMMENDATION
i. Due to the complications posed by the arrangement of the LED matrix on a vero board, I recommend or suggest that the LED matrix be done on a rubber sheet or using of ready-made LED dot matrix. This dot matrix can be mounted on a PCB
ii. The aim of this project was not to be able to alter the display from a keypad or Graphical User Interface (GUI). Thus, with a little addition of the required components and a little alteration/addition to the firmware, this can be achieved.
iii. Getting of the electronic components used for this project was stressful. Thus, to all university applying electronics in one way or the other, investment should be made on the situation of electronic shops where varieties of electronic components can be obtained within the school premises.
iv. Project like this is applicable for use in classrooms, recreational centres, homes, halls, etc. for information and or image display.
29
REFERENCES
Abu Ariu Anthony (2012), The Design and the Construction of an Electronic Moving Charge, a final year project, Federal University of Technology, Akure (FUTA), Nigeria.
James O. Hamblem (Jan. 2007), Introduction to Embedded Systems using Windows Embedded CE
Ethan Byrd and Suneil Hosmane (2003), Led Matrix Controller, senior design project, University of Illinois at Urbana-Champaign.
Micheal J. Pont (2013), Time-Triggered Embedded System, ACM press, pp 8-9,pp 53-66
Barney (2012), “LED matrix using shift registers”
(http://m.instructables.com/id/LED-matrix-using-shift-registers/)
Bill R. (2011), “LAB 12: Basics of LED dot matrix display”
(http:// embedded-lab.com/blog/?p=2478)
Amandaghassaei (2012), “.Multiplexing with Arduino and the 74HC595”
(http://www.instructables.com/id/Multiplexing-with-Arduino-and-the-74HC595/)
The free encyclopedia (2013), LED display, Wikipedia
The free encyclopedia (2013), dot matrix, Wikipedia.
Microchip (2008), PIC18F4520/4420/4520 Data Sheet, Microchip Technology Inc., DS39631E.
30
APENDIX ATHE MAIN CODE BLOCK AND THE SCROLLING FUNCTION CODE BLOCK
#include <mainDispDriver.h> #include <float.h> #include <math.h> #include <stdlib.h> #include <string.h> #include "74595ODODRV2_3matrix.c" #include "ASCII.c" #include "MovingBod.c" char TEXT []="Lord, we thank You for thus far...Singing for joy "; unsigned int8 FD[7][100]; unsigned int8 DATA,row,box; long Pop; unsigned int8 kad; #int_RTCC void RTCC_isr(void) output_toggle(PIN_D0); output_toggle(PIN_D1); //--------------------Variable definitions------------------------------------------ void Scroll(void); //--------------------------------------------------------------------------------- //---------------------Interrupts------------------------------------------------ //----------------------end Interrrupts--------------------------------------------- //-------------------------Functions------------------------------------------------ void Scroll(void) int HS; // variable to hold the Bit extracted from next char for(row = 0; row < 7; row++) // scan through the row for(box = 0; box< kad; box++) // scan through the coloum if(box < (kad - 1)) // Test for the box holding the last char HS = bit_test(FD[row][box + 1],7); //Extract the MSB of the char next else HS = bit_test(FD[row][0],7); //Extract the MSB of the First char
31
FD[row][box] <<=1; // Shift the coloum vectors one space left FD[row][box]|=HS; // Mask the vector with the extracted bit //-----------------------End functions----------------------------------------------- void main() setup_timer_0(RTCC_INTERNAL|RTCC_DIV_32); //1.0 s overflow enable_interrupts(GLOBAL); output_low(PIN_D0); output_high(PIN_D1); //-----------------Load the data for all the text to display------------ kad = strlen(TEXT); for(row = 0; row < 7; row++) for(box = 0; box< kad; box++) Data = TEXT[box]; FD[row][box] = Font[Data - 32][row]; //--------------------------end of load-------------------------------------- byte RWD[8]= 254,253,251,247,239,223,191,127; int tt=0; while(true) if (tt==0)movingbody(); //for(Pop = 0;Pop<22;Pop++) // byte s =0b111111110; for (CNT=0;CNT<7;CNT++) time_array[0]= ~FD[cnt][7]; time_array[1]= ~FD[cnt][6]; time_array[2]= ~FD[cnt][5]; time_array[3]= ~FD[cnt][4]; time_array[4]= ~FD[cnt][3]; time_array[5]= ~FD[cnt][2]; time_array[6]= ~FD[cnt][1]; time_array[7]= ~FD[cnt][0]; time_array[8]= ~s; shift_left(&s,1,1);
32
write_serial(time_array); // Scroll(); tt++; if(tt>248*kad)tt=0;
APENDIX BTHE SPI LIBRARY- “74595ODODRV2_3matrix.c”
#define EXP_DO PIN_B0 #define EXP_CLK PIN_B1 #define EXP_EN PIN_B2 #define NUMBER_OF_74595 9 void write_serial(byte* data) BYTE i,j; //byte kola = 0x80; output_low(EXP_CLK); output_low(EXP_EN); for(j = 0; j<NUMBER_OF_74595;j++) for(i=0; i<8;i++) output_bit(EXP_DO,shift_right(&data[j],1,0)); output_high(EXP_CLK); //clock out the data output_low(EXP_CLK); output_high(EXP_EN); output_low(EXP_EN); // Shift the the mask
APENDIX CASCII FONT SOURCE FILE- “ASCII.c”
//------------------------------------------------------------------ const char FONT[][7] = 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, // Space 0xFB,0xFB,0xFB,0xFB,0xFB,0xFF,0xFB, // !
33
0xF5,0xF5,0xF5,0xFF,0xFF,0xFF,0xFF, // " 0xF5,0xF5,0xE0,0xF5,0xE0,0xF5,0xF5, // # 0xFB,0xF0,0xEB,0xF1,0xFA,0xE1,0xFB, // $ 0xE3,0xEA,0xE5,0xFB,0xF4,0xEA,0xF8, // % 0xF7,0xEB,0xEB,0xF7,0xEA,0xED,0xF2, // & 0xF9,0xF9,0xFD,0xFB,0xFF,0xFF,0xFF, // ' 0xFD,0xFB,0xF7,0xF7,0xF7,0xFB,0xFD, // ( 0xF7,0xFB,0xFD,0xFD,0xFD,0xFB,0xF7, // ) 0xFB,0xEA,0xF1,0xFB,0xF1,0xEA,0xFB, // * 0xFF,0xFB,0xFB,0xE0,0xFB,0xFB,0xFF, // + 0xFF,0xFF,0xFF,0xF3,0xF3,0xFB,0xF7, // , 0xFF,0xFF,0xFF,0xF1,0xFF,0xFF,0xFF, // - 0xFF,0xFF,0xFF,0xFF,0xFF,0xF3,0xF3, // . 0xFF,0xFE,0xFD,0xFB,0xF7,0xEF,0xFF, // / 0xF1,0xEE,0xEC,0xEA,0xE6,0xEE,0xF1, // 0 0xFB,0xF3,0xFB,0xFB,0xFB,0xFB,0xF1, // 1 0xF1,0xEE,0xFE,0xF1,0xEF,0xEF,0xE0, // 2 0xF1,0xEE,0xFE,0xF9,0xFE,0xEE,0xF1, // 3 0xFD,0xF9,0xF5,0xED,0xE0,0xFD,0xFD, // 4 0xE0,0xEF,0xE1,0xFE,0xFE,0xFE,0xE1, // 5 0xF9,0xF7,0xEF,0xE1,0xEE,0xEE,0xF1, // 6 0xE0,0xFE,0xFD,0xFB,0xF7,0xF7,0xF7, // 7 0xF1,0xEE,0xEE,0xF1,0xEE,0xEE,0xF1, // 8 0xF1,0xEE,0xEE,0xF0,0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0xFF,0xF1,0xEE,0xEE,0xEE,0xF1, // o 0xFF,0xFF,0xE1,0xEE,0xE1,0xEF,0xEF, // p 0xFF,0xFF,0xF0,0xEE,0xF0,0xFE,0xFE, // q 0xFF,0xFF,0xE9,0xE6,0xEF,0xEF,0xEF, // r 0xFF,0xFF,0xF0,0xEF,0xF1,0xFE,0xE1, // s 0xFB,0xFB,0xF0,0xFB,0xFB,0xFB,0xFC, // t 0xFF,0xFF,0xEE,0xEE,0xEE,0xEC,0xF2, // u 0xFF,0xFF,0xEE,0xEE,0xEE,0xF5,0xFB, // v 0xFF,0xFF,0xEE,0xEE,0xEA,0xEA,0xF4, // w 0xFF,0xFF,0xEE,0xF5,0xFB,0xF5,0xEE, // x 0xFF,0xFF,0xEE,0xF5,0xFB,0xFB,0xF3, // y
35
0xFF,0xFF,0xE0,0xFD,0xFB,0xF7,0xE0, // z 0xF9,0xF7,0xF7,0xE7,0xF7,0xF7,0xF9, // 0xFB,0xFB,0xFB,0xFF,0xFB,0xFB,0xFB, // | 0xF3,0xFD,0xFD,0xFC,0xFD,0xFD,0xF3, // 0xF5,0xEA,0xFF,0xFF,0xFF,0xFF,0xFF; // ~ //------------------------------------------------------------------
36