Close Menu
  • Articles
    • Learn Electronics
    • Product Review
    • Tech Articles
  • Electronics Circuits
    • 555 Timer Projects
    • Op-Amp Circuits
    • Power Electronics
  • Microcontrollers
    • Arduino Projects
    • STM32 Projects
    • AMB82-Mini IoT AI Camera
    • BLE Projects
  • IoT Projects
    • ESP8266 Projects
    • ESP32 Projects
    • ESP32 MicroPython
    • ESP32-CAM Projects
    • LoRa/LoRaWAN Projects
  • Raspberry Pi
    • Raspberry Pi Projects
    • Raspberry Pi Pico Projects
    • Raspberry Pi Pico W Projects
  • Electronics Calculator
Facebook X (Twitter) Instagram
  • About Us
  • Disclaimer
  • Privacy Policy
  • Contact Us
  • Advertise With Us
Facebook X (Twitter) Instagram Pinterest YouTube LinkedIn
How To Electronics
  • Articles
    • Learn Electronics
    • Product Review
    • Tech Articles
  • Electronics Circuits
    • 555 Timer Projects
    • Op-Amp Circuits
    • Power Electronics
  • Microcontrollers
    • Arduino Projects
    • STM32 Projects
    • AMB82-Mini IoT AI Camera
    • BLE Projects
  • IoT Projects
    • ESP8266 Projects
    • ESP32 Projects
    • ESP32 MicroPython
    • ESP32-CAM Projects
    • LoRa/LoRaWAN Projects
  • Raspberry Pi
    • Raspberry Pi Projects
    • Raspberry Pi Pico Projects
    • Raspberry Pi Pico W Projects
  • Electronics Calculator
How To Electronics
Home » 8×8 LED Matrix MAX7219 with Arduino Circuit & Code
Arduino Projects

8×8 LED Matrix MAX7219 with Arduino Circuit & Code

Sharath LagishettyBy Sharath LagishettyUpdated:October 3, 20224 Comments2 Mins Read
Share Facebook Twitter LinkedIn Telegram Reddit WhatsApp
8x8 LED Matrix MAX7219 Arduino
Share
Facebook Twitter LinkedIn Pinterest Email Reddit Telegram WhatsApp

Overview

In this project, we will learn how to use the 8×8 LED Matrix MAX7219 with Arduino. For that, we are going to interface an 8×8 LED matrix module with MAX7129 LED driver with Arduino Uno Board. An 8×8 LED matrix has 64 LEDs (Light Emitting Diodes) which are arranged in the form of a matrix as 8 rows and 8 columns. Hence it is named as an LED matrix.

We will generate different rolling LED patterns as well as shape and display it on LED Matrix using different Arduino Codes.


Bill of Materials

S.N.Components NameQuantityPurchase Links
1Arduino UNO Board1Amazon | AliExpress
28X8 LED Matrix with MAX72191Amazon | AliExpress
35V Power Supply1Amazon | AliExpress
4Connecting Wires10Amazon | AliExpress
5Breadboard1Amazon | AliExpress

8×8 LED matrix display

An 8 x 8 LED matrix display is used in this project to display the information. LED matrices are available in different styles like single color, dual color, multi-color or RGB LED matrix. They are also available in different dimensions like 5 x 7, 8 x 8, 16 x 16, 32 x 32 etc.

8x8 LED Matrix


Pin Configuration

The 8×8 LED matrix have 8 positive terminal & 8 negative terminals. The 8 negatuve terminals are 8 columns & 8 positive terminal are 8 rows.

LED-Matrix-Internal-Structure

MAX7219 LED Driver IC

The LED matrix can be driven in two ways. They are parallel (where each row or column are sent with parallel data) and serial (where the data is sent serially and an IC is used to convert this serial data into parallel data).

MAX 7219 is a common cathode display driver with serial input and parallel output. It is used to interface microprocessors and microcontrollers with 64 individual LEDs. The 8 x 8 LED matrix is connected to the MAX 7219. The data input is received from the Arduino board to the MAX7219.


Circuit & Connection: 8×8 LED Matrix MAX7219 with Arduino

The circuit diagram for interfacing 8×8 LED Matrix MAX7219 with Arduino is shown below.

Circuit 8x8 LED Matrix Arduino

C++
1
2
3
4
5
D10 ------------------LOAD or CHIP SELECT of LED module
D11 ------------------CLOCK of LED module
D12 ------------------DATA IN of LED module
+5V ------------------VCC of LED module
GND ------------------GND of LED module


8×8 LED Matrix Library

This 8×8 LED Matrix Library module will be interfaced with Arduino for displaying alphabets, characters & logos. First, we need to download a library specifically designed for LED MATRIX.

8×8 LED Matrix Library

After downloading the Zip file, extract the content. Put the folder in library folder inside Libraries –>>>— Arduino –>>>>>–Document



Source Code for Displaying Letters

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include "LedControlMS.h"
 
//pin 12 is connected to the DataIn
// pin 11 is connected to the CLK
//pin 10 is connected to LOAD
 
#define NBR_MTX 1 //number of matrices attached is one
LedControl lc=LedControl(12,11, 10, NBR_MTX);//
 
void setup()
{
  for (int i=0; i< NBR_MTX; i++)
  {
    lc.shutdown(i,false);
  /* Set the brightness to a medium values */
    lc.setIntensity(i,8);
  /* and clear the display */
    lc.clearDisplay(i);
                delay(500);
  }
}
 
void loop()
 
{
     lc.writeString(0,"HOW2ELECTRONICS");//sending characters to display
     lc.clearAll();//clearing the display
     delay(1000);
}


Source Code for Displaying Dotted Heart

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
unsigned char i;
unsigned char j;
 
int Max7219_pinCLK = 11;
int Max7219_pinCS = 10;
int Max7219_pinDIN = 12;
 
unsigned char disp1[19][8]={
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Heart Pattern
  0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x40, 0x40, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x80, 0x40, 0x40, 0x00, 0x00, 0x00,
  0x00, 0x80, 0x80, 0x40, 0x40, 0x00, 0x00, 0x00,
  0x40, 0x80, 0x80, 0x40, 0x40, 0x00, 0x00, 0x00,
  0x60, 0x80, 0x80, 0x40, 0x40, 0x00, 0x00, 0x00,
  0x60, 0x90, 0x80, 0x40, 0x40, 0x00, 0x00, 0x00,
  0x60, 0x90, 0x88, 0x40, 0x40, 0x00, 0x00, 0x00,
  0x60, 0x90, 0x88, 0x44, 0x40, 0x00, 0x00, 0x00,
  0x60, 0x90, 0x88, 0x44, 0x44, 0x00, 0x00, 0x00,
  0x60, 0x90, 0x88, 0x44, 0x44, 0x08, 0x00, 0x00,
  0x60, 0x90, 0x88, 0x44, 0x44, 0x08, 0x10, 0x00,
  0x60, 0x90, 0x88, 0x44, 0x44, 0x08, 0x10, 0x20,
  0x60, 0x90, 0x88, 0x44, 0x44, 0x08, 0x10, 0x60,
  0x60, 0x90, 0x88, 0x44, 0x44, 0x08, 0x90, 0x60,
  0x60, 0x90, 0x88, 0x44, 0x44, 0x88, 0x90, 0x60, // Heart Pattern
 
};
 
void Write_Max7219_byte(unsigned char DATA)
{  
  unsigned char i;
  digitalWrite(Max7219_pinCS,LOW);  
  for(i=8;i>=1;i--)
  {    
    digitalWrite(Max7219_pinCLK,LOW);
    digitalWrite(Max7219_pinDIN,DATA&0x80);
    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(Max7219_pinCLK,OUTPUT);
  pinMode(Max7219_pinCS,OUTPUT);
  pinMode(Max7219_pinDIN,OUTPUT);
  delay(50);
  Init_MAX7219();
}
 
void loop()
{
  for(j=0;j<19;j++)
  {
    for(i=1;i<9;i++)
      Write_Max7219(i,disp1[j][i-1]);
    delay(500);
  }  
}




Source Code for Displaying Beating Heart

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
int ANIMDELAY = 100;  // animation delay, deafault value is 100
int INTENSITYMIN = 0; // minimum brightness, valid range [0,15]
int INTENSITYMAX = 8; // maximum brightness, valid range [0,15]
 
int DIN_PIN = 12;      // data in pin
int CS_PIN = 10;       // load (CS) pin
int CLK_PIN = 11;      // clock pin
 
// MAX7219 registers
byte MAXREG_DECODEMODE = 0x09;
byte MAXREG_INTENSITY  = 0x0a;
byte MAXREG_SCANLIMIT  = 0x0b;
byte MAXREG_SHUTDOWN   = 0x0c;
byte MAXREG_DISPTEST   = 0x0f;
 
const unsigned char heart[] =
{
  B01100110,
  B11111111,
  B11111111,
  B11111111,
  B01111110,
  B00111100,
  B00011000,
  B00000000
};
 
 
 
void setup ()
{
  pinMode(DIN_PIN, OUTPUT);
  pinMode(CLK_PIN, OUTPUT);
  pinMode(CS_PIN, OUTPUT);
 
  // initialization of the MAX7219
  setRegistry(MAXREG_SCANLIMIT, 0x07);
  setRegistry(MAXREG_DECODEMODE, 0x00);  // using an led matrix (not digits)
  setRegistry(MAXREG_SHUTDOWN, 0x01);    // not in shutdown mode
  setRegistry(MAXREG_DISPTEST, 0x00);    // no display test
  setRegistry(MAXREG_INTENSITY, 0x0f & INTENSITYMIN);
 
  // draw hearth
  setRegistry(1, heart[0]);
  setRegistry(2, heart[1]);
  setRegistry(3, heart[2]);
  setRegistry(4, heart[3]);
  setRegistry(5, heart[4]);
  setRegistry(6, heart[5]);
  setRegistry(7, heart[6]);
  setRegistry(8, heart[7]);
}
 
 
void loop ()
{
  // second beat
  setRegistry(MAXREG_INTENSITY, 0x0f & INTENSITYMAX);
  delay(ANIMDELAY);
  
  // switch off
  setRegistry(MAXREG_INTENSITY, 0x0f & INTENSITYMIN);
  delay(ANIMDELAY);
  
  // second beat
  setRegistry(MAXREG_INTENSITY, 0x0f & INTENSITYMAX);
  delay(ANIMDELAY);
  
  // switch off
  setRegistry(MAXREG_INTENSITY, 0x0f & INTENSITYMIN);
  delay(ANIMDELAY*6);
}
 
 
void setRegistry(byte reg, byte value)
{
  digitalWrite(CS_PIN, LOW);
 
  putByte(reg);   // specify register
  putByte(value); // send data
 
  digitalWrite(CS_PIN, LOW);
  digitalWrite(CS_PIN, HIGH);
}
 
void putByte(byte data)
{
  byte i = 8;
  byte mask;
  while (i > 0)
  {
    mask = 0x01 << (i - 1);        // get bitmask
    digitalWrite( CLK_PIN, LOW);   // tick
    if (data & mask)               // choose bit
      digitalWrite(DIN_PIN, HIGH); // send 1
    else
      digitalWrite(DIN_PIN, LOW);  // send 0
    digitalWrite(CLK_PIN, HIGH);   // tock
    --i;                           // move to lesser bit
  }
}


Source Code for Displaying Custom Characters

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#include <LedControl.h>
int DIN = 12;
int CS =  10;
int CLK = 11;
byte L[8]=     {0x7f,0x7f,0x7f,0x07,0x07,0x07,0x07,0x07};
byte dot[8]=   {0x18,0x18,0x00,0x00,0x00,0x00,0x00,0x00};
byte S[8]=     {0x7e,0x7e,0x60,0x7e,0x7e,0x06,0x7e,0x7e};
byte H[8]=     {0xe7,0xe7,0xe7,0xff,0xff,0xe7,0xe7,0xe7};
byte A[8]=     {0xe7,0xe7,0xff,0xff,0xe7,0xe7,0x7e,0x3c};
byte R[8]=     {0xc7,0xe7,0x7f,0x7f,0xe7,0xe7,0xff,0x7e};
byte T[8]=     {0x18,0x18,0x18,0x18,0x18,0x18,0xff,0xff};
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(L);
  delay(1000);
  printByte(dot);
  delay(1000);
  printByte(S);
  delay(1000);
  printByte(H);
  delay(1000);
  printByte(A);
  delay(1000);
  printByte(R);
  delay(1000);
    printByte(A);
  delay(1000);
  printByte(T);
  delay(1000);
  printByte(H);
  delay(1000);
 
}
void printByte(byte character [])
{
  int i = 0;
  for(i=0;i<9;i++)
  {
    lc.setRow(0,i,character[i]);
  }
}

Share. Facebook Twitter Pinterest LinkedIn Tumblr Email Reddit Telegram WhatsApp
Previous ArticleGesture Recognition and Its Application in Machine Learning
Next Article MAX30100 Pulse Oximeter with ESP8266 on Blynk IoT App

Related Posts

DC Energy Meter using Arduino

Build a DC Energy Meter using Arduino – 32V/5A

Updated:August 26, 20252K
Interfacing ADXL375 Accelerometer with Arduino

Interfacing ADXL375 Accelerometer with Arduino (±200g)

Updated:June 28, 2025
PZEM-004T Arduino Energy Meter

DIY AC Energy Meter using PZEM-004T & Arduino

Updated:March 6, 20258K
Interfacing BMI160 Accelerometer & Gyroscope with Arduino

Interfacing BMI160 Accelerometer & Gyroscope with Arduino

Updated:February 2, 20259K
Password Based Door Lock Security System Using Arduino & Keypad

Password Based Door Lock Security System Using Arduino & Keypad

Updated:February 2, 20252436K
Earthquake Detector Alarm with with Accelerometer & Arduino

Earthquake Detector Alarm with Accelerometer & Arduino

Updated:February 2, 2025661K
View 4 Comments

4 Comments

  1. Bob on June 29, 2020 3:42 PM

    Isn’t this too much a load for the arduino? A single LED is about 20ma and the max for arduino is 150ma in total.(40ma max per pin) 64*20ma 1280ma.

    Reply
  2. Duc on December 19, 2021 6:00 PM

    display 8 LED at once, not display 8×8;
    The total current from all the IO pins together is 200 mA max; not 150mA

    Reply
  3. Pogo on October 27, 2022 3:48 AM

    The Arduino isn’t driving the LED’s directly. The MAX7219 is multiplexing them one row at a time. The datasheet says that the maximum current draw is 330 mA at full brightness

    Reply
  4. electronic newbie on December 2, 2022 5:33 PM

    Thank You, very helpful !

    Reply

CommentsCancel reply

Latest Posts
ESP32 Fingerprint Attendance System with Live Web Dashboard

ESP32 Fingerprint Attendance System with Live Web Dashboard

June 21, 2026
IoT Based PM & Air Quality Monitoring System using ESP32

IoT Based PM & Air Quality Monitoring System using ESP32

June 14, 2026
DIY ESP32 MLX90640 IR Thermal Camera with Live Web Display

DIY ESP32 MLX90640 IR Thermal Camera with Live Web Display

May 10, 2026
IoT Activity Tracker with ESP32 & Accelerometer Gyroscope

IoT Activity Tracker with ESP32 & Accelerometer/Gyroscope

May 2, 2026
A Guide to Sourcing Obsolete ICs for Vintage Projects

Beyond AliExpress: A Guide to Sourcing Obsolete ICs for Vintage Projects

April 21, 2026

ESP32 IoT Vehicle Motion Analyzer with MPU6050 & LIS3MDL

April 27, 2026
Building a Smart Sensor Node with a BLE Microcontroller

Building a Smart Sensor Node with a BLE Microcontroller

February 26, 2026
High-Accuracy Pitch, Roll, Yaw with ESP32 & BNO08x IMU

High-Accuracy Pitch, Roll, Yaw with ESP32 & BNO08x IMU

April 27, 2026
Top Posts & Pages
  • ESP32 Fingerprint Attendance System with Live Web Dashboard
    ESP32 Fingerprint Attendance System with Live Web Dashboard
  • ESP32 CAN Bus Tutorial | Interfacing MCP2515 CAN Module with ESP32
    ESP32 CAN Bus Tutorial | Interfacing MCP2515 CAN Module with ESP32
  • 12V DC to 220V AC Inverter Circuit & PCB
    12V DC to 220V AC Inverter Circuit & PCB
  • LD2410 Sensor with ESP32 - Human Presence Detection
    LD2410 Sensor with ESP32 - Human Presence Detection
  • IoT AC Energy Meter with PZEM-004T & ESP32 WebServer
    IoT AC Energy Meter with PZEM-004T & ESP32 WebServer
  • Silicon Controlled Rectifier (SCR): Construction, Working & Applications
    Silicon Controlled Rectifier (SCR): Construction, Working & Applications
  • IoT Based Patient Health Monitoring on ESP32 Web Server
    IoT Based Patient Health Monitoring on ESP32 Web Server
  • How to use ADS1115 16-Bit ADC Module with Arduino
    How to use ADS1115 16-Bit ADC Module with Arduino
Categories
  • Arduino Projects (197)
  • Articles (60)
    • Learn Electronics (19)
    • Product Review (15)
    • Tech Articles (28)
  • Electronics Circuits (46)
    • 555 Timer Projects (21)
    • Op-Amp Circuits (7)
    • Power Electronics (13)
  • IoT Projects (205)
    • ESP32 MicroPython (7)
    • ESP32 Projects (82)
    • ESP32-CAM Projects (15)
    • ESP8266 Projects (76)
    • LoRa/LoRaWAN Projects (22)
  • Microcontrollers (38)
    • AMB82-Mini IoT AI Camera (4)
    • BLE Projects (18)
    • STM32 Projects (19)
  • Raspberry Pi (93)
    • Raspberry Pi Pico Projects (57)
    • Raspberry Pi Pico W Projects (12)
    • Raspberry Pi Projects (24)
Follow Us
  • Facebook
  • Twitter
  • Pinterest
  • Instagram
  • YouTube
About Us

“‘How to Electronics’ is a vibrant community for electronics enthusiasts and professionals. We deliver latest insights in areas such as Embedded Systems, Power Electronics, AI, IoT, and Robotics. Our goal is to stimulate innovation and provide practical solutions for students, organizations, and industries. Join us to transform learning into a joyful journey of discovery and innovation.

Copyright © How To Electronics. All rights reserved.
  • About Us
  • Disclaimer
  • Privacy Policy
  • Contact Us
  • Advertise With Us

Type above and press Enter to search. Press Esc to cancel.

Ad Blocker Enabled!
Ad Blocker Enabled!
Looks like you're using an ad blocker. Please allow ads on our site. We rely on advertising to help fund our site.