Dot Matrix 8x8 Red LED Module MAX7219

  • Was  RM20.00 
  • RM10.50

  • Product Code: Dot Matrix MAX7219
  • Availability: In Stock

 

Features:

  • A single module can drive an 8 x 8 common cathode lattice
  • With four 3mm screw holes
  • Module with input and output interface, supports multiple modules cascade

 

Specifications:

  • Working Voltage: 5V DC
  • Size: 5cm(L) X 3.2cm(W) X 1.5cm(H)

 

Connect Dot Matrix to Arduino

The program was based on the basic Arduino book, author Michael McRoberts, with minor changes and adaptations. Load the program in Arduino changing the message lines, as indicated by the program to display the information you want:

// Program: horizontal Scrool with LED matrix 8x8
// Arduino and Co.
   
#include <pgmspace.h>  
#include <TimerOne.h>  
   
int DataPin = 4;  // Connect DIN to pin 4
int ClockPin = 5; // Connect CLK to pin 5
int LoadPin = 6;  // Connect CS/Load to pin 6
  
byte buffer[8];  
   
static byte font[][8] PROGMEM = {  
{B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000},   
{B00000100, B00000100, B00000100, B00000100, B00000100, B00000100, B00000000, B00000100},   
{B00001010, B00001010, B00001010, B00000000, B00000000, B00000000, B00000000, B00000000},   
{B00000000, B00001010, B00011111, B00001010, B00011111, B00001010, B00011111, B00001010},   
{B00000111, B00001100, B00010100, B00001100, B00000110, B00000101, B00000110, B00011100},   
{B00011001, B00011010, B00000010, B00000100, B00000100, B00001000, B00001011, B00010011},   
{B00000110, B00001010, B00010010, B00010100, B00001001, B00010110, B00010110, B00001001},   
{B00000100, B00000100, B00000100, B00000000, B00000000, B00000000, B00000000, B00000000},   
{B00000010, B00000100, B00001000, B00001000, B00001000, B00001000, B00000100, B00000010},   
{B00001000, B00000100, B00000010, B00000010, B00000010, B00000010, B00000100, B00001000},   
{B00010101, B00001110, B00011111, B00001110, B00010101, B00000000, B00000000, B00000000},   
{B00000000, B00000000, B00000100, B00000100, B00011111, B00000100, B00000100, B00000000},   
{B00000000, B00000000, B00000000, B00000000, B00000000, B00000110, B00000100, B00001000},   
{B00000000, B00000000, B00000000, B00000000, B00001110, B00000000, B00000000, B00000000},   
{B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000100},   
{B00000001, B00000010, B00000010, B00000100, B00000100, B00001000, B00001000, B00010000},   
{B00001110, B00010001, B00010011, B00010001, B00010101, B00010001, B00011001, B00001110},   
{B00000100, B00001100, B00010100, B00000100, B00000100, B00000100, B00000100, B00011111},   
{B00001110, B00010001, B00010001, B00000010, B00000100, B00001000, B00010000, B00011111},   
{B00001110, B00010001, B00000001, B00001110, B00000001, B00000001, B00010001, B00001110},   
{B00010000, B00010000, B00010100, B00010100, B00011111, B00000100, B00000100, B00000100},   
{B00011111, B00010000, B00010000, B00011110, B00000001, B00000001, B00000001, B00011110},   
{B00000111, B00001000, B00010000, B00011110, B00010001, B00010001, B00010001, B00001110},   
{B00011111, B00000001, B00000001, B00000001, B00000010, B00000100, B00001000, B00010000},   
{B00001110, B00010001, B00010001, B00001110, B00010001, B00010001, B00010001, B00001110},   
{B00001110, B00010001, B00010001, B00001111, B00000001, B00000001, B00000001, B00000001},   
{B00000000, B00000100, B00000100, B00000000, B00000000, B00000100, B00000100, B00000000},   
{B00000000, B00000100, B00000100, B00000000, B00000000, B00000100, B00000100, B00001000},   
{B00000001, B00000010, B00000100, B00001000, B00001000, B00000100, B00000010, B00000001},   
{B00000000, B00000000, B00000000, B00011110, B00000000, B00011110, B00000000, B00000000},   
{B00010000, B00001000, B00000100, B00000010, B00000010, B00000100, B00001000, B00010000},   
{B00001110, B00010001, B00010001, B00000010, B00000100, B00000100, B00000000, B00000100},   
{B00001110, B00010001, B00010001, B00010101, B00010101, B00010001, B00010001, B00011110},   
{B00001110, B00010001, B00010001, B00010001, B00011111, B00010001, B00010001, B00010001},   
{B00011110, B00010001, B00010001, B00011110, B00010001, B00010001, B00010001, B00011110},   
{B00000111, B00001000, B00010000, B00010000, B00010000, B00010000, B00001000, B00000111},   
{B00011100, B00010010, B00010001, B00010001, B00010001, B00010001, B00010010, B00011100},  
{B00011111, B00010000, B00010000, B00011110, B00010000, B00010000, B00010000, B00011111},   
{B00011111, B00010000, B00010000, B00011110, B00010000, B00010000, B00010000, B00010000},   
{B00001110, B00010001, B00010000, B00010000, B00010111, B00010001, B00010001, B00001110},   
{B00010001, B00010001, B00010001, B00011111, B00010001, B00010001, B00010001, B00010001},   
{B00011111, B00000100, B00000100, B00000100, B00000100, B00000100, B00000100, B00011111},   
{B00011111, B00000100, B00000100, B00000100, B00000100, B00000100, B00010100, B00001000},   
{B00010001, B00010010, B00010100, B00011000, B00010100, B00010010, B00010001, B00010001},   
{B00010000, B00010000, B00010000, B00010000, B00010000, B00010000, B00010000, B00011111},   
{B00010001, B00011011, B00011111, B00010101, B00010001, B00010001, B00010001, B00010001},   
{B00010001, B00011001, B00011001, B00010101, B00010101, B00010011, B00010011, B00010001},   
{B00001110, B00010001, B00010001, B00010001, B00010001, B00010001, B00010001, B00001110},   
{B00011110, B00010001, B00010001, B00011110, B00010000, B00010000, B00010000, B00010000},   
{B00001110, B00010001, B00010001, B00010001, B00010001, B00010101, B00010011, B00001111},   
{B00011110, B00010001, B00010001, B00011110, B00010100, B00010010, B00010001, B00010001},   
{B00001110, B00010001, B00010000, B00001000, B00000110, B00000001, B00010001, B00001110},   
{B00011111, B00000100, B00000100, B00000100, B00000100, B00000100, B00000100, B00000100},   
{B00010001, B00010001, B00010001, B00010001, B00010001, B00010001, B00010001, B00001110},   
{B00010001, B00010001, B00010001, B00010001, B00010001, B00010001, B00001010, B00000100},   
{B00010001, B00010001, B00010001, B00010001, B00010001, B00010101, B00010101, B00001010},   
{B00010001, B00010001, B00001010, B00000100, B00000100, B00001010, B00010001, B00010001},   
{B00010001, B00010001, B00001010, B00000100, B00000100, B00000100, B00000100, B00000100},   
{B00011111, B00000001, B00000010, B00000100, B00001000, B00010000, B00010000, B00011111},   
{B00001110, B00001000, B00001000, B00001000, B00001000, B00001000, B00001000, B00001110},   
{B00010000, B00001000, B00001000, B00000100, B00000100, B00000010, B00000010, B00000001},   
{B00001110, B00000010, B00000010, B00000010, B00000010, B00000010, B00000010, B00001110},   
{B00000100, B00001010, B00010001, B00000000, B00000000, B00000000, B00000000, B00000000},   
{B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00011111},   
{B00001000, B00000100, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000},   
{B00000000, B00000000, B00000000, B00001110, B00010010, B00010010, B00010010, B00001111},   
{B00000000, B00010000, B00010000, B00010000, B00011100, B00010010, B00010010, B00011100},   
{B00000000, B00000000, B00000000, B00001110, B00010000, B00010000, B00010000, B00001110},   
{B00000000, B00000001, B00000001, B00000001, B00000111, B00001001, B00001001, B00000111},   
{B00000000, B00000000, B00000000, B00011100, B00010010, B00011110, B00010000, B00001110},   
{B00000000, B00000011, B00000100, B00000100, B00000110, B00000100, B00000100, B00000100},   
{B00000000, B00001110, B00001010, B00001010, B00001110, B00000010, B00000010, B00001100},   
{B00000000, B00010000, B00010000, B00010000, B00011100, B00010010, B00010010, B00010010},   
{B00000000, B00000000, B00000100, B00000000, B00000100, B00000100, B00000100, B00000100},   
{B00000000, B00000010, B00000000, B00000010, B00000010, B00000010, B00000010, B00001100},   
{B00000000, B00010000, B00010000, B00010100, B00011000, B00011000, B00010100, B00010000},   
{B00000000, B00010000, B00010000, B00010000, B00010000, B00010000, B00010000, B00001100},   
{B00000000, B00000000, B00000000, B00001010, B00010101, B00010001, B00010001, B00010001},   
{B00000000, B00000000, B00000000, B00010100, B00011010, B00010010, B00010010, B00010010},   
{B00000000, B00000000, B00000000, B00001100, B00010010, B00010010, B00010010, B00001100},   
{B00000000, B00011100, B00010010, B00010010, B00011100, B00010000, B00010000, B00010000},   
{B00000000, B00001110, B00010010, B00010010, B00001110, B00000010, B00000010, B00000001},   
{B00000000, B00000000, B00000000, B00001010, B00001100, B00001000, B00001000, B00001000},   
{B00000000, B00000000, B00001110, B00010000, B00001000, B00000100, B00000010, B00011110},   
{B00000000, B00010000, B00010000, B00011100, B00010000, B00010000, B00010000, B00001100},   
{B00000000, B00000000, B00000000, B00010010, B00010010, B00010010, B00010010, B00001100},   
{B00000000, B00000000, B00000000, B00010001, B00010001, B00010001, B00001010, B00000100},   
{B00000000, B00000000, B00000000, B00010001, B00010001, B00010001, B00010101, B00001010},   
{B00000000, B00000000, B00000000, B00010001, B00001010, B00000100, B00001010, B00010001},   
{B00000000, B00000000, B00010001, B00001010, B00000100, B00001000, B00001000, B00010000},   
{B00000000, B00000000, B00000000, B00011111, B00000010, B00000100, B00001000, B00011111},   
{B00000010, B00000100, B00000100, B00000100, B00001000, B00000100, B00000100, B00000010},   
{B00000100, B00000100, B00000100, B00000100, B00000100, B00000100, B00000100, B00000100},   
{B00001000, B00000100, B00000100, B00000100, B00000010, B00000100, B00000100, B00001000},   
{B00000000, B00000000, B00000000, B00001010, B00011110, B00010100, B00000000, B00000000}   
};  
   
void clearDisplay() 
{
    for (byte x=0; x<8; x++) 
    {  
       buffer[x] = B00000000;  
    }  
    screenUpdate();  
}  
  
void initMAX7219() 
{  
    pinMode(DataPin, OUTPUT);  
    pinMode(LoadPin, OUTPUT);  
    pinMode(ClockPin, OUTPUT);  
    clearDisplay();  
    writeData(B00001011, B00000111);   
    writeData(B00001001, B00000000);   
    writeData(B00001100, B00000001);   
    intensity(1);   
}  
   
void intensity(int intensity) 
{  
    writeData(B00001010, intensity);   
}  
   
void writeData(byte MSB, byte LSB) 
{  
    byte mask;  
    digitalWrite(LoadPin, LOW);   
      
    for (mask = B10000000; mask>0; mask >>= 1) 
    {   
        digitalWrite(ClockPin, LOW);  
        if (MSB & mask)
        {   
           digitalWrite(DataPin,HIGH);   
        }  
        else
        {   
           digitalWrite(DataPin,LOW);   
        }  
        digitalWrite(ClockPin, HIGH);   
    }  
      
    for (mask = B10000000; mask>0; mask >>= 1) 
    {   
        digitalWrite(ClockPin, LOW);  
        if (LSB & mask)
        {   
           digitalWrite(DataPin,HIGH);   
        }  
        else
        {   
            digitalWrite(DataPin,LOW);   
        }  
        digitalWrite(ClockPin, HIGH);   
    }  
    digitalWrite(LoadPin, HIGH);   
    digitalWrite(ClockPin, LOW);  
}  
   
void scroll(char myString[], int speed) 
{  
    byte firstChrRow, secondChrRow;  
    byte ledOutput;  
    byte chrPointer = 0;   
    byte Char1, Char2;   
    byte scrollBit = 0;  
    byte strLength = 0;  
    unsigned long time;  
    unsigned long counter;  
       
    while (myString[strLength]) {strLength++;}  
    counter = millis();  
    while (chrPointer < (strLength-1)) 
    {  
       time = millis();  
       if (time > (counter + speed)) 
       { 
          Char1 = myString[chrPointer];  
          Char2 = myString[chrPointer+1];  
          for (byte y= 0; y<8; y++) 
          {  
            firstChrRow = pgm_read_byte(&font[Char1 - 32][y]);  
            secondChrRow = (pgm_read_byte(&font[Char2 - 32][y])) << 1;  
            ledOutput = (firstChrRow << scrollBit) | (secondChrRow >> (8 - scrollBit) );  
            buffer[y] = ledOutput;  
          }  
            scrollBit++;   
            if (scrollBit > 6) 
            {   
              scrollBit = 0;  
              chrPointer++;  
            }  
            counter = millis();  
        }  
    }  
}  
   
void screenUpdate() 
{  
   for (byte row = 0; row < 8; row++) 
   { 
      writeData(row+1, buffer[row]);  
   }  
}  
   
void setup() 
{  
   initMAX7219();  
   Timer1.initialize(10000);       
   Timer1.attachInterrupt(screenUpdate);   
}  
  
void loop() 
{  
   clearDisplay();    
   scroll(" Arduino: ", 100); // Display the message to scroll range of 100
   scroll(" - 2013 ", 100); // Add more lines to show other characters
}  

 

Write a review

Note: HTML is not translated!
    Bad           Good