MAX7219 LED Dot Matrix Assembly and Testing
by CreativeStuff in Circuits > Arduino
8313 Views, 19 Favorites, 0 Comments
MAX7219 LED Dot Matrix Assembly and Testing
A Dot-Matrix Display is a display device which contains light emitting diodes aligned in the form of matrix.This Dot matrix displays are used in applications where Symbol, Graphic, Characters, Alphabets, Numerals are need to be displayed together in static as well as Scrolling motion.Dot Matrix Display is manufactured in various dimensions like 5x7,8x8,16x8,128x16, 128x32 and 128x64 where the numbers represent LED's in rows and columns, Also these displays comes in different colors such as Red, Green, Yellow, Blue, Orange, White.
In this Instructable, I will be going through interfacing an 8x8 Dot Matrix which has a MAX7219 driver to an Arduino Uno.Let's get started.
Supplies
MAX7219
Check the Package
As you can see I have a smt version of the driver board ,it's very important to verify each and every components needed as the smd components are very small in size and you can easily lose them.There are also dip version availabe online but I used the smt version for its size.
A Little About This Particular Dot Matrix
single module can drive the an 8x8 dot matrix common cathode.
Operating voltage: 5 v
Dimensions: length 3.2 cm X 3.2 cm wide X 1.3 cm high , holes with four screws, the diameter of 3 mm
Modules with input and output interfaces, support for cascading multiple modules.
Data IN and OUT terminals are specified on the module.
The MAX7219 Driver
The MAX7219 is an IC designed to control a 8x8 LED MATRIX. The IC is serial input common-cathode (Common Negative) display drivers that interface microprocessors (or microcontroller) to 7-segment numeric LED displays of up to 8 digits, bar-graph displays, or 64 individual LEDs.
Features and Specifications
Operating voltage range: +4.0 to +5.5V
Recommended operating voltage: +5V
Maximum supply voltage: 6V
Maximum current allowed to draw through each segment pin: 100mA
Maximum current allowed to through each DIGIT ground pin: 500mA
Low power consumption
Data-to-Segment Delay Time: 2.2mSec
Operating temperature: 0°C to +70°C
Storage Temperature: -65°C to +150°C
The Circuit
The circuit is quite simple and can be built using male to female jumper wires. Just follow the pinout and build the circuit. You can later assemble it on a PCB if you're making a permanent application for the Matrix.
The Pin Configuration is as follows:
- Vcc to 5V Pin of Arduino.
- Gnd to Gnd Pin of the Arduino.
- DIN to Digital Pin 12 of the Arduino.
- CS to Digital Pin 11 of the Arduino
- CLK to Digital Pin 10 of the Arduino.
The Code
Here in this Instructable I'll provide you with two different codes. One will generate some English alphabets and smilies on the Matrix. The other one to will all the 64 LEDs lighting up one by one. You must use the lledcontrol library to make it work.
This is the code for English alphabets and smiles
#include <ledcontrol.h>
int DIN = 12; int CS = 11; int CLK = 10; byte e[8]= {0x7C,0x7C,0x60,0x7C,0x7C,0x60,0x7C,0x7C}; byte d[8]= {0x78,0x7C,0x66,0x66,0x66,0x66,0x7C,0x78}; byte u[8]= {0x66,0x66,0x66,0x66,0x66,0x66,0x7E,0x7E}; byte c[8]= {0x7E,0x7E,0x60,0x60,0x60,0x60,0x7E,0x7E}; byte eight[8]= {0x7E,0x7E,0x66,0x7E,0x7E,0x66,0x7E,0x7E}; byte s[8]= {0x7E,0x7C,0x60,0x7C,0x3E,0x06,0x3E,0x7E}; byte dot[8]= {0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18}; byte o[8]= {0x7E,0x7E,0x66,0x66,0x66,0x66,0x7E,0x7E}; byte m[8]= {0xE7,0xFF,0xFF,0xDB,0xDB,0xDB,0xC3,0xC3}; LedControl lc=LedControl(DIN,CLK,CS,0); void setup(){ lc.shutdown(0,false); //The MAX72XX is in power-saving mode on startup lc.setIntensity(0,15); // Set the brightness to maximum value lc.clearDisplay(0); // and clear the display } void loop(){ byte smile[8]= {0x3C,0x42,0xA5,0x81,0xA5,0x99,0x42,0x3C}; byte neutral[8]= {0x3C,0x42,0xA5,0x81,0xBD,0x81,0x42,0x3C}; byte frown[8]= {0x3C,0x42,0xA5,0x81,0x99,0xA5,0x42,0x3C}; printByte(smile); delay(1000); printByte(neutral); delay(1000); printByte(frown); delay(1000); printEduc8s(); lc.clearDisplay(0); delay(1000); } void printEduc8s() { printByte(e); delay(1000); printByte(d); delay(1000); printByte(u); delay(1000); printByte(c); delay(1000); printByte(eight); delay(1000); printByte(s); delay(1000); printByte(dot); delay(1000); printByte(c); delay(1000); printByte(o); delay(1000); printByte(m); delay(1000); } void printByte(byte character []) { int i = 0; for(i=0;i<8;i++) { lc.setRow(0,i,character[i]); } }
and the code for testing all 64 LEDs
//We always have to include the library
#include "LedControl.h"/* Now we need a LedControl to work with. ***** These pin numbers will probably not work with your hardware ***** pin 12 is connected to the DataIn pin 10 is connected to the CLK pin 11 is connected to LOAD We have only a single MAX72XX. */ LedControl lc=LedControl(12,11,10,1);
/* we always wait a bit between updates of the display */ unsigned long delaytime=100;
void setup() { /* The MAX72XX is in power-saving mode on startup, we have to do a wakeup call */ lc.shutdown(0,false); /* Set the brightness to a medium values */ lc.setIntensity(0,8); /* and clear the display */ lc.clearDisplay(0); }
/* This method will display the characters for the word "Arduino" one after the other on the matrix. (you need at least 5x7 leds to see the whole chars) */ void writeArduinoOnMatrix() { /* here is the data for the characters */ byte a[5]={B01111110,B10001000,B10001000,B10001000,B01111110}; byte r[5]={B00111110,B00010000,B00100000,B00100000,B00010000}; byte d[5]={B00011100,B00100010,B00100010,B00010010,B11111110}; byte u[5]={B00111100,B00000010,B00000010,B00000100,B00111110}; byte i[5]={B00000000,B00100010,B10111110,B00000010,B00000000}; byte n[5]={B00111110,B00010000,B00100000,B00100000,B00011110}; byte o[5]={B00011100,B00100010,B00100010,B00100010,B00011100};
/* now display them one by one with a small delay */ lc.setRow(0,0,a[0]); lc.setRow(0,1,a[1]); lc.setRow(0,2,a[2]); lc.setRow(0,3,a[3]); lc.setRow(0,4,a[4]); delay(delaytime); lc.setRow(0,0,r[0]); lc.setRow(0,1,r[1]); lc.setRow(0,2,r[2]); lc.setRow(0,3,r[3]); lc.setRow(0,4,r[4]); delay(delaytime); lc.setRow(0,0,d[0]); lc.setRow(0,1,d[1]); lc.setRow(0,2,d[2]); lc.setRow(0,3,d[3]); lc.setRow(0,4,d[4]); delay(delaytime); lc.setRow(0,0,u[0]); lc.setRow(0,1,u[1]); lc.setRow(0,2,u[2]); lc.setRow(0,3,u[3]); lc.setRow(0,4,u[4]); delay(delaytime); lc.setRow(0,0,i[0]); lc.setRow(0,1,i[1]); lc.setRow(0,2,i[2]); lc.setRow(0,3,i[3]); lc.setRow(0,4,i[4]); delay(delaytime); lc.setRow(0,0,n[0]); lc.setRow(0,1,n[1]); lc.setRow(0,2,n[2]); lc.setRow(0,3,n[3]); lc.setRow(0,4,n[4]); delay(delaytime); lc.setRow(0,0,o[0]); lc.setRow(0,1,o[1]); lc.setRow(0,2,o[2]); lc.setRow(0,3,o[3]); lc.setRow(0,4,o[4]); delay(delaytime); lc.setRow(0,0,0); lc.setRow(0,1,0); lc.setRow(0,2,0); lc.setRow(0,3,0); lc.setRow(0,4,0); delay(delaytime); }
/* This function lights up a some Leds in a row. The pattern will be repeated on every row. The pattern will blink along with the row-number. row number 4 (index==3) will blink 4 times etc. */ void rows() { for(int row=0;row<8;row++) { delay(delaytime); lc.setRow(0,row,B10100000); delay(delaytime); lc.setRow(0,row,(byte)0); for(int i=0;i
/* This function lights up a some Leds in a column. The pattern will be repeated on every column. The pattern will blink along with the column-number. column number 4 (index==3) will blink 4 times etc. */ void columns() { for(int col=0;col<8;col++) { delay(delaytime); lc.setColumn(0,col,B10100000); delay(delaytime); lc.setColumn(0,col,(byte)0); for(int i=0;i
/* This function will light up every Led on the matrix. The led will blink along with the row-number. row number 4 (index==3) will blink 4 times etc. */ void single() { for(int row=0;row<8;row++) { for(int col=0;col<8;col++) { delay(delaytime); lc.setLed(0,row,col,true); delay(delaytime); for(int i=0;i
void loop() { writeArduinoOnMatrix(); rows(); columns(); single(); }
The Output
Watch the full video here :-MAX7219 8x8 LED MATRIX ASSEMBLY AND TESTING using ARDUINO
Well all this hard work, surely pays off pretty well when you see the result. It's worth it !!
Subscribe to my youtube channel:-Creative Stuff