You are on page 1of 25

LED MATRIX CONTROLLER By Ethan Byrd Suneil Hosmane

ECE 345, Senior Design Project Fall 2003 TA: Jing Tang 12/09/2003 Project No. 10

University of Illinois at Urbana-Champaign Department of Electrical and Computer Engineering

ABSTRACT
From scrolling marquees to streetlights, light emitting diodes (LEDs) have changed the world we live in. More specifically, low power LEDs are cost-effective design alternatives to light bulbs in many applications including billboards, street signs, and multipurpose displays just to name a few. For our senior design project we have decided to design a LED matrix circuit and develop a practical method to display images on this LED matrix with the use of a microcontroller and graphical user interface (GUI). A LED matrix is simply an n row by m column grid of LEDs and by selectively turning on and off particular LEDs a desired image can be displayed. Our project report will discuss all technical details regarding functional integration between different components of the circuit and address a straightforward methodology of driving LEDs through current amplification techniques.

ii

TABLE OF CONTENTS
1. INTRODUCTION ..................................................................................................................1 1.1 Motivation .........................................................................................................................1 1.2 Overview and Requirements ...........................................................................................1 1.2.1 System Overview ..............................................................................................................1 1.2.2 Functional Requirements .................................................................................................1 DETAILED DESIGN PROCEDURE ...................................................................................3 2.1 Graphical User Interface .................................................................................................3 2.1.1 Specifications ...................................................................................................................3 2.1.2 Component Selection .......................................................................................................3 2.1.3 Detailed Design ...............................................................................................................4 2.2 Microcontroller Logic ......................................................................................................6 2.2.1 Specifications ...................................................................................................................6 2.2.2 Component Selection .......................................................................................................6 2.2.3 Detailed Design ...............................................................................................................7 2.3 LED Matrix Circuit ..........................................................................................................9 2.3.1 Specifications ...................................................................................................................9 2.3.2 Component Selection .......................................................................................................9 2.3.3 Detailed Design .............................................................................................................10 DESIGN VERIFICATION ..................................................................................................15 3.1 Functional Tests ..............................................................................................................15 3.3.1 GUI Verification ............................................................................................................15 3.3.2 Microcontroller Verification .........................................................................................15 3.3.3 GUI + Microcontroller Integration ...............................................................................16 3.3.4 LED Circuit Verification + Microcontroller Integration ..............................................16 3.2 Additional Results...........................................................................................................17 COST .....................................................................................................................................19 4.1 Parts .................................................................................................................................19 4.2 Labor................................................................................................................................19 4.2 Total Cost ........................................................................................................................19 CONCLUSIONS ...................................................................................................................20 APPENDIX CODE ............................................................................................................21 REFERENCES .....................................................................................................................22

2.

3.

4.

5.

iii

1. INTRODUCTION

1.1 Motivation
We wanted a project that would not only involve several disciplines of Electrical and Computer Engineering, but would also be accomplishable in a sixteen-week period. Our joint interests included circuit design, digital logic design, and hardware control (microcontrollers) and our project encompasses all of those facets. We had heard that certain individuals at the Micro and Nanotechnology Laboratory were considering development of a scrolling LED marquee that would be placed in the main hallway of the building. As a precursor to the project proposed by the Micro and Nanotechnology Lab, we have decided to develop a basic LED matrix circuit and controller that could later be scaled to perform more complex operations required by a full size LED marquee.

1.2 Overview and Requirements


1.2.1 System Overview
Our project is a collaboration of three separate modular entities, which together formed a LED matrix controller and circuit. For the remainder of the report, these separate components will be referred to as the graphical user interface (GUI), microcontroller logic, and LED matrix circuit as depicted below in Figure 1.1. The details regarding each component of the design will be discussed in greater detail throughout the remainder of the project report. A short summary of the high-level functional requirements will be presented in 1.2.2.

Figure 1.1: High-Level Design

1.2.2 Functional Requirements


As stated previously, the user interface, microcontroller logic, and LED matrix circuit created the basic functional blocks of our design. It was an important step to first identify what requirements we would have to impose on each of these components. Once these general requirements were decided upon, more stringent provisions could be imposed as needed. Since there were three main components to our design, each component needed an individual assessment of its role in the grand scheme of the project. Results of the assessment are as follows: The first main objective was to develop a process to represent an image in a format that could easily be transferred from PC/User to the microcontroller. A graphical user interface (GUI) was an ideal choice for such a task. The demands of the GUI would require it to be compact, userfriendly, and readily scalable to create arbitrarily large or small images. If time permitted, we would attempt to make the GUI platform independent to ease coding development and expand our potential consumer base. 1

Upon development of a proper image format, we would have to ensure that this graphic could be relayed to the circuit in a suitable fashion so that the circuit could perform its operation of displaying the image. For this task, we would need to choose the right microcontroller so that input/output operations were simple and manageable. Finally, the microcontroller would need to be able to read external files so that arbitrary image patterns could be displayed without hardcoding images into the microcontroller.

The main purpose of the circuit element of the design was to hold and display an image obtained from the microcontroller. It would need to respond to control signals from the microcontroller, and then store and display the loaded bits onto LEDs. This would also require the development of current amplification for the power circuitry, which would in turn drive the LEDs. Finally, we would like the entire circuit package to be implemented on a printed circuit board (PCB) with the LEDs arranged in such a way that the image could easily be seen by the user.

2. DETAILED DESIGN PROCEDURE


For the components mentioned in 1.2.1, a systematic project build will be given. The technical requirements will first be presented for each functional block. Once the specifications are stated, there will be a short description of which components were selected for the final design. Finally, a detailed design is provided explaining the technical details of each functional block.

2.1 Graphical User Interface (GUI)


2.1.1 Design Criteria / Specifications
The graphical user interface played an integral role in our project. The need to easily create an image file format of our own specification required the development of a custom application. More specifically, our design required the following functionality: 1. File Input/Output It was important that file input/output was established because there needed to be a way in
which external files could be created/modified for use by the microcontroller.

2. Graphical Manipulation of Image Simple graphical manipulations would be available to the user to aide in
the development of the image. a. Clear Clear the grid panel. b. Reverse Invert all grid panel bits (i.e., bit reversal). c. Horizontal Mirror Perform an image mirror, in which all bits were copied a flipped along the x-axis. d. Vertical Mirror Same functionality of the Horizontal Mirror except that the mirror was performed about the y-axis. e. Image Resize This operation would hold certain regions of the grid constant, as to allow users to perform operations on the entire grid without affecting a particular region. Mouse Enabled The user should be able to click on the grid and activate any arbitrary checkbox, which would represent an LED on the LED matrix. Platform Independent Development should not be biased towards a particular operating system. As popularity of non-Windows operating systems increase, systems should develop applications that can function on multiple platforms. Fairly Simple Development Language Functionality should not be hidden behind complex coding structures. The program should be fairly simple, and future engineers who decide to expand on our work would be able to easily understand and further our design.

3. 4. 5.

These five specifications had to be met in order for our design to provide the desired functionality to the user.

2.1.2 Component Selection


From the specifications mentioned in 2.1.1, we were not left with many options as to which language we should use to develop the application. To our fortune, JAVA provided all the functionality that we required with the benefit of having zero cost. Therefore, we chose JAVA SDK (Standard Development Kit) 1.4.2 as our development language for the graphical user interface. Some additional benefits of using JAVA included: 1. Free Online Documentation of JAVA APIs (Class Files) 2. Free Online Sample Code 3. Integrated Mouse Functionality

2.1.3 Detailed Design


The JAVA graphical user interface (GUI) can be seen in Figure 2.1.1. It met every specification set forth by 1.2.1, and the technical details are as follows:

Figure 2.1.1: Java GUI Interface (Main)

The main grid in Figure 2.1.1 features a large clickable checkbox area that represents the LED matrix. By clicking different boxes in the grid, a multitude of graphical images can be created for display. Two parameters are passed to the program at runtime, the maximum column and row length. In the example above, as well as our demonstration, the column length had been set to sixteen and the row length had been set to 8. However, it is important to note that any arbitrary integer length could be passed to the GUI. We had stated that our GUI would require file input/output functionality to easily modify image patterns. Figure 2.1.2 is a screenshot of the File Menu of the GUI. As can be seen, the program can import and export files that hold image information custom to our design.
Figure 2.1.2: File Menu

The Grid Options Menu of the GUI is depicted in Figure 2.1.3. Graphical manipulation options are provided to the user to aide in the creation of the image patterns as stated in the design specification.

Figure 2.1.3: Grid Options Menu

Figure 2.1.4 is a screenshot of the Info Menu of the GUI. This option was included as a bonus feature. Upon selection, a small pop-up is shown describing the purpose of the GUI and names of group members.
Figure 2.1.4: Info Menu

Figure 2.1.5 is a high-level flowchart for the Java GUI. Following the flowchart is a piecewise description of the mechanics of the chart. For each defined function (as stated in the design 4

specifications for the GUI), there will be a comprehensive description of what actions are taken when a specific option is selected.
Graph ical Us er Interface Flo w Ch art Pro gra m Ini ti al i za tio n Fil e Men u Gri d Opti on s Me n u Exp ort to BX-2 4 Pe rform Gri d Op e ra tio n(s ) <2.1.1 > Info Men u

Op e n BX -2 4 Fi le

Di s pl a y Ge n eral Info rm ati on

Va l i d Fi l e?

Ou tpu t Matri x Di m en si on s Ou tpu t Gri d

Op e n Fi l e & Se t Grid

Erro r Me s sa ge , Fil e In co mp ata bi l ity

Figure 2.1.5: Java Graphical User Interface (GUI) High Level Flowchart

Open BX-24 File When the user selects Open BX-24 File, a window will open prompting the user to select a file from the file directory of the system. Once a file is selected, the program will check the filename and contents of the file. If either the name is not a valid image pattern file or the contents are corrupted, an error message will be displayed. If the file is valid, the contents will be read into a twodimensional array variable. The GUI will then clear the grid and redraw the check box components to match the pattern specified by the image file. Export to BX-24 Export to BX-24 will first prompt the user for a filename. Once a filename is selected, the GUI will write the grid dimensions (number of rows and columns) to the file and then proceed to write the grid pattern bit by bit following a specific process. The manner in which the bit pattern is specified can be seen in Figure 2.3.5 of section 2.3.3. Regardless of grid dimensions, the first two elements of the file will be the number of columns and the number of rows respectively. Graphical Manipulations 1. Grid Resize Grid Resize allows the user to select an n by m grid within the main grid. The selected portion of the grid will be referred to as the active portion whereas the rest of the grid will be referenced as being inactive. Essentially, the active portion of the grid can be manipulated while the rest of the grid remains inert. By itself, the grid resize option is not very powerful. However, in conjunction with other graphical manipulation functions, the grid resize can be very helpful. (i.e., you can set a small box in the middle of the grid active, and then choose to clear the grid. Only the middle box will be cleared, and the rest of the grid will remain as it was). 2. Clear The clear option sets all active checkboxes to zero logic, and then redraws the screen to display the changes. 3. Reverse The reverse option inverts (or reverses) the logic of all the active checkboxes. In computer engineering, this manipulation is known as a bit reversal. Once the bit reversal is completed, the grid is redrawn. 4. Horizontal Mirror The horizontal mirror option is best described in terms of an analogy. Imagine the grid as a piece of paper. Using Cartesian coordinates as a reference, fold the grid in half along the x-axis (horizontal). Now take a marker and draw a pattern on the half piece of paper, and imagine that the ink seeps through the paper and marks the other side of the folded paper. Upon unfolding the paper, an image is left which is symmetric about the x-axis. This is 5

the action performed when Horizontal Mirror is selected. After the operation, the screen is also redrawn. 5. Vertical Mirror Same as the Horizontal Mirror, except symmetric about the y-axis. About When this option is selected, a popup appears displaying information about the GUI, and the author of the program.

2.2 Microcontroller Logic


2.2.1 Design Criteria / Specifications
The microcontroller logic served as the interconnection between the user and the LED matrix circuit. Careful consideration had to be given as to the methodology of relaying image data from the graphical user interface to the microcontroller. Once the data was sent to the microcontroller, a procedure had to be developed in order to convert the digital image data into an analog format that could be understood by the LED matrix circuit. With these considerations in mind, our microcontroller would have to have to be able to provide the system with the following functionality: 1. USB / Ethernet / Serial Link Interface to PC The microcontroller needed to have a connection to the PC 2.
via a standard peripheral port. Ideally, the microcontroller would have a high-speed USB 1.0/2.0 or FireWire (IEEE 1394) port for potential high bandwidth traffic; however, for our design a serial connection would be sufficient. Simple Programming Language (Modified C or Basic) A simple programming language for the microcontroller would make development much simpler and would thus allow us to spend more time in testing. Either a version of C or Basic would be ideal because we have had experience programming in these languages and therefore less work would be needed to learn the development language and more time could be spent on actual development. On-Board Voltage Regulator This was a subtle, yet serious issue to the design specification. We had to ensure that our microprocessor would be safe guarded in the event of a power supply mismatch or an accidental reversal of terminal polarity. These safe guards would ensure that in case of an accident, the microcontroller would still be operational. Multiple Output When relaying data from the microcontroller to the LED matrix, we had to be able to set several output pins at the same time. For instance, address pins would all have to bet set at the proper time or information to the circuit would be scrambled. In addition, while the address pins were enabled, additional pins would have to be controlled to channel data to the right destinations. It was very evident that multiple output pin functionality would have to be a requirement. Optional Multiple Input If time permitted, we would have liked to include multiple input buttons to our microprocessor so that a user could toggle various graphical effects on the LED matrix depending on which button was pressed.

3.

4.

5.

Specifications one through four governed our multiprocessor selection. It was critical to the success of our design project that these requirements were met.

2.2.2 Component Selection


There was a wide selection of microcontrollers available to us including the Motorola HC912, NetMedia Basic X-24, and Parallax STAMP. Of the microcontrollers mentioned only two satisfied all the requirements set forth by 2.2.1. These microcontrollers were the Parallax STAMP and the NetMedia Basic X-24. After considerable thought, we chose the Basic X-24 because it came with a development board and the processor had two pre-mounted LEDs that could be used for testing purposes. Some additional features of the Basic X-24 that influenced our decision were: 1. Excellent documentation available at manufactures website [www.basicx.com] 2. Included sample code 3. Included serial cable 4. 16 input/output pins 5. Included conventional power supply connector 6. Online support group at Yahoo! Groups 6

2.2.3 Detailed Design


Figure 2.2.1 is a high-level flowchart for the microcontroller logic. Below the flowchart is a systematic description of the code that runs on the processor.
Microcontroller Flow Chart

Initialize Input/Output Pins

Load Image Files (2) From Java GUI (EEPROM)

Wait For I/O

Button 1

Button 2

Button 3

Button 4

Display Image 1

Display Image 2

Reverse Currrent Image

Scroll Current Image

Wait For Button 4 (2nd Time)

Pressed

Not Pressed

Stop Scrolling

Figure 2.2.1: Microcontroller Logic: High Level Flowchart

The microcontroller performs four separate operations depending on which input button is pressed. Before any inputs are read, the microcontroller performs two important operations: Input / Output Pin Initialization o Sets all output pins to low logic o Toggles a clear pin which clears all registers of the LED circuit o Activates four pull-up resistors to handle button inputs from the user o Places an interrupt function in memory, which constantly checks whether an input button has been
triggered

Loads Image Files After initialization, the microcontroller loads two separate image pattern files that have
been created by the JAVA GUI. These images are placed in EEPROM and can be accessed at anytime by the microcontroller.

Once these operations have completed, the microcontroller is ready for input/output. As stated previously, the four displays functions are: 1. Display Image 1 [Button 1] This feature toggles the display of the first image stored in EEPROM. When this option is selected, the microcontroller reads the data stored in EEPROM (Flash Memory) and then proceeds to display this image via the LoadDualLine procedure (Appendix A) 2. Display Image 2 [Button 2] Similar to Display Image 1, this option toggles the second image stored in EEPROM. 3. Image Reversal [Button 3] The image reversal procedure is very similar to functions 1 and 2 except that when the data is being sent to the LED circuit, the data is inverted so that LEDs that should be toggled on are kept off, and LEDs that should be kept off and toggled on. The final result is an image that is inverted from what should actually be seen. 7

4. Image Scroll [Button 4] In this procedure, data is sent with shifted column addresses. This results in an image that is shifted to the left or right by a column. In quick succession, this manipulation results in an effect known as scrolling. Once a function is performed, the microcontroller must then channel data from its memory to the LED circuit. The way in which the microcontroller outputs data is essentially the same regardless of function performed. Therefore, we have provided a discussion of how the microcontroller outputs data to the LED matrix. Figure 2.2.2 is a graphical representation of how information is sent to the LED matrix.

Figure 2.2.2: Microcontroller Data Flow to LED Matrix

As stated previously, the microprocessor initialization loads two images into flash memory by way of the GUI. For reasons that will be specified in 2.3.3, the circuitry of the top half of the LED matrix is mirrored to the bottom half. What does this mean to the microcontroller logic? Essentially, this means that we can model data output of both halves of the matrix in an identical fashion. However, there needs to be a method in which we can output data to just the top or bottom half of the circuit. For simplicity we decided to use two different clocks signals. DualLoadLine (Appendix A) is the main function responsible for data transmission to the LED matrix. Given an image represented in matrix form, it essentially performs the following operation: 1. Traverses from 1 to the Row Length / 2 ~ (number of Registers / 2). a. Traverse from 1 to the Column Length ~ (number of Bits per Register)
i. Grab Grid1 = bit representation of a row (~register) from top half of matrix [1 Row Length / 2] ii. Grab Grid2 = bit representation of a row (~mirrored register) from bottom half of matrix [Row Length /2 + 1Row Length]

2. The following parameters are passed to DualLoadLine: a. Grid1() contents of a register in top portion of the LED Matrix b. Grid2() - contents of a register in lower portion of the LED Matrix c. LineGridSize - number of bits or elements per register d. Address register number (Mirrored registers on top and bottom half of matrix share a common register number. They are activated through the use of separate clocks.) e. Reverse flag to indicate whether our signal to the LED matrix circuit should be inverted to perform a
reversal

3. Traverse from 1 to the LineGridSize a. Data1 = Single bit from Grid1 b. Data2 = Single bit from Grid2 c. Set Address Pins depending on which register (~row) we are at. This will channel the data to the proper register, but since data on the matrix is mirrored it will be sent to both halves of the LED circuit. We now need to activate a corresponding clock to put the data in the right half of the matrix. d. Put Data1 on DATAOUT Pin (if Reverse Flag is on, flip signal), Activate Clock 1 8

e. Put Data2 on DATAOUT Pin (if Reverse Flag is on, flip signal), Activate Clock 2 4. Go to step 1 to perform another image display Activating the clock [1 or 2] is simply transitioning an output pin from low logic to high logic. This was the best approximation we could do with the Basic-X with regards to producing a clock pulse. Throughout the design of the graphical user interface (GUI) and microcontroller logic, exact grid size information was purposely left out. Due to the way in which both the microcontroller and the GUI were designed, the size of the matrix had no bearing. Therefore, the exact details of the grid size and image mapping will be left to sections 2.3.3. There you will find systematic documentation of how the particular image mapping was developed and why a particular grid size was selected.

2.3 LED Matrix Circuit


As described, the project was broken up into three separate subprojects, the GUI, the microcontroller, and the circuit design. Although testing and verification was done across all three subprojects, each one was designed on a near independent basis. Each subproject was also designed to meet the projects overall goals as best as possible.

2.3.1 Design Criteria / Specifications


The original circuit design called for the use of PIC microcontrollers to control individual lines of the LED matrix. The signals from the PIC controllers would have to drive multiple LEDs, and it was evident that some form of amplification was needed to do this. The initial design called for the use of BJT amplifiers in order to drive the LEDs. The LED layout and was not specifically discussed for the initial design, but we knew that a PCB would be the best choice. The final design had several changes from the initial plans. These changes included the use of a buffer instead of BJT amplifiers, and registers instead of the PIC microcontrollers. There were several requirements the circuit needed to meet in order to display the desired images on the LED matrix. Specifications 1. Load and Store Data 8-bit Serial-In Parallel-Out (SIPO) registers were chosen for this task. 2. Address Individual Lines of Array A 3-to-8 line DMUX was selected, and separate clocks were used for
the different halves of the matrix.

3. High Signal Strength to Power LEDs An inverting buffer with adequate current ratings was chosen. 4. Minimize Current and Power usage Resistor choice and circuit arrangement was crucial for this
specification.

5. Compact Arrangement of the LEDs Easy to specify, but difficult to design without compromising good
PCB layout.

6. Scalability Pin connections should be easily accessible for multiple boards to minimize the number of long
wires from the microcontroller.

2.3.2 Component Selection


Component selection was a time consuming process. We set forth the specifications for each part of the circuit, and then began to search for a chip that met those specifications. It was desirable that the chips we were looking for were available at the ECE Parts Shop in adequate supply to make a large LED matrix.
1. MM74C164 8-bit Parallel-Out Serial Shift Register a. This register was chosen because it is parallel out, and we had wished to simultaneously drive eight LEDs with a single register. The serial loading aspect of the register was not very desirable, but it would allow for a smaller register footprint and easier layout of the DATA signals. Each chip also had a CLEAR and CLOCK signal. The CLEAR signal allowed a quick reset of the

2.

3.

4.

5.

6.

contents of the register. The CLOCK signal was used as a command to shift and load the contents of the register. b. The major drawback of this register was that an enable signal was not present. This meant that the clocks to the registers needed to be controlled at all times so that erroneous data would not shift and load at unwanted times. In addition, the register did not provide enough current output to drive an LED; it was limited to about 8.0 mA. 74AC540 Octal Buffer/Line Driver with 3-STATE Inverting Outputs a. This buffer was chosen for several reasons: the inverting outputs allowed for a simple circuit design, the inputs and outputs were on opposite sides of the board allowing for easier PCB layout, and the source/sink current was rated at 24 mA, which was capable of driving the LEDs. b. One of the drawbacks to this chip was the large package size (twenty pins), which required many wires and connections. There was also the burden of wiring two controls signals. DM74ALS138 3-to-8 Line DMUX a. This chip provided the desired control to a set of eight registers using three address lines for selection. There are multiple enable signals on the chip, but only one was necessary. The chip is small and reasonable in size. b. The major drawback is that the output pins have the opposite signal from what we would like. This requires the use of inverters. 74F04 Hex Inverter a. This chip was chosen for its compact design while still housing six inverters. b. There were no drawbacks to this chip. HMLP 1340 Red LED a. This LED was selected because of the large supply available at the Parts Shop, a low cost, good illumination, and low power consumption. Under test conditions it worked well. b. The LED has a relatively narrow viewing angle, preventing the matrix from being viewed well from wide angles. Parts Shop PCB (Printed Circuit Board) a. The PCB was chosen because it was free from the Parts Shop, and there was adequate documentation available for board design. b. The board has only two layers. Any pass-throughs required soldering of a connector through the board.

The component selection also required that all the chips accept the minimum output ratings of the other chips in the design. This required checking the voltage ratings of some chips and the current ratings of others. Table 2.3.1 summarizes the voltage and current ratings of the chips.
Table 2.3.1: Chip Voltage and Current Ratings

Chip MM74AC164 74AC540 DM74ALS138 74F04

VIH,min 4.4 V 4.2 V 2.0 V 2.0 V

VIL,max 1.6 V 1.8 V 0.8 V 0.8 V

VOL,max 0.6 V 0.55 V 0.5 V 0.5 V

VOH,min 5.4 V 5.0 V 4.0 V 2.7 V

ISOURCE/SINK 8.0 mA 24 mA n/a n/a

2.3.3 Detailed Design


The circuit board design is comprised of several parts including: the data path from the microcontroller to the LEDs, the control logic needed to control the registers and output, the basic LED circuit design, and the layout of the PCB. The data path, control logic, and circuit were designed with the capability of being scaled to any arbitrary matrix size desired. When it came time to design the PCB, a 16 column by 8 rows LED matrix was selected. This allowed for a single DMUX to be used on each side of the board, which allowed for a manageable board size. The PCB was also designed with scalability in mind so that multiple boards could be strung together to form a larger matrix if desired. 10

The Data Path: The data from the microcontroller is sent simultaneously to all the registers on the board. The data signals are loaded and then passed to the inverting buffer, which amplifies the signals and connects to the LEDs. The LEDs display the data stored in each register. The complete data path is shown in Figure 2.3.1. The inverting buffer was chosen because using this chip would enable us to have a simpler circuit to display the data. The data path was quite simple and straightforward.

Figure 2.3.1: Circuit Data Path

The Control Logic: The control logic was designed so that the microcontroller could easily address and load the registers on the board. The control signals are shown in Figure 2.3.2. The three ADDRESS pins arrive at the DMUX, allowing for the selection of each individual register. The CLOCK is connected to the ENABLE signal of the DMUX. This permitted one clock to control an entire bank of LEDs (a total of eight registers). If additional registers were required, adding an additional clock input could easily scale the device. Each output of the DMUX is sent to the corresponding registers CLOCK input, thus controlling that register. The signals to the registers are inverted because the DMUX outputs a constant HIGH unless an address is selected, when it then switches to LOW. Since the registers operated on the rising edge (LOW-to-HIGH transition) of the clock, it was best to have the register inputs line up with the CLOCK signal sent from the microcontroller. As seen in the figure, the address pins for the top half of the registers are inverted as well. This allowed the first address (000) to address the registers on the same side of the board. Though seemingly done for programming convenience, it would also allow the matrix to load and scroll faster. It would not be require a change in the address bits when attempting to load both the top and bottom half of the matrix.

11

Figure 2.3.2: Control Logic Path

The LED Circuit: The simple LED circuit is a voltage driven circuit that turns on the LEDs when the register data bits are HIGH and turns off the LEDs when the register data bits are LOW. As indicated in Figure 2.3.3, this is accomplished by connecting one side of the LED to the 6V power source, and the other end to the output of the inverting buffer. An 82 resistor is placed between power and the LED in order to control the current flow and to prevent an exceedingly high voltage drop across the LED.

Figure 2.3.3: LED Circuit Design

The following equations show the derivation of the current used by the LED matrix when connected to the registers. Vcc V R V LED V Buffer (1) (2) 6V 10.25 * I 1.7V 0.55V (3) I 0.366A (4) i 0.006A The 10.25 resistance in (2) comes from the parallel connection of eight 82 resistors. The final current in (4) is just the total current divided by the one hundred twenty eight LEDs. This shows that the power from each LED is small, and that the total power used is relatively small as well. This circuit was easy to implement in a large scale, especially in the tightly cramped space of a PCB. 12

The Printed Circuit Board: The PCB design was the most challenging portion of the circuit. The design was done using Easytrax, a layout design application provided by the Parts Shop. The Parts Shop did all physical manufacturing of the PCB. The specifications of the PCB allowed track widths as narrow as 10 mil as well as varying pad sizes. The process permitted up to two layers, but any passthroughs between the layers required some additional soldering. The most challenging part of the PCB design was devising a way to connect all eight register outputs to the eight inputs of the inverting buffer, and then connect the buffer outputs to eight LEDs. This required placing seventeen tracks just for the data. In addition to the data wires, it was necessary to place power and ground tracks to all the chips and all the control signals necessary for loading the registers. Though challenging, the PCB design turned out well, and the board functioned soon after we finished soldering the chips and making the proper connections. Figure 2.3.4 shows the completed PCB with all the chips installed and the LED circuit working.

Figure 2.3.4: Completed PCB

The PCB board included several features that would allow easy scalability. These features were part of the circuit design, but were not utilized in the final product and demo. On the top and bottom of the board, holes and tracks were set up so that a connection could be made with a neighboring board. All the signals could then be passed from one board to the next without connecting long wires back to the single microcontroller. Additional scalability features include the ability to pass multiple clocks between the boards, and being able to select which clock would be used to enable the DMUX. However, we did not take advantage of these easy scalability features because we only ordered and tested a single PCB. The PCB layout required a unique arrangement of registers and buffers. This arrangement was great for layout purposes, but ultimately shifted more responsibility to the GUI to produce a more complicated image file. As shown in Figure 2.3.5, the register bits form two short adjacent 4-bit lines combined to form a single 8-bit register.

13

Figure 2.3.5: Register Bit Layout

As seen in the figure, 8 registers were on each half of the matrix, which combined to form the larger, 16 X 8 design. The GUI and the microcontroller design took into the account this fairly awkward arrangement of bits when arranging the image file. It was crucial that the bits enter each register in the correct order if the image was to be displayed correctly. Additionally, it was necessary that the 8th bit position (labeled 8) be loaded first, followed by each successive bit until the 1st bit position. It is also evident from Figure 2.3.5 that the top half of the matrix used one clock while the bottom half used a different clock, labeled CLOCK 1 and CLOCK 2 respectively. However, register address selection was identical on each half (address 1 (000) to address 8 (111) from left to right). As mentioned before, this simplified the loading procedure slightly while only slightly complicating the PCB layout. The circuit design had many components, most of which were straightforward to design. Several of them were more difficult to design, especially the PCB. However, in the end, the circuit provided all the functionality that we had anticipated, plus it had the capability of some additional features, such as scalability.

14

3. DESIGN VERIFICATION
3.1 Functional Testing
Component integration was a key aspect to our design. After every significant enhancement to the system, several tests had to be done to insure that compatibility still existed between existing component blocks. Figure 3.1.1 is a depiction of our methodology for testing single components, partial component integration, and full circuit integration of the design. The following subsections give a quick summary of our various testing procedures.

Figure 3.1.1: Functional Testing Diagram

3.1.1 GUI Verification


The look and feel of the graphical user interface was very important to our final design. As stated in 2.1.1, we wanted to produce an interface that was user friendly, compact, and easy to use. Several code iterations had to be made until the appearance was satisfactory.

3.1.2 Microcontroller Verification


Proper Loading of External Files We had to insure that external text files were loaded properly. As a test procedure, we created text files containing combinations of 1s and 0s. The file was then loaded into the microcontroller. A loop traversed through the contents of the text file, and upon reading a 0, a green LED would be lit on the development board. On the other hand, upon reading a 1, the red LED was lit. Development Board Buttons To test whether the development board buttons were functional, a small program was written to interrupt the program when a button was triggered. In the main body of the code, a switch statement was created to handle button triggers by flashing the green LED the same number times as the number assigned to the button. For instance, when button two was pushed, the main body would call a function to flash the green LED twice, and so forth for different button numbers.

15

3.1.3 GUI + Microcontroller Integration


Once the GUI was completed, we had to make sure that it would produce image files that would be compatible with the microcontroller. We had to perform a test similar to that of Proper Loading of External Files listed in 3.1.2. The only difference in this case was that the external files were created through the GUI. Once these preliminary tests were complete, functional testing with the LED circuit could begin.

3.1.3 LED Circuit Verification + Microcontroller Integration


I-V Characteristics of the LED - The first functional test was to find the I-V characteristics of the LED in order to determine if signal amplification would be necessary. The I-V characteristics were found by varying the voltage across the LED while measuring the current. The power supply provided in the lab was used. Currents were measured for each voltage step of 0.1V, from -3.5V to 3.5V. The I-V plot is representative of a standard diode, and the test was also done while visibly inspecting the LED. It was determined that the optimal voltage to operate the LED was between 2 - 2.5V. In this voltage range, there was no perceptible difference in the brightness of the LED and the current remained at a reasonable level.

Figure 3.1.2: LED I-V Curve

8-bit Line Test - Once the initial LED tests were completed, most of the circuit was designed. However, it became necessary to test parts of the circuit to ensure that they worked as planned. The first test was wiring one line of eight LEDs. This test used one inverting buffer, one register, eight LEDs, and two resistors. Once the circuit was setup, we used a 6Vpp square wave to simulate the clock input. An initial period of T = 1 second was chosen so that the circuit could be monitored closely. The simple register-buffer combination worked the first time it was tested with the eight LED line. Microcontroller Integration (1) - After verifying that the circuit design worked; we tested the circuit with the Basic X-24 microcontroller. It was necessary to connect three wires from the protoboard to the Basic X. The three controls were the Data, Clock, and Clear. A small routine was written to load a single line at a slow clock speed. Unfortunately, we ran into significant problems getting the protoboard and the microcontroller working together. Eventually, we discovered that our choice of using two different power supplies (one for the microcontroller, one for the protoboard) was the culprit. The ground pins for each component did not match so the signals sent to the protoboard did not correspond to the correct voltage level. This was easily corrected by connecting each device to a common voltage supply, the one provided in lab. The 8LED line loaded as fast as the clock on the microcontroller was able to oscillate (~512 Hertz). 16

Addressing Registers - The next functional test was designed to test the use of the DMUX and inverter chips. Three eight-LED lines were set up next to each other on the protoboard with the DMUX connected to each. The DMUX outputs were inverted and connected to the clock of each register so that the rising edges lined triggered the enable on the DMUX. A function generator connected to the DMUX enable was used to test load the LEDs. When the address bits were changed, the individual lines loaded the signals correctly. Microcontroller Integration (2) - The obvious next step was to test this same configuration with the Basic X. Two additional control lines were connected to the Basic X in order to control the address select of the DMUX (only two address lines because there were only three LED lines). The microcontroller succeeded in loading the three eight LED lines correctly, but it was necessary to find additional address pins on the Basic X for future use. Many of the pins on the board were tied to buttons or other features, and it was not possible to use them for I/O connections. However, with some marginal trail and error a handful of working pins were found. PCB Verification - Before design of a final PCB layout, we ordered a small 2x3 PCB to test two circuit layouts. We wanted to qualitatively examine how the PCB designs translated from schematic to board layout as well as gauge the difficulty of soldering chips onto the board. This small board contained two layouts for the register-to-buffer and the buffer-to-LED tracks that would be necessary for the final design. Each layout had a single buffer, register, and eight LEDs. One had the LEDs positioned away from the chips while the other tried to overlay the arrangement of the LEDs and the buffer. In addition, the board had connections available for the power, ground, Clear, Data, and Clock signals.

Figure 3.1.3: Practice PCB

3.2 Additional Results


In order to perform a complete analysis of the circuit, we examined the circuit for different LED combinations. We then took this data and plotted the Power Output (W) and Current Output (I) vs. number of LEDs illuminated. As you can see from Figure 3.2.1, the maximum power dissipated by the circuit was approximately 6 W. This arose from a peak current of roughly 1 A applied to a 6 V power supply. A current/power spike around twenty illuminated LEDs can be accounted by analyzing the arrangement of the LEDs. There were eight rows of LEDs, and when each row starts drawing power, more current can be drawn than from a single row. The initial large increase comes from more and more rows turning on, eventually saturating when they are all on. The exact analysis of such a current spike is beyond the scope of this project.

17

Figure 3.2.1: Current and Power vs. Number of LEDs Lit

18

4. COST

4.1 Parts
Our final design required the parts indicated in Table 4.1 with part number and price listed:
Table 4.1: Part List

Part Basic-X24-Chip -Board LEDs Red HMLP 1340 INV Buffer 74AC540 8-bit SIPO registers MM74C164 74F04 Inverters 3-8 DMUX DM74ALS138 82 Ohm Resistors PCB 2 layer, 4x9 6V Power Supply (up to 12W) Test PCB 2x3 Miscellaneous (wires, pliers, etc.) Total

Cost $49.95 22.95 0.15 0.68 1.62 0.30 0.49 0.92 ~150.00 38.00 ~50.00 ~50.00

Quantity 1 1 128 16 16 4 2 16 1 1 1 N/A

Cost $49.95 22.95 19.20 10.88 25.92 1.20 0.98 14.72 150.00 38.00 50.00 50.00 $433.80

4.2 Labor
In Table 4.2, we have given our best estimate as to the amount of time we have each worked on the design. In addition, a dream salary has been entered.
Table 4.2: Labor Cost

Person Ethan Byrd Suneil Hosmane Total

Hourly Wage $40.00 / Hr $40.00 / Hr

Time Spent (Hrs) 60 60

Cost (Wage * Time * 2.5) $6000 $6000 $12000

4.3

Total Cost
Table 4.3: Total Cost

Total Parts Total Labor Total Cost 19

$410.74 $12000 $12433.80

5. CONCLUSIONS
The LED Matrix Controller was a very challenging senior design project that re-emphasized several key aspects of our undergraduate education at the University of Illinois at Urbana-Champaign. Team work, creativity, and problem solving are three integral parts to any successful engineering project. In ECE 345, we were able to touch upon these facets numerous times. We will now conclude our project report with a few milestones that we have encountered during the semester as well as a short recommendation to the general ECE population as to possible uses for our project.

5.1 Success and Challenges


Successes 1. Design Worked a. Successfully integrated GUI + Basic X-24 microcontroller + LED matrix circuit. b. Overcame design challenges and corrected design flaws along the way. 2. Learned Several New Skills: a. PCB Design Software & Layout Techniques b. Basic X-24 Microcontroller Language c. JAVA layered graphics d. Soldering e. Non-trivialities of circuit design Challenges 1. Choosing a final circuit design final layout for PCB difficult to design 2. Interfacing the different modular components (Power Issues) 3. Soldering final circuit board A few problems regarding chip placement turned into much more complicated issues once soldering began 4. Developing JAVA Interface 5. Debugging
Ongoing process Most frustrating and difficult aspects of integrating multiple, independent parts of a larger project

5.2 Recommendations
1. Develop Wireless Link Between Microcontroller and GUI Interface to Create Remotely Located Sign Controller. 2. Scale-up Matrix to display larger images, or use to scroll larger text messages. 3. Replace Basic-X with a more sophisticated microprocessor to achieve faster scrolling (possible animation). 4. Trim down design and use for possible ECE 249 MP / ECE 246 Final Project.

20

APPENDIX A Program Code


Available online at https://courses.ece.uiuc.edu/ece345/projects/fall2003/project10_appendix.txt

21

REFERENCES
[1] [2] NetMedia Basic X-24 Online Support Website, 2002, http://www.basicx.com Microcontroller FAQ, University of Illinois at Urbana Champaign, April 2003, http://courses.ece.uiuc.edu/ece345/microdocs/index.html Sun Microsystems Java 2 Platform SE v1.4.2 API Documents, 2003, http://java.sun.com/j2se/1.4.2/docs/api/ NetMedia Technical Staff, Basic X-24 Vendor Documentation, NetMedia Inc., 2002, http://courses.ece.uiuc.edu/ece345/microdocs/bx_docs/ Technical Data Sheets, Fairchild Semiconductor, 2002, MM74C164 74AC540 DM74ALS138 74F04 http://www.fairchildsemi.com/ds/MM/MM74C164.pdf http://www.fairchildsemi.com/ds/74/74AC540.pdf http://www.fairchildsemi.com/ds/74/74AC540.pdf http://www.mouser.com/catalog/specsheets/74F04.pdf

[3]

[4]

[5]

22

You might also like