Dot Matrix

From ElectroDragon
Jump to navigation Jump to search

Matrix Driver | Datasheet

drive a multiplexed 16x8 matrix (that's 128 individual LEDs) - 16 anodes and 8 cathodes 
I2C interface
supports also reading a 3x13 keypad matrix

74HC138, 74HC595

Schematic, pin definition

Board schematic

Dot matrix Pin definition

Single Matrix Display

输入端:input end, 级联输出端: output end

Introduction

LED Matrix Kit.jpg

This product is a serially driven 8x8 LED Matrix kit powered by MAX7219.

It only needs three data lines and two power lines.

The 8x8 LED Matrix is easy to use and compatible with Arduino, and its LED brightness adjustment can be implemented in software.

8x8 LED Matrix kit has many applications in real life, such as various types of electronic display panels. If the LED matrix is not driven by any peripherals, it’ll waste the interface of devices, and the LED brightness will be impaired due to insufficient power, so that we cannot get ideal display effect.

The LED matrix can be driven in two ways: parallel or serial. We usually drive it in the serial manner in order to save interface. The serial-driven LED matrix actually dynamically displays the LEDs, i.e., displays the LEDs row-by-row or column-by-column. The persistence of vision for humans is about 0.1s, so as long as we can serially display all 8 rows/columns within 0.1s, we’ll see a complete character or pattern.

This product comes in the form of a kit. It includes the following components:

  • MAX7219
  • Electrolytic cpaacitor:10uF/25V
  • Resistor:10K
  • Capacitance:0.1uF
  • Headers and receptacles.

After assembling, it will look as:

LED Matrix1.jpg

Specification of LED Matrix

DIMENSIONS

Dimensions of led matrix.jpg
  • Operating Voltage: DC 4.7V – 5.3V
Typical Voltage: 5V
  • Operating Current: 320mA
Max Operating Current: 2A
  • Operating Temperature: 0 ℃ – 50 ℃
Typical Temperature: 25 ℃

Wiring

LED Matrix wiring.jpg

1.Wiring Instructions

  • Connect Arduino pin8 to DIN on 8x8 LED Matrix
  • Connect Arduino pin9 to CS of 8x8 LED Matrix
  • Connect Arduino pin10 to CLK of 8x8 LED Matrix
  • Connect Arduino 5V to VCC of 8x8 LED Matrix
  • Connect Arduino GND to GND of 8x8 LED Matrix

Attention:8*8LED Matrix must be common-grounded with Arduino module. 2.Check the corresponding interfaces are properly connected.
3.Powering up the Arduino demo board with AC adapter.
4.Observation:The LED matrix should circularly display the digits 0 to 9 on LED screen first, then the characters A to Z, as shown in the above figure.

  • Open Arduino development environment.
  • Copy the source code we provide into Arduino compiler, and compile them.
  • Select proper serial port and board.
  • 4.Connect pins according to the schematics, and download codes into Arduino board. You’ll see the LED matrix circularly display the digits 0-9 and the characters A-Z.

Demo Code

Led matrix demo pcduino.JPG
#include "core.h"
unsigned char i;
unsigned char j; 
int Max7219_pinCLK = 8;
int Max7219_pinCS = 9;
int Max7219_pinDIN = 10;

unsigned char disp1[38][8] = 
{
  {0x3C,0x42,0x42,0x42,0x42,0x42,0x42,0x3C},//0
  {0x10,0x30,0x50,0x10,0x10,0x10,0x10,0x10},//1
  {0x7E,0x2,0x2,0x7E,0x40,0x40,0x40,0x7E},//2
  {0x3E,0x2,0x2,0x3E,0x2,0x2,0x3E,0x0},//3
  {0x8,0x18,0x28,0x48,0xFE,0x8,0x8,0x8},//4
  {0x3C,0x20,0x20,0x3C,0x4,0x4,0x3C,0x0},//5
  {0x3C,0x20,0x20,0x3C,0x24,0x24,0x3C,0x0},//6
  {0x3E,0x22,0x4,0x8,0x8,0x8,0x8,0x8},//7
  {0x0,0x3E,0x22,0x22,0x3E,0x22,0x22,0x3E},//8
  {0x3E,0x22,0x22,0x3E,0x2,0x2,0x2,0x3E},//9
  {0x8,0x14,0x22,0x3E,0x22,0x22,0x22,0x22},//A
  {0x3C,0x22,0x22,0x3E,0x22,0x22,0x3C,0x0},//B
  {0x3C,0x40,0x40,0x40,0x40,0x40,0x3C,0x0},//C
  {0x7C,0x42,0x42,0x42,0x42,0x42,0x7C,0x0},//D
  {0x7C,0x40,0x40,0x7C,0x40,0x40,0x40,0x7C},//E
  {0x7C,0x40,0x40,0x7C,0x40,0x40,0x40,0x40},//F
  {0x3C,0x40,0x40,0x40,0x40,0x44,0x44,0x3C},//G
  {0x44,0x44,0x44,0x7C,0x44,0x44,0x44,0x44},//H
  {0x7C,0x10,0x10,0x10,0x10,0x10,0x10,0x7C},//I
  {0x3C,0x8,0x8,0x8,0x8,0x8,0x48,0x30},//J
  {0x0,0x24,0x28,0x30,0x20,0x30,0x28,0x24},//K
  {0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x7C},//L
  {0x81,0xC3,0xA5,0x99,0x81,0x81,0x81,0x81},//M
  {0x0,0x42,0x62,0x52,0x4A,0x46,0x42,0x0},//N
  {0x3C,0x42,0x42,0x42,0x42,0x42,0x42,0x3C},//O
  {0x3C,0x22,0x22,0x22,0x3C,0x20,0x20,0x20},//P
  {0x1C,0x22,0x22,0x22,0x22,0x26,0x22,0x1D},//Q
  {0x3C,0x22,0x22,0x22,0x3C,0x24,0x22,0x21},//R
  {0x0,0x1E,0x20,0x20,0x3E,0x2,0x2,0x3C},//S
  {0x0,0x3E,0x8,0x8,0x8,0x8,0x8,0x8},//T
  {0x42,0x42,0x42,0x42,0x42,0x42,0x22,0x1C},//U
  {0x42,0x42,0x42,0x42,0x42,0x42,0x24,0x18},//V
  {0x0,0x49,0x49,0x49,0x49,0x2A,0x1C,0x0},//W
  {0x0,0x41,0x22,0x14,0x8,0x14,0x22,0x41},//X
  {0x41,0x22,0x14,0x8,0x8,0x8,0x8,0x8},//Y
  {0x0,0x7F,0x2,0x4,0x8,0x10,0x20,0x7F},//Z
  {0x8,0x7F,0x49,0x49,0x7F,0x8,0x8,0x8},// {0xFE,0xBA,0x92,0xBA,0x92,0x9A,0xBA,0xFE},
};

void Write_Max7219_byte(unsigned char DATA) 
{   
          unsigned char i;
	  digitalWrite(Max7219_pinCS,LOW);		
	  for(i=8;i>=1;i--)
          {		  
             digitalWrite(Max7219_pinCLK,LOW);
             if((DATA&0x80)==0x80)  digitalWrite(Max7219_pinDIN,HIGH);
             else                    digitalWrite(Max7219_pinDIN,LOW);     
             DATA = DATA<<1;
             digitalWrite(Max7219_pinCLK,HIGH);
          }                                 
}

void Write_Max7219(unsigned char address,unsigned char dat)
{
        digitalWrite(Max7219_pinCS,LOW);
        Write_Max7219_byte(address);              
        Write_Max7219_byte(dat);              
        digitalWrite(Max7219_pinCS,HIGH);
}

void Init_MAX7219(void)
{
       Write_Max7219(0x09, 0x00);       
       Write_Max7219(0x0a, 0x03);       
       Write_Max7219(0x0b, 0x07);       
       Write_Max7219(0x0c, 0x01);      
       Write_Max7219(0x0f, 0x00);      
}

void setup()
{
  pinMode(11,OUTPUT);
  pinMode(12,OUTPUT);
  digitalWrite(11,LOW);
  digitalWrite(12,HIGH);
  pinMode(Max7219_pinCLK,OUTPUT);
  pinMode(Max7219_pinCS,OUTPUT);
  pinMode(Max7219_pinDIN,OUTPUT);
  delay(50);
  Init_MAX7219();
}

void loop()
{ 
   for(j=0;j<38;j++)
  {
   for(i=1;i<9;i++)
    Write_Max7219(i,disp1[j][i-1]);
   delay(500);
  } 		
}

Documents

Chained Dot Matrix Display Parola

Installation Steps (Simple)

  • Take 3-set matrix display for example
Steps Direction Image Note
Soldering dot matrix to board directly Parola setup 1.jpg all silk print and dot on matrix should on same side of P1, brightness
Detailed look, all the accessories are not very necessary Parola setup 1a.jpg please double check direction
Soldering a bended pin header on the end of back side Parola setup 2.jpg on the another side of silk print, on right side if see front
Done Parola setup 3.jpg how it looks
Test with arduino Parola setup 4.jpg MAX72_xx library

Soldering Step by Step (Complex)

Step Note Header text
1 Soldering 4 pcs of 2x5 pin header of the back side of PCB carefully do not block the pin holes of the dot matrix during soldering, since they are very close, prepare desoldering tool in case
2 (optional) Soldering the dot matrix socket pin header 1x8 This is optional, if you prefer a slim display chain, and no need to remove the dot matrix anymore
3 place dot matrix on the socket, or soldering directly on board be VERY carefully if you solder it directly on board, the direction of the dot matrix should not be wrong , otherwise it will be useless board
4 Add jumpers on 2x5 pin headers, add signal or right of your chain display, should work now! try with MAX_72XX -> test sketch in arduino
  • The dot matrix has a "dot" or print words on the side of its left, "the left side of the IC"
  • The right angle pin header should be soldered on the right, "the right side of the IC"
Dot matrix direction.jpg

Software

Wiring

  • Connect to the right side pins of matrix (design error, both side marked with DOUT, but right side (when you face to the matrix) should be DIN)
  • Find follwing part and setup in Arduino, max72xx test sketch:
#define	MAX_DEVICES	5 // how many you chained 
#define	CLK_PIN		13  // or SCK - CLK
#define	DATA_PIN	11  // or MOSI - DIN
#define	CS_PIN		10  // or SS - LD (load)

Library and Demo code

Documents

Demo video

Dot Matrix drive by two 74HC595

int latchpin = 8; // connect to pin 12 on the '595
int clockpin = 13; // connect to pin 11 on the '595
int datapin = 11; // connect to pin 14 on the '595
int matrixrow[8] = {1,2,4,8,16,32,64,128};
int matrixcolumn[8] = {1,2,4,8,16,32,64,128};

void pixeldisplay(int row, int column, int holdtime) // turns on and off a pixel at row, column - with delay 'holdtime'
{
 digitalWrite(latchpin, LOW);
 shiftOut(datapin, clockpin, MSBFIRST, matrixcolumn[column-1]); // sets the digit to address
 shiftOut(datapin, clockpin, MSBFIRST, matrixrow[row-1]); // clears the digit
 digitalWrite(latchpin, HIGH);
 delay(holdtime);
}
void rowdisplay(int row, int holdtime)// turns on and off a row of LEDs with delay 'holdtime'
{
 digitalWrite(latchpin, LOW);
 shiftOut(datapin, clockpin, MSBFIRST, 255); // we want all the cathodes on, which is 11111111 in binary, 255 decimal
 shiftOut(datapin, clockpin, MSBFIRST, matrixrow[row-1]); // clears the digit
 digitalWrite(latchpin, HIGH);
 delay(holdtime);
} 
void columndisplay(int column, int holdtime)
// turns on and off a column of LEDs with delay 'holdtime'
{
 digitalWrite(latchpin, LOW);
 shiftOut(datapin, clockpin, MSBFIRST, matrixcolumn[column-1]); 
 shiftOut(datapin, clockpin, MSBFIRST, 255); // we want all the anodes on, which is 11111111 in binary, 255 decimal
 digitalWrite(latchpin, HIGH);
 delay(holdtime);
} 
void setup()
{
 pinMode(latchpin, OUTPUT);
 pinMode(clockpin, OUTPUT);
 pinMode(datapin, OUTPUT);
}
void loop()
{
 for (int a=1; a<9; a++)
 {
 for (int b=1; b<9; b++)
 {
 pixeldisplay(a,b,50);
 }
 }
 for (int a=1; a<9; a++)
 {
 for (int b=1; b<9; b++)
 {
 pixeldisplay(b,a,50);
 }
  }
 for (int zz=1; zz<11; zz++)
 {
 for (int a=1; a<9; a++)
 {
 rowdisplay(a, 50);
 }
 for (int a=1; a<9; a++)
 {
 columndisplay(a, 50);
 }
 }
}

Demo code