Pac Man Animation on 4 in 1 MAX7219 LED Display

Today in this video we will discuss how to make a Robotic Eye animation using MAX7219 LED Display. This LED Display consists of Four 8*8 LED Matrix Display.

four led matrix

At first the HexaDecimal files comes to the Microcontroller then it comes to the Peripheral Part means to the LED Display.

Hexfiles

Here I used D1 Mini as Microcontroller, anyone can used ESP8266 instead of D1 Mini and MAX7219 LED Display (Please check components link in the below).

Please support us on YouTube also. Like Share and Subscribe to our channel : https://youtube.com/c/RatnasRoboLab

Components

(1) MAX7219 Dot Matrix MCU LED Display Control Module Kit : https://amzn.to/3V5eboN
(2) Wemos® D1 Mini NodeMcu Lua WIFI ESP8266 Development Board: https://amzn.to/41IWgXw
(3) Programming USB Cable: https://amzn.to/3Nj01yj
(4) MAX7219 Display 4 in 1 : https://amzn.to/3n3DI4Y

Circuit Diagram

D1 mini’s (Microcontroller) Ground Pin and 5V connected to MAX7219 LED Display Ground Pin and VCC. MAX7219 LED Display’s DIN, CS and CLK pin is connected to Microcontroller’s pin D7, D4 and D5 respectively.

circuit diagram max7219
Controller D1 Mini and MAX7219 LED Display

Step By Step

Ok let it be simple, first glow the first LED in the first row in the first 8*8 LED Matrix.

1 led 1 row
#include <MD_MAX72xx.h>
#include <SPI.h>

#define HARDWARE_TYPE MD_MAX72XX::FC16_HW
#define MAX_DEVICES 4
#define CLK_PIN   14   // or SCK  D5
#define DATA_PIN  13  // or MOSI D7
#define CS_PIN    2  // or SS   D4

MD_MAX72XX mx = MD_MAX72XX(HARDWARE_TYPE, CS_PIN, MAX_DEVICES);   // SPI hardware interface
unsigned char firstledfirstrow[8]={0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};

int i=0;     // you can change the value of i from 0 to 3

void setup() 
{
  // put your setup code here, to run once:
     mx.begin();
}

void loop() 
{
         for (int j=0; j<8; j++)
         {
          mx.setRow(i, j, firstledfirstrow[j]);   // For setting a led in 1strow
         }
}

In this way we can easily create many type of Robotic animations to 2nd and 3rd 8*8 LED Matrix by sending HexaDecimal files to the Microcontroller.

evil eye

In this way we can also make a Digital Clock by setting the Time that after every minute 1st and 2nd 8*8 LED Matrix changes and every 60 minute Hour segment means 3rd an 4th 8*8 LED Matrix changes.

Code

#include <MD_MAX72xx.h>
#include <SPI.h>

#define HARDWARE_TYPE MD_MAX72XX::FC16_HW
#define MAX_DEVICES 4
#define CLK_PIN   14   // or SCK  D5
#define DATA_PIN  13  // or MOSI D7
#define CS_PIN    2  // or SS   D4

MD_MAX72XX mx = MD_MAX72XX(HARDWARE_TYPE, CS_PIN, MAX_DEVICES);   // SPI hardware interface
unsigned char pacman1[8]={0x3e, 0x7f, 0x49, 0x6d, 0x7f, 0x7f, 0x7f, 0x55};
unsigned char pacman2[8]={0x3c, 0x7e, 0xff, 0x1f, 0x1f, 0xff, 0x7e, 0x3c};
unsigned char pacman3[8]={0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00};

//int i=1;     // you can change the value of i from 0 to 3

void setup() 
{
  // put your setup code here, to run once:
     mx.begin();
}

void loop() 
{
         for (int j=0; j<8; j++)
         {
          mx.setRow(0, j, pacman1[j]);   // For setting emoji1
          mx.setRow(1, j, pacman2[j]);   // For setting emoji1
          mx.setRow(2, j, pacman3[j]);   // For setting emoji1
          mx.setRow(3, j, pacman3[j]);   // For setting emoji1
         }
         
}

Code to Note

mx.setRow(i, j, 0x00) – In this function the parameter i is used for which LED Matrix we want to display. If we set i=0; then 1st LED Matrix will glow, if we set i=3; then 4th LED Matrix will glow. The parameter j is used for which row we want to display. If we set j=0; then in 1st row will glow, if we set j=7; then in 8th row will glow.

Result

By this program we can control any LED that we want to glow in the big 32*8 LED Display by sending array of Hexa Decimals. Similarly, we can also reprogram the ARDUINO and change the Hexa Decimals and make any kind of animations.

Further Readings

If you liked this article, then please subscribe to our YouTube Channel. You can also find us on InstagramFacebook and Twitter.

READ – CONNECT – BOOST – CREATE

Related :

Follow :