Arduino Programming 8×8 Common Cathode LED Dot Matrix Display (MAX7219)

by Lisleapex Blog in Circuits > Arduino

171 Views, 0 Favorites, 0 Comments

Arduino Programming 8×8 Common Cathode LED Dot Matrix Display (MAX7219)

at last1.png

MAX7219 dot matrix module: It consists of one 8x8 common cathode dot matrix 1088AS and one MAX7219, and communicates with the microcontroller via SPI.

Supplies

  1. MAX7219
  2. Arduino Uno
  3. Wire

Introduction to the MAX7219

MAX7219 Introduction


1. Basic Introduction:

MAX7219 is a small serial input/output chip for microprocessor and common cathode seven-segment - eight-digit LED display, bar/column display or 64-dot matrix display interface. The chip includes BCD decoder, multi-channel scanning controller, word and bit driver and 8×8 static RAM. Only one resistor is needed to set the current of all LED display fields. MAX7219 and microprocessor only need three wires to connect, and each displayed digit has an address written by the microprocessor. Allows users to choose whether each bit is BCD decoded or not. Users can also select shutdown mode, digital brightness control, select the number of scan bits from 1 to 8 and test mode for all LED displays.


2. Working Principle:

MAX7219 and single-chip computer are connected with three leads (DIN, CLK, LOAD), using 16-bit data serial shift reception. That is, the microcontroller sends the 16-bit binary number to the DIN terminal bit by bit, and is ready before the rising edge of CLK. Each rising edge of CLK shifts one bit of data into the shift register inside the MAX7219. When the 16 bits of data are shifted in, the 16 bits of data are loaded into the corresponding position in the MAX7219 at the rising edge of the LOAD pin signal, and dynamic display is achieved under the action of the MAX7219 internal hardware dynamic scanning display control circuit.


3.Pinout

MAX7219 Dot Matrix Module Physical Picture

MAX7219 dot matrix module physical picture.png

MAX7219 Dot Matrix Module Schematic Diagram

MAX7219 dot matrix module schematic diagram_副本.jpg

MAX7219 Pin Description

MAX7219 LED Matrix Module Function Description

  1. VCC: Power supply interface for the module, typically powered by a 5V microcontroller power pin.
  2. GND: Ground connection.
  3. DIN: Data input pin for serial communication.
  4. CS: Chip select pin; when set to low, serial data is loaded into the shift register.
  5. CLK: Clock interface for synchronizing data transmission.

Wiring With Arduino UNO R3 Development Board

MAX7219 LED Matrix Module to Arduino UNO Connection

  1. VCC: Connect to 5V on the Arduino.
  2. GND: Connect to GND on the Arduino.
  3. DIN: Connect to digital pin D11 on the Arduino.
  4. CS: Connect to digital pin D10 on the Arduino.
  5. CLK: Connect to digital pin D13 on the Arduino.


Dot Matrix Display Experiment

Matrix Display for Specific Patterns

  1. This experiment utilizes an Arduino UNO R3 development board and a custom-built circuit to achieve the desired functionality.
  2. The circuit diagram for the matrix display of specific patterns is shown below:
  3. Experiment Preparation: Install the "LedControl" library.
  4. Functionality: The matrix will display arrows (up, down, left, right), three different facial expressions, and three types of hearts.

Coding

//8*8LED dot matrix module display experiment

//Dot matrix displays up, down, left, right, and right arrows, three expressions, and three hearts


#include <LedControl.h>


//Arduino UNO SPI pins: D10 (CS), D11 (MOSI), D12 (MISO), D13 (SCLK)


int DIN = 11;//SPI mode, MOSI master device output, slave device input

int CS = 10;//SPI mode, CS chip select

int CLK = 13;//SPI mode, CLK


//Facial expression

byte smile[8] = {0x3C, 0x42, 0xA5, 0x81, 0xA5, 0x99, 0x42, 0x3C};//Smile

byte neutral[8] = {0x3C, 0x42, 0xA5, 0x81, 0xBD, 0x81, 0x42, 0x3C}; //Neutral

byte sad[8] = {0x3C, 0x42, 0xA5, 0x81, 0x99, 0xA5, 0x42, 0x3C}; //Sad


//Solid arrow

byte front[8] = {0x08, 0x1c, 0x3e, 0x7f, 0x1c, 0x1c, 0x1c, 0x1c}; //Upward arrow↑

byte back[8] = {0x1c, 0x1c, 0x1c, 0x1c, 0x7f, 0x3e, 0x1c, 0x08}; //Downward arrow↓

byte left[8] = {0x10, 0x30, 0x7f, 0xff, 0x7f, 0x30, 0x10, 0x00}; //Left arrow←

byte right[8] = {0x08, 0x0c, 0xfe, 0xff, 0xfe, 0x0c, 0x08, 0x00}; //Right arrow→


//Heart

byte heart[8] = {0x00, 0x76, 0x89, 0x81, 0x81, 0x42, 0x24, 0x18}; //Empty❤

byte heart1[8] = {0x00, 0x00, 0x24, 0x7E, 0x7E, 0x3C, 0x18, 0x00}; //Small❤

byte heart2[8] = {0x00, 0x66, 0xFF, 0xFF, 0xFF, 0x7E, 0x3C, 0x18}; //Big❤


LedControl lc = LedControl(DIN, CLK, CS, 0);//Create a new class object


void setup()

{

lc.shutdown(0, false); //Set the dot matrix to normal use mode during initialization

lc.setIntensity(0, 1); //Set the brightness value, range 0~15

lc.clearDisplay(0); //Dot matrix clear screen

}


void loop()

{

//Show arrow

printByte(Front);

delay(2000);

printByte(back);

delay(2000);

printByte(left);

delay(2000);

printByte(right);

delay(2000);


//Show expression

printByte(smile);

delay(2000);

printByte(neutral);

delay(2000);

printByte(sad);

delay(2000);


//Show❤

printByte(heart);

delay(2000);

printByte(heart1);

delay(2000);

printByte(heart2);

delay(2000);

}


void printByte(byte character [])

{

int i = 0;

for (i = 0; i < 8; i++)

{

lc.setRow(0, i, character[i]); //Set the state of 8 LEDs in a single row of dot matrix, and each row of data is represented in hexadecimal

}

}

At Last

at last2.png
at last1.png