KEMBAR78
ECE36 Task#3 Dotmatrix | PDF | Arduino | Integrated Circuit
0% found this document useful (0 votes)
48 views3 pages

ECE36 Task#3 Dotmatrix

The document discusses using LED dot-matrix displays with an Arduino by multiplexing rows and columns to control many LEDs with fewer pins. It describes connecting an 8x8 LED dot-matrix module to an Arduino using a MAX7219 chip, which handles refreshing the display and allows controlling 64 LEDs through serial communication. Procedures are provided to display letters on the dot-matrix using an Arduino program and library, and instructions to modify the program to display a surname with a switch or add animation effects.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
48 views3 pages

ECE36 Task#3 Dotmatrix

The document discusses using LED dot-matrix displays with an Arduino by multiplexing rows and columns to control many LEDs with fewer pins. It describes connecting an 8x8 LED dot-matrix module to an Arduino using a MAX7219 chip, which handles refreshing the display and allows controlling 64 LEDs through serial communication. Procedures are provided to display letters on the dot-matrix using an Arduino program and library, and instructions to modify the program to display a surname with a switch or add animation effects.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

ECE-36: Microcontrollers-Lab Name: ________________________________

Task #3 ID#: _____________ Score: ___________

Using Arduino with LED Dot-Matrix Displays

LED Dot-Matrix Displays


A typical single color (i.e. red, green, etc.) 8×8 dot matrix unit has 16 pins; 8 for each row and 8 for each column. The reason
for all rows and columns being wired together is to reduce the number of pins required. If this were not the case, an 8×8 dot matrix
unit would require 64+1 pins, one for each LED and one for a common anode or cathode connector. By wiring rows and columns
together, only 16 pins are required. This technique of controlling a large number of LEDs with fewer pins is called “multiplexing”.
The diagram below shows how the individual LEDs of an 8x8 dot-matrix are internally connected and how they can be activated
individually.

When using “multiplexing” technique, each column is activated for a very short period of time and at the same time LEDs
on that column are lit by addressing the corresponding row. The columns are switched so fast (hundreds or thousands of times a
second) that the persistence of the human eye perceives the display to be fully lit. Therefore, only a maximum of eight LEDs are
“ON” at the same time.

MAX7219 Chip

The difficult part about multiplexing is that you need to use 8 power transistors and you have to constantly refresh the
display to keep the image stable. This will require a complex circuit and longer programming code. However, with the use of the
MAX7219 Integrated Circuit (IC), all the control and refresh work will be performed by this chip. All you have to do is send it serial
commands through the 4-pin SPI (serial peripheral interface) and it will automatically take care of the rest.

The MAX7219 can fully control 64 individual LEDs of the dot-matrix display (8x8) – including maintaining the same
brightness, and allowing you to adjust the brightness of the LEDs with hardware or software (or both). Once the display is updated
by the microcontroller, the MAX7219 then takes care of all the work of refreshing the display at 800 Hz. Thereby removing the
additional computation from the microcontroller, which can used in other parts of your program.

MAX7219 w/ Dot-matrix LED module

Based on the actual module illustrated below, you can see that there are 5-input pins and another 5-output pins. The output pins
are provided so you have an option to expand or cascade your dot matrix displays into larger display sizes, up to 8 modules. (i.e.
8x16, 8x24, 8x32, …up to 8x64)
Sample cascaded wiring connection

PROCEDURE #1:

Connect the +5Vdc supply power and GND to the 8x8 dot matrix module. These should be properly labelled in the module
itself. If you are only going to use a single (8x8) MAX7219 module you can power the module directly from the Arduino, but avoid it
if you can. Because the display draws a lot of current, to be safe, we need to run the module from the external power +5Vdc supply
instead of the 5V supply from the Arduino board, especially if you plan on adding more 8x8 modules.
The remaining pins are used for SPI communication. Because the MAX7219 module require a lot of data transfers, it will
have the best performance when connected to the hardware SPI (serial peripheral interface) pins on a microcontroller. Note that
each Arduino Board has different SPI pins which should be connected accordingly.
For Arduino boards such as the UNO, those pins are: #13 (SCK), #12 (MISO), #11 (MOSI) and #10 (SS).

Circuit Connection: Activities:


Connect the MAX7219 to Arduino as follows: Watch the tutorial Video. (@NVM-Moodle)
DIN → Arduino Pin #12 (MISO: master in, slave out) Download and install the LEDcontrol.h library. (@NVM-Moodle)
CS → Arduino Pin #11 (MOSI: master out, slave in) Download Pixel-to-Matrix utility program. (@NVM-Moodle)
CLK → Arduino Pin #10 (SS: slave select)

PROGRAMMING:

Type the program given below in your Arduino IDE.

The “byte frame[8]” in the program below shows the assignment for an 8-bit array with hexadecimal mapping of the
activated LEDs in the dot-matrix display for each “frame”. For example, if you want to activate ALL the LED in the first row of our 8x8
dot-matrix display, we need to put hexadecimal value “FF” (or 1111-1111 in binary) in our program:

Determining the byte frame hexadecimal equivalent of each activated LED can be easily obtained by running the
“PixelToMatrix.exe” application.
After, copying the <LedControl.h> library in your Arduino installation folder, connect your dot-matrix display to your
microcontroller board and RUN the program below. The program below shows a quick animation that only have 5 frames displayed
with 1 second interval, as you can observe from the program below.

After running the program properly to display the word “ISATU” ask your instructor to check your output. (30 pts)

#include <LedControl.h>

int DIN = 12; // set pin for MISO


int CS = 11; // set pin for MOSI
int CLK = 10; // set pin for SS

byte frame001[8]= {0x3C,0x18,0x18,0x18,0x18,0x18,0x18,0x3C,}; // I


byte frame002[8]= {0x3E,0xC3,0xC0,0x78,0x1E,0x03,0xC3,0x7E,}; // S
byte frame003[8]= {0x3C,0x7E,0xC3,0xC3,0xFF,0xC3,0xC3,0xC3,}; // A
byte frame004[8]= {0xFF,0xFF,0x18,0x18,0x18,0x18,0x18,0x18,}; // T
byte frame005[8]= {0xC3,0xC3,0xC3,0xC3,0xC3,0xC3,0x7E,0x3C,}; // U

LedControl lc=LedControl(DIN,CLK,CS,0);

void setup()
{
lc.shutdown(0,false); //The MAX7219 is in power-saving mode on startup
lc.setIntensity(0,0); // Set the brightness to low value
lc.clearDisplay(0); // clear the display
}

void loop()
{
printByte(frame001); delay(800);
printByte(frame002); delay(800);
printByte(frame003); delay(800);
printByte(frame004); delay(800);
printByte(frame005); delay(800);
lc.clearDisplay(0); delay(1500);
}

void printByte(byte character [])


{
int i = 0;
for(i=0;i<8;i++)
{
lc.setRow(0,i,character[i]);
}
}

PROCEDURE #2:
Edit the program given in Procedure #1 so that it will display your Surname. (i.e. Lopez, Garcia, Gomez, etc.) Note: only
first letter is capitalized. Also add a single tact switch to your circuit, so that, the displayed letters will change every time the switch
is pressed.
After running the program properly to display your surname ask your instructor to check your output. (30 pts)

PROCEDURE #3:
Crate a program that will display your Surname, similar to procedure #2, but this time add some animation effects.
Sample animation effects:
- Scrolling animation (up, down, left, right)
- Wipe animation (up, down, left, right)
- Etc.
After running the animation program properly, ask your instructor to check your output. (40 pts)

You might also like