Introduction: Controlling a Led Matrix Using Arduino

About: someone who likes electronics

Hi, friend.

In this article I will show you how to use Led Matrix using Arduino.

Led Matrix is a collection of LEDs in the form of arrays. Led Matrices have a variety of columns and rows, depending on the type. By presenting several LEDs with a certain combination, the Led matrix can display a number of characters, letters, symbols, and others Another name for Led Matrix is Dot Matrix.

The working principle of Led Matrix is the same as the "7-Segment Display" that I created yesterday. The difference between the two is the form of appearance only.

Step 1: Specifications of Led Matrix

Here are the specifications of the Led Matrix:

  • Number of LEDs: 64
  • Number of lines: 8
  • Number of columns: 8
  • Operating voltage: 4.7V - 5V DC
  • Operating Current: 320mA
  • Max Operating Current: 2A

Step 2: Required Components

Required components:

  • Led Matrik
  • Arduino Nano
  • Jumper Wire
  • USBmini
  • Project Board

Required Library:

To add a library to the Arduino IDE, you can see in this article "Add Library to Arduino"

Step 3: Connect the Led Matrix to the Arduino IDE

See the description below or see the picture above:

Led Matrix to Arduino

VCC ==> +5V


DIN ==> D6

CS ==> D7

CLK ==> D8

Step 4: Programming

This is an example sketch that can be used to try the led matrix:

//We always have to include the library
#include "LedControl.h"

/* Now we need a LedControl to work with. ***** These pin numbers will probably not work with your hardware ***** pin 6 is connected to the DataIn pin 8 is connected to the CLK pin 7 is connected to LOAD We have only a single MAX72XX. */

LedControl lc=LedControl(6,8,7,1);

/* we always wait a bit between updates of the display */ unsigned long delaytime=100;

void setup() { /* The MAX72XX is in power-saving mode on startup, we have to do a wakeup call */ lc.shutdown(0,false); /* Set the brightness to a medium values */ lc.setIntensity(0,8); /* and clear the display */ lc.clearDisplay(0); }

/* This method will display the characters for the word "Arduino" one after the other on the matrix. (you need at least 5x7 leds to see the whole chars) */ void writeArduinoOnMatrix() { /* here is the data for the characters */ byte a[5]={B01111110,B10001000,B10001000,B10001000,B01111110}; byte r[5]={B00111110,B00010000,B00100000,B00100000,B00010000}; byte d[5]={B00011100,B00100010,B00100010,B00010010,B11111110}; byte u[5]={B00111100,B00000010,B00000010,B00000100,B00111110}; byte i[5]={B00000000,B00100010,B10111110,B00000010,B00000000}; byte n[5]={B00111110,B00010000,B00100000,B00100000,B00011110}; byte o[5]={B00011100,B00100010,B00100010,B00100010,B00011100};

/* now display them one by one with a small delay */ lc.setRow(0,0,a[0]); lc.setRow(0,1,a[1]); lc.setRow(0,2,a[2]); lc.setRow(0,3,a[3]); lc.setRow(0,4,a[4]); delay(delaytime); lc.setRow(0,0,r[0]); lc.setRow(0,1,r[1]); lc.setRow(0,2,r[2]); lc.setRow(0,3,r[3]); lc.setRow(0,4,r[4]); delay(delaytime); lc.setRow(0,0,d[0]); lc.setRow(0,1,d[1]); lc.setRow(0,2,d[2]); lc.setRow(0,3,d[3]); lc.setRow(0,4,d[4]); delay(delaytime); lc.setRow(0,0,u[0]); lc.setRow(0,1,u[1]); lc.setRow(0,2,u[2]); lc.setRow(0,3,u[3]); lc.setRow(0,4,u[4]); delay(delaytime); lc.setRow(0,0,i[0]); lc.setRow(0,1,i[1]); lc.setRow(0,2,i[2]); lc.setRow(0,3,i[3]); lc.setRow(0,4,i[4]); delay(delaytime); lc.setRow(0,0,n[0]); lc.setRow(0,1,n[1]); lc.setRow(0,2,n[2]); lc.setRow(0,3,n[3]); lc.setRow(0,4,n[4]); delay(delaytime); lc.setRow(0,0,o[0]); lc.setRow(0,1,o[1]); lc.setRow(0,2,o[2]); lc.setRow(0,3,o[3]); lc.setRow(0,4,o[4]); delay(delaytime); lc.setRow(0,0,0); lc.setRow(0,1,0); lc.setRow(0,2,0); lc.setRow(0,3,0); lc.setRow(0,4,0); delay(delaytime); }

/* This function lights up a some Leds in a row. The pattern will be repeated on every row. The pattern will blink along with the row-number. row number 4 (index==3) will blink 4 times etc. */ void rows() { for(int row=0;row<8;row++) { delay(delaytime); lc.setRow(0,row,B10100000); delay(delaytime); lc.setRow(0,row,(byte)0); for(int i=0;i

/* This function lights up a some Leds in a column. The pattern will be repeated on every column. The pattern will blink along with the column-number. column number 4 (index==3) will blink 4 times etc. */ void columns() { for(int col=0;col<8;col++) { delay(delaytime); lc.setColumn(0,col,B10100000); delay(delaytime); lc.setColumn(0,col,(byte)0); for(int i=0;i

/* This function will light up every Led on the matrix. The led will blink along with the row-number. row number 4 (index==3) will blink 4 times etc. */ 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

void loop() { writeArduinoOnMatrix(); rows(); columns(); single(); }

I also present it as a file:

Step 5: Enjoi It

That was a tutorial on led matrix.

Thank you for reading this article. see you in the next article.