How to use MAX7219, LED Matrix with Arduino: with I Love U Animation

Output display is as important as the inputs like sensors and signal processing using microcontrollers. Until now, I had learned and used LCD of various kinds like in LCD Display of Temperature and Humidity using DHT11 & Arduino with Code and MQ-2 Gas Sensor with Arduino and LCD projects. But I came across the MAX7219 IC and saw videos online and I became interested. So I wanted to learn how to use it. 

So, in this note I am writing how to build a beautiful LED matrix animation using an Arduino Uno and three daisy-chained MAX7219 modules.

For displaying text, I will display the message “I ❤️ U” with:

  • Full text display
  • Heartbeat animation ❤️
  • Typing-style animation (I → I❤️ → I❤️U)

This project is perfect for:

  • Beginners learning LED matrices
  • Arduino animation projects
  • DIY display boards

🧰 Components Required

  • Arduino Uno
  • 3 × MAX7219
  • 3 × 8×8 Red LED Matrix
  • Jumper wires
  • Breadboard or PCB
  • 5V Power Supply

🔌 Circuit Diagram (Daisy Chaining)

The MAX7219 allows easy daisy chaining. The following is the circuit diagram showing how to connect Arduino to MAX7219 and MAX7219 to 8x8 LED matrix display.

MAX7219, LED Matrix with Arduino

Video on wiring Arduino to MAX7219 and 8x8 LED Matrix 

Connections:

Arduino → First MAX7219

  • VCC → 5V
  • GND → GND
  • DIN → D11 (MOSI)
  • CLK → D13 (SCK)
  • CS/Load  → D10

Daisy Chain:

  • DOUT (1st) → DIN (2nd)
  • DOUT (2nd) → DIN (3rd)

All modules share:

  • CLK
  • CS/Load

⚙️ How It Works

The MAX7219 controls each 8×8 matrix using SPI communication.

We send:

  • Row data (8 bytes per character)
  • Data for all 3 matrices in one SPI cycle

Animation flow:

  1. Display full message
  2. Blink heart (heartbeat effect)
  3. Show typing animation
If you get confused about the MAX7219 IC pins, then use the MAX7219 IC pinout explorer which is a visual and interactive pinout free web tool designed to make designer work faster. Also, there is pinout explorer for Arduino, for this see ARDUINO UNO PINOUT EXPLORER.

💻 Arduino Code


#include <SPI.h>

const int CS_PIN = 10;
const int NUM_DEVICES = 3;

// Character patterns
byte char_I[8]     = {0x3C, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3C};
byte char_Heart[8] = {0x00, 0x66, 0xFF, 0xFF, 0x7E, 0x3C, 0x18, 0x00};
byte char_U[8]     = {0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3C, 0x18};

byte blank[8] = {0,0,0,0,0,0,0,0};

// Send command to all MAX7219
void sendGlobalCommand(byte reg, byte data) {
  digitalWrite(CS_PIN, LOW);
  for (int i = 0; i < NUM_DEVICES; i++) {
    SPI.transfer(reg);
    SPI.transfer(data);
  }
  digitalWrite(CS_PIN, HIGH);
}

// Update display
void updateDisplay(byte c1[], byte c2[], byte c3[]) {
  for (int row = 0; row < 8; row++) {
    digitalWrite(CS_PIN, LOW);

    SPI.transfer(row + 1);
    SPI.transfer(c3[row]);

    SPI.transfer(row + 1);
    SPI.transfer(c2[row]);

    SPI.transfer(row + 1);
    SPI.transfer(c1[row]);

    digitalWrite(CS_PIN, HIGH);
  }
}

void setup() {
  pinMode(CS_PIN, OUTPUT);
  SPI.begin();

  sendGlobalCommand(0x0F, 0x00);
  sendGlobalCommand(0x0B, 0x07);
  sendGlobalCommand(0x09, 0x00);
  sendGlobalCommand(0x0A, 0x0F);
  sendGlobalCommand(0x0C, 0x01);
}

void loop() {

  // 1. FULL TEXT
  updateDisplay(char_I, char_Heart, char_U);
  delay(800);

  // 2. HEART BEAT
  for (int i = 0; i < 6; i++) {
    updateDisplay(char_I, char_Heart, char_U);
    delay(120);

    updateDisplay(char_I, blank, char_U);
    delay(120);
  }

  // 3. TYPING EFFECT (REPEAT 2 TIMES)
  for (int repeat = 0; repeat < 2; repeat++) {

    // I
    updateDisplay(char_I, blank, blank);
    delay(250);

    // I ??
    updateDisplay(char_I, char_Heart, blank);
    delay(250);

    // I ?? U
    updateDisplay(char_I, char_Heart, char_U);
    delay(350);

    delay(150);
  }

  delay(400);
}
Perhaps you have noticed I did not use any Arduino library. There are many well know library that you can use with MAX7219.

🎥 Project Output

👉 The display shows:

  • “I ❤️ U” static
  • Heart blinking like a pulse ❤️
  • Typing effect:

    I
    I❤️
    I❤️U

🚀 Key Features

  • Daisy-chained LED matrices
  • SPI-based fast communication
  • Smooth animation effects
  • Expandable to more displays

💡 Future Improvements

  • Scrolling text (marquee display)
  • Bluetooth or Wi-Fi control
  • Sound-reactive LED animation
  • Use of WS2812 RGB matrices

🧠 Conclusion

Using the MAX7219 with an Arduino Uno makes it easy to build visually appealing display. So use it in your next project. 

This project demonstrates how simple code and SPI communication can create engaging animations on LED matrices.

Post a Comment

Previous Post Next Post