Introduction
Welcome to the world of mesmerizing visual displays! In this guide, we’ll explore how to construct an 8×8 LED matrix without the need for any additional integrated circuits (ICs). There are many tutorials with the MAX7219 IC, but i decided to document the one without it. Although this projects needs more pins from the micro controller, it always recommended that we use the IC since it reduces the number of pins used on the microcontroller allowing us to tinker more with the project.
Working Principle
An LED matrix is a grid of individually addressable LED’s arranged in rows and columns. By selectively turning on and off specific LED’s within the matrix, we can create custom patterns, text, or animations. In this project, we’ll utilize Arduino to control the LED’s directly, eliminating the need for ICs and simplifying the circuitry.
Things we Need
- Arduino Uno
- 8×8 Matrix Display
- Jumper Cables
- Breadboard/s
- USB cable to upload the code
The blue line in the diagram depicts the label side on the 8×8 Matrix Display.
Code
There is no library need for this project. you can just do the connection and then upload the code.
// 2-dimensional array of row pin numbers:
int R[] = {2,7,A5,5,13,A4,12,A2};
// 2-dimensional array of column pin numbers:
int C[] = {6,11,10,3,A3,4,8,9};
unsigned char biglove[8][8] = //the big "heart"
{
0,0,0,0,0,0,0,0,
0,1,1,0,0,1,1,0,
1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,
0,1,1,1,1,1,1,0,
0,0,1,1,1,1,0,0,
0,0,0,1,1,0,0,0,
};
unsigned char border[8][8] = //Border"
{
1,1,1,1,1,1,1,1,
1,0,0,0,0,0,0,1,
1,0,0,0,0,0,0,1,
1,0,0,0,0,0,0,1,
1,0,0,0,0,0,0,1,
1,0,0,0,0,0,0,1,
1,0,0,0,0,0,0,1,
1,1,1,1,1,1,1,1,
};
unsigned char circle[8][8] = //circle"
{
0,0,1,1,1,1,0,0,
0,1,0,0,0,0,1,0,
1,0,0,0,0,0,0,1,
1,0,0,0,0,0,0,1,
1,0,0,0,0,0,0,1,
1,0,0,0,0,0,0,1,
0,1,0,0,0,0,1,0,
0,0,1,1,1,1,0,0,
};
unsigned char smile[8][8] = //smile"
{
0,0,1,1,1,1,0,0,
0,1,0,0,0,0,1,0,
1,0,1,0,0,1,0,1,
1,0,0,0,0,0,0,1,
1,0,1,0,0,1,0,1,
1,0,0,1,1,0,0,1,
0,1,0,0,0,0,1,0,
0,0,1,1,1,1,0,0,
};
unsigned char sad[8][8] = //smile"
{
0,0,1,1,1,1,0,0,
0,1,0,0,0,0,1,0,
1,0,1,0,0,1,0,1,
1,0,0,0,0,0,0,1,
1,0,0,1,1,0,0,1,
1,0,1,0,0,1,0,1,
0,1,0,0,0,0,1,0,
0,0,1,1,1,1,0,0,
};
unsigned char stubborn[8][8] = //smile"
{
0,0,1,1,1,1,0,0,
0,1,0,0,0,0,1,0,
1,0,1,0,0,1,0,1,
1,0,0,0,0,0,0,1,
1,0,1,1,1,1,0,1,
1,0,0,0,0,0,0,1,
0,1,0,0,0,0,1,0,
0,0,1,1,1,1,0,0,
};
unsigned char smalllove[8][8] = //the small "heart"
{
0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,
0,0,1,0,0,1,0,0,
0,1,1,1,1,1,1,0,
0,1,1,1,1,1,1,0,
0,0,1,1,1,1,0,0,
0,0,0,1,1,0,0,0,
0,0,0,0,0,0,0,0,
};
unsigned char pacman1[8][8] = //Pacman"
{
0,0,1,1,1,0,0,0,
0,1,0,0,0,1,0,0,
1,0,0,0,1,0,0,0,
1,0,0,1,0,0,0,1,
1,0,0,0,1,0,0,0,
0,1,0,0,0,1,0,0,
0,0,1,1,1,0,0,0,
0,0,0,0,0,0,0,0,
};
unsigned char pacman2[8][8] = //Pacman"
{
0,0,1,1,1,0,0,0,
0,1,0,0,0,1,0,0,
1,0,0,0,0,0,1,0,
1,0,0,0,1,1,1,0,
1,0,0,0,1,1,1,0,
0,1,0,0,0,1,0,0,
0,0,1,1,1,0,0,0,
0,0,0,0,0,0,0,0,
};
unsigned char pacman3[8][8] = //Pacman"
{
0,0,1,1,1,0,0,0,
0,1,0,0,0,1,0,0,
1,0,0,0,1,0,0,0,
1,0,0,1,0,0,0,0,
1,0,0,0,1,0,0,0,
0,1,0,0,0,1,0,0,
0,0,1,1,1,0,0,0,
0,0,0,0,0,0,0,0,
};
unsigned char star[8][8] = //the big "heart"
{
0,0,0,1,1,0,0,0,
0,0,1,1,1,1,0,0,
1,1,0,1,1,0,1,1,
0,1,1,1,1,1,1,0,
0,0,1,1,1,1,0,0,
0,1,1,1,1,1,1,0,
0,1,1,0,0,1,1,0,
1,0,0,0,0,0,0,1,
};
unsigned char starinverse[8][8] = //the big "heart"
{
1,1,1,0,0,1,1,1,
1,1,0,0,0,0,1,1,
0,0,1,0,0,1,0,0,
1,0,0,0,0,0,0,1,
1,1,0,0,0,0,1,1,
1,0,0,0,0,0,0,1,
1,0,0,1,1,0,0,1,
0,1,1,1,1,1,1,0,
};
void setup()
{
// iterate over the pins:
for(int i = 0;i<8;i++)
// initialize the output pins:
{
pinMode(R[i],OUTPUT);
pinMode(C[i],OUTPUT);
}
}
void loop()
{
for(int i = 0 ; i < 200 ; i++) //Loop display 100 times
{
Display(pacman1); //Display the "Big Heart"
}
for(int i = 0 ; i < 150 ; i++) //Loop display 100 times
{
Display(pacman2); //Display the "Big Heart"
}
for(int i = 0 ; i < 100 ; i++) //Loop display 100 times
{
Display(pacman3); //Display the "Big Heart"
}
}
void Display(unsigned char dat[8][8])
{
for(int c = 0; c<8;c++)
{
digitalWrite(C[c],LOW);//use thr column
//loop
for(int r = 0;r<8;r++)
{
digitalWrite(R[r],dat[r][c]);
}
delay(1);
Clear(); //Remove empty display light
}
}
void Clear() //清空显示
{
for(int i = 0;i<8;i++)
{
digitalWrite(R[i],LOW);
digitalWrite(C[i],HIGH);
}
}
- The setup function initializes the row and column pins as outputs and sets their initial states.
- In the loop function, we define the pattern to be displayed (in this case, a smiley face) as an array of binary numbers representing each row.
- The nested for loop iterates through each row and column, turning on the appropriate LEDs based on the binary pattern.
- Adjust the delay value to control the brightness of the LEDs and achieve desired visual effects.
Conclusion
With just a handful of components and some creative coding, you’ve constructed a captivating 8×8 LED matrix display using Arduino, without the need for any additional ICs. Experiment with different patterns, animations, and colors to unleash the full potential of your LED matrix. The possibilities are endless!