8×8 LED Matrix Module

8×8 LED Matrix Module

Today,we introduce the usage of 8X8 LED Matrix Module. First we introduce the method it takes. Take digital ‘A’ as an example;

The above figure ‘A’ can also be any data to be displayed, it can be a picture, the above white circle represents 0, the red circle represents 1.
First column:       0b00000000 = 0x00;
Second column:  0b00111110 = 0x3E;
Third column:      0b01001000 = 0x48;
Fourth column:    0b10001000 = 0x88;
Fifth column:       0b10001000 = 0x88;
Sixth column:      0b01001000 = 0x48;
Seventh column: 0b00111110 = 0x3E;
Eighth column:    0b00000000 = 0x00.
We show the calculated ‘A’
Arduino program is as follows:

/***********************************************************
File name: 8X8LEDMatrixModule.ino
Description: you can see a rolling “A”or"Smiling face" should be displayed
             on the 8x8 LED matrix module.
Website: www.adeept.com
E-mail: support@adeept.com
Author: Tom
Date: 2017/10/14 
***********************************************************/

const int st_cpPin = 12; //Pin connected to ST_CP of 74HC595
const int sh_cpPin = 8;  //Pin connected to SH_CP of 74HC595  
const int dsPin = 11;    //Pin connected to DS of 74HC595 
//Column scanning
int data[] = {
              0x00,0x3E,0x48,0x88,0x88,0x48,0x3E,0x00 //A
             // 0x3C,0x42,0xA5,0x81,0xC3,0xBD,0x42,0x3C//Smiling face
              };
              
//Line scan            
unsigned char  tab[]={0x7f,0xbf,0xdf,0xef,0xf7,0xfb,0xfd,0xfe};  

void setup ()
{
  //set pins to output
  pinMode(st_cpPin,OUTPUT);//Set digital 12 port mode, the OUTPUT for the output
  pinMode(sh_cpPin,OUTPUT);//Set digital 8 port mode, the OUTPUT for the output
  pinMode(dsPin,OUTPUT);   //Set digital 11 port mode, the OUTPUT for the output
}

void loop()
{
    for(int num=0; num < 8; num++)//8 columns of data sent to a dot matrix
    {                       
        shiftOut(dsPin,sh_cpPin,MSBFIRST,data[num]); //Send column data to a dot matrix
        shiftOut(dsPin,sh_cpPin,MSBFIRST,tab[num]);//Send line data to a dot matrix
        //The rising edge of the data shift
        digitalWrite(st_cpPin,HIGH); //Output control latch HIGH  
        digitalWrite(st_cpPin,LOW);  //Output control latch LOW
     }
}

Connection diagram

The display is as follows:

We are here to do the demo as shown below ‘smiling face’

First column:       0b00111100 = 0x3C;
Second column:  0b01000010 = 0x42;
Third column:      0b10100101 = 0xA5;
Fourth column:    0b10000001 = 0x81;
Fifth column:       0b11000011 = 0xC3;
Sixth column:      0b10111101 = 0xBD;
Seventh column: 0b01000010 = 0x42;
Eighth column:    0b00111100 = 0x3C.
We will calculate the ‘smile’ show
Arduino program is as follows:

/***********************************************************
File name: 8X8LEDMatrixModule.ino
Description: you can see a rolling “A”or"Smiling face" should be displayed
             on the 8x8 LED matrix module.
Website: www.adeept.com
E-mail: support@adeept.com
Author: Tom
Date: 2017/10/14 
***********************************************************/

const int st_cpPin = 12; //Pin connected to ST_CP of 74HC595
const int sh_cpPin = 8;  //Pin connected to SH_CP of 74HC595  
const int dsPin = 11;    //Pin connected to DS of 74HC595 
//Column scanning
int data[] = {
              //0x00,0x3E,0x48,0x88,0x88,0x48,0x3E,0x00 //A
              0x3C,0x42,0xA5,0x81,0xC3,0xBD,0x42,0x3C//Smiling face
              };
              
//Line scan            
unsigned char  tab[]={0x7f,0xbf,0xdf,0xef,0xf7,0xfb,0xfd,0xfe};  

void setup ()
{
  //set pins to output
  pinMode(st_cpPin,OUTPUT);//Set digital 12 port mode, the OUTPUT for the output
  pinMode(sh_cpPin,OUTPUT);//Set digital 8 port mode, the OUTPUT for the output
  pinMode(dsPin,OUTPUT);   //Set digital 11 port mode, the OUTPUT for the output
}

void loop()
{
    for(int num=0; num < 8; num++)//8 columns of data sent to a dot matrix
    {                       
        shiftOut(dsPin,sh_cpPin,MSBFIRST,data[num]); //Send column data to a dot matrix
        shiftOut(dsPin,sh_cpPin,MSBFIRST,tab[num]);//Send line data to a dot matrix
        //The rising edge of the data shift
        digitalWrite(st_cpPin,HIGH); //Output control latch HIGH  
        digitalWrite(st_cpPin,LOW);  //Output control latch LOW
     }
}

The display is as follows:

Leave a Reply