• Home
  • Archive
  • Tools
  • Contact Us

The Customize Windows

Technology Journal

  • Cloud Computing
  • Computer
  • Digital Photography
  • Windows 7
  • Archive
  • Cloud Computing
  • Virtualization
  • Computer and Internet
  • Digital Photography
  • Android
  • Sysadmin
  • Electronics
  • Big Data
  • Virtualization
  • Downloads
  • Web Development
  • Apple
  • Android
Advertisement
You are here:Home » Arduino 8×8 LED Dot Matrix Display With MAX7219 : Code

By Abhishek Ghosh October 18, 2017 9:20 am Updated on November 9, 2017

Arduino 8×8 LED Dot Matrix Display With MAX7219 : Code

Advertisement

Previously we shared many guides with TM1637 7 segment LED display. TM1637 was shown as it is mainly software based control, least knowledge on electronics needed. We actually discussed about MAX7219 in various articles like on increasing the number of pins of Arduino, This guide is on Arduino 8×8 LED Dot Matrix Display with MAX7219 code for testing for the beginners with one 8×8 LED Dot Matrix Board to get started. We made it obvious on LED bar display article that each LED on these boards is nothing but just another LED. In case of 8×8 LED Dot Matrix Display, these LED has common cathode. The same common cathode is used for single 7 segment LED display module. In a single 7 segment LED display, there is 8 and a dot. As we said before, one of the thing MAX7219 IC does is multiplexing – we can buy a separate MAX7219 IC and control LED, 7 segment LED etc. China 8×8 LED Dot Matrix Displays cost less than one MAX7219 IC! So, instead of buying a single MAX7219 IC plus 8×8 LED Dot Matrix, it is practical to buy them as module. Peoples usually add multiple 8×8 LED Dot Matrix Displays in real life to display text, graphics as sign board on public place. If we know to run 8×8 LED Dot Matrix Display with MAX7219, we can create Christmas of Diwali light with plain LED and MAX7219 IC – easy China like thought! So much written here for that reason :

Vim
1
https://playground.arduino.cc/Main/MAX72XXHardware

 

Arduino 8×8 LED Dot Matrix Display With MAX7219

 

These modules have 5 pins. For our and most guides, libraries the connection will be :

VCC connects to 5v of Arduino (always, constant)
GND connects to GND of Arduino (always, constant)
DIN connects to pin 12 of Arduino (variable)
CLK connects to pin 11 of Arduino (variable)
CS connects to pin 10 of Arduino (variable)

Advertisement

---

Please note that : the pins on the modules are serially VCC, GND, DIN, CS, CLK but usually libraries, and guides do not maintain the order of serial with respect to pin number. It is normal to connect in wrong pin and cry. For some reason, pin 12, 11, 10 works great for most of these displays.

Arduino 8x8 LED Dot Matrix Display With MAX7219

Install these libraries :

Vim
1
2
https://github.com/wayoda/LedControl
https://github.com/AbhishekGhosh/Arduino_LED_matrix_sketch

This is example code for 0 to 9 count display :

Vim
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
#include "LedControlMS.h"
 
/*
Configuring the LEDMatrix:
VCC connects to 5v of Arduino
GND connects to GND of Arduino
DIN connects to pin 12 of Arduino
CLK connects to pin 11 of Arduino
CS connects to pin 10 of Arduino
There is only one MAX7219 display module.
*/
 
#define NBR_MTX 2
LedControl lc=LedControl(12,11,10, NBR_MTX);
 
String sentence= "1234567890 ";
int letterCounter=0;
/* wait time between updates of the display */
unsigned long delaytime=300;
 
void setup() { // initalizes and sets up the initial values. Declaring function setup.
  /* The display module is in power-saving mode on startup.
  Do a wakeup call */
  Serial.begin(9600); // setting data rate as 9600 bits per second for serial data communication to computer
  Serial.println("Setup"); //prints data to serial port as human-readable text
  letterCounter=0;
  for (int i=0; i< NBR_MTX; i++){
    lc.shutdown(i,false); //keep the screen on
    lc.setIntensity(i,8); // set brightness to medium values
    lc.clearDisplay(i); //clear the display after each letter
  }
}
 
void loop() { //declaring function loop
  char ch= sentence[letterCounter]; //define character ch
  letterCounter++;
  if (letterCounter>14) letterCounter=0; //sets up loop
  lc.displayChar(0, lc.getCharArrayPosition(ch)); //display each character on the screen
  delay(1000);
  lc.clearAll();
  delay(2);
}

Here is video :

This code is good for making Christmas light, Diwali light made with up to 64 LEDs and MAX7219 IC :

Vim
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
#include "LedControl.h"
LedControl lc=LedControl(12,11,10,1);
  /* Set the time */
unsigned long delaytime=20;
void setup() {
  lc.shutdown(0,false);
  /* Set the brightness */
  lc.setIntensity(0,2);
  lc.clearDisplay(0);
}
void writeArduinoOnMatrix() {
}
void single() {
  for(int row=0;row<8;row++) {
    for(int col=0;col<8;col++) {
      delay(delaytime);
      lc.setLed(0,row,col,true);
      delay(delaytime);
      for(int i=0;i<col;i++) {
        lc.setLed(0,row,col,false);
        delay(delaytime);
        lc.setLed(0,row,col,true);
        delay(delaytime);
      }
    }
  }
}
void loop() {
  writeArduinoOnMatrix();
  single();
  lc.clearDisplay(0);
}

This code will animate :-| and :-( :

Vim
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
#include "LedControl.h"
#include "binary.h"
 
/*
DIN connects to pin 12
CLK connects to pin 11
CS connects to pin 10
*/
LedControl lc=LedControl(12,11,10,1);
 
// delay time between faces
unsigned long delaytime=1000;
 
// happy face
byte hf[8]= {B00111100,B01000010,B10100101,B10000001,B10100101,B10011001,B01000010,B00111100};
// neutral face
byte nf[8]={B00111100, B01000010,B10100101,B10000001,B10111101,B10000001,B01000010,B00111100};
// sad face
byte sf[8]= {B00111100,B01000010,B10100101,B10000001,B10011001,B10100101,B01000010,B00111100};
 
void setup() {
  lc.shutdown(0,false);
  // Set brightness to a medium value
  lc.setIntensity(0,8);
  // Clear the display
  lc.clearDisplay(0);  
}
 
void drawFaces(){
  // Display sad face
  lc.setRow(0,0,sf[0]);
  lc.setRow(0,1,sf[1]);
  lc.setRow(0,2,sf[2]);
  lc.setRow(0,3,sf[3]);
  lc.setRow(0,4,sf[4]);
  lc.setRow(0,5,sf[5]);
  lc.setRow(0,6,sf[6]);
  lc.setRow(0,7,sf[7]);
  delay(delaytime);
  
  // Display neutral face
  lc.setRow(0,0,nf[0]);
  lc.setRow(0,1,nf[1]);
  lc.setRow(0,2,nf[2]);
  lc.setRow(0,3,nf[3]);
  lc.setRow(0,4,nf[4]);
  lc.setRow(0,5,nf[5]);
  lc.setRow(0,6,nf[6]);
  lc.setRow(0,7,nf[7]);
  delay(delaytime);
  
  // Display happy face
  lc.setRow(0,0,hf[0]);
  lc.setRow(0,1,hf[1]);
  lc.setRow(0,2,hf[2]);
  lc.setRow(0,3,hf[3]);
  lc.setRow(0,4,hf[4]);
  lc.setRow(0,5,hf[5]);
  lc.setRow(0,6,hf[6]);
  lc.setRow(0,7,hf[7]);
  delay(delaytime);
}
 
void loop(){
  drawFaces();
}

Tagged With arduino max7219 dot matrix code , arduino led matrix display code , arduino 8x8 led matrix code , max7219 arduino code examples , 8x8 dot matrix display arduino , arduino led matrix max7219 code , 8x8 matrix arduino code , arduino 8*8 led matrix codes , 8x8 led matrix arduino code , dot matrix arduino code
Facebook Twitter Pinterest

Abhishek Ghosh

About Abhishek Ghosh

Abhishek Ghosh is a Businessman, Surgeon, Author and Blogger. You can keep touch with him on Twitter - @AbhishekCTRL.

Here’s what we’ve got for you which might like :

Articles Related to Arduino 8×8 LED Dot Matrix Display With MAX7219 : Code

  • DIY LED Dot Matrix Display For Arduino Scrolling Text

    Here Are Many Ways To Build DIY LED Dot Matrix Display For Arduino Scrolling Text and Other Effects. Save Money By Buying Raw Components.

  • Connecting Arduino With M029 JoyStick : Getting Started

    Here is a Getting Started Guide Around Connecting Arduino With M029 JoyStick and Testing With Basic Code. It is a useful thing for robotics.

  • 7 Segment LED Display Tutorial For Dummies

    Here is Step By Step 7 Segment LED Display Tutorial For Dummies On How To Light Up With Battery To Control With Arduino Without Library.

  • Arduino 8 Digit 7 Segment LED Display Buying Guide

    Here Is Arduino 8 Digit 7 Segment LED Display Buying Guide. These Are Driven By MAX7219/MAX7221 Driver Which Supports LED Dot Matrix Too.

performing a search on this website can help you. Also, we have YouTube Videos.

Take The Conversation Further ...

We'd love to know your thoughts on this article.
Meet the Author over on Twitter to join the conversation right now!

If you want to Advertise on our Article or want a Sponsored Article, you are invited to Contact us.

Contact Us

Subscribe To Our Free Newsletter

Get new posts by email:

Please Confirm the Subscription When Approval Email Will Arrive in Your Email Inbox as Second Step.

Search this website…

 

Popular Articles

Our Homepage is best place to find popular articles!

Here Are Some Good to Read Articles :

  • Cloud Computing Service Models
  • What is Cloud Computing?
  • Cloud Computing and Social Networks in Mobile Space
  • ARM Processor Architecture
  • What Camera Mode to Choose
  • Indispensable MySQL queries for custom fields in WordPress
  • Windows 7 Speech Recognition Scripting Related Tutorials

Social Networks

  • Pinterest (24.3K Followers)
  • Twitter (5.8k Followers)
  • Facebook (5.7k Followers)
  • LinkedIn (3.7k Followers)
  • YouTube (1.3k Followers)
  • GitHub (Repository)
  • GitHub (Gists)
Looking to publish sponsored article on our website?

Contact us

Recent Posts

  • Affiliate Marketing Condition/Commission ModelsNovember 28, 2023
  • How Affiliate Marketing WorksNovember 28, 2023
  • Phases of Product DevelopmentNovember 27, 2023
  • Sub-Areas of Direct MarketingNovember 27, 2023
  • Strengths and Weakness of Direct MarketingNovember 26, 2023
PC users can consult Corrine Chorney for Security.

Want to know more about us?

Read Notability and Mentions & Our Setup.

Copyright © 2023 - The Customize Windows | dESIGNed by The Customize Windows

Copyright  · Privacy Policy  · Advertising Policy  · Terms of Service  · Refund Policy