LED matrix display pins with Arduino Interface
An 8x8 LED matrix is a grid of 64 LEDs arranged in 8 rows and 8 columns. It is commonly used in various display and lighting applications, such as digital clocks, scrolling text displays, and graphical displays. Each LED can be controlled individually to create patterns, animations, or characters.
I will introduce 788bs as a common anode red color 8x8 LED matrix display module. We use it in many electronics displaying items, e.g. electronic clocks. also for moving message displays, displaying games, etc.
We use a dot matrix display with an Arduino UNO board directly, sometimes in projects. But for some projects, we use a max7219 chip or 74hc595 for dot matrix driver as required in our projects.
led Matrix 8x8 Pin Configuration
Each LED matrix can have a slightly different pin configuration, but a common
arrangement is as follows:
[LED Matrix]
Pin 1 - Row 1 Pin 2 - Row 2 Pin 3 - Row 3 Pin 4 - Row 4 Pin 5 - Row 5 Pin 6 - Row 6 Pin 7 - Row 7 Pin 8 - Row 8 Pin 9 - Column 1 Pin 10 - Column 2 Pin 11 - Column 3 Pin 12 - Column 4 Pin 13 - Column 5 Pin 14 - Column 6 Pin 15 - Column 7 Pin 16 - Column 8Common Cathode vs. Common Anode
Common Cathode:The negative ends of the LEDs in each row are connected together.
Common Anode:
Common Anode:
The positive ends of the LEDs in each row are connected together.
788BS Led Matrix
The led matrix modules are used in various colors, but I specifically describe the red led matrix. It is very easy to interface a 788bs led matrix with an Arduino board as compared to an RGB led display.
If we look at a piece of the 8x8 dot matrix, it contains 16 pins, of which 8 pins are used for rows and 8 for columns. That means rows and columns have 64 LEDs. We start from Pin # 1 to Pin # 8. Pin number 1 is R5 (Row-5) and Pin number 8 is R3(Row-3) to the downside.
If we look at a piece of the 8x8 dot matrix, it contains 16 pins, of which 8 pins are used for rows and 8 for columns. That means rows and columns have 64 LEDs. We start from Pin # 1 to Pin # 8. Pin number 1 is R5 (Row-5) and Pin number 8 is R3(Row-3) to the downside.
On the upper side, From Pin 9 (Row-1) to Pin 16 (column-1) are located. But a newbie is always confusing and starts from zero because we know the picture/diagram. often we get from some source, also we have to sort out which one +VE and -VE. might an expert can understand from common cathode/anode type.
But my concern about the person having a basic knowledge of electronics. Who try to make their own initial display projects like a clock or some more.
Ok, let’s start if we have an 8x8 led matrix, How do we know where pin 1 is? As in IC Chips near Pin 1, I mentioned a dot at IC/Microcontroller Chip. But here, how do we know?
At the 788bs led matrix module, the manufacturer writes the tag or mark at pin 1 side, as shown in the figure. We definitely find it. And also a curve mentioned at pin number 1 side.
We required a testing power supply of 1.5V DC. For the matrix, usually, a 5v supply is used. But, here, only one battery cell is enough or uses one 130 ohm resistance in series at a positive/negative side with a 5v supply.
After that attachment led to the power supply. We found that the 8th column and 5th rows led to becoming ON as the Connection shown in the figure. How to connect the battery cell with a matrix display.
Pin Test of led dot matrix
As shown in Fig pin # 1 and pin # 16 got Energize and the 8th Column and 5th-row led become ON. We should verify the Dot-matrix before using it because if any Led is found blown we can replace it with a good one.
Programming with Arduino UNO
To run the 788bs, you need to check it with Arduino UNO. What material do you need to perform a complete test?
Arduino UNO Amazon
Battery (1.5V) only one
Jumper wires
Jumper wires
We often use the dot matrix display with the shift register 74HC595 led driver or max7219. most common in electronic Circuits, we operate it with a Microcontroller or Arduino platform, and even with Raspberry Pi. To run led matrices with Arduino, we need to add a matrix library in the Arduino library. But in this circuit, we will test the matrix direct with an Arduino UNO board.
Interface dot matrix with Arduino
First set the matrix circuit, as per the connection given in the picture diagram. start the Arduino IDE to program the Arduino UNO board. Arduino IDE is available at Arduino's official site.
This circuit, it does not need resistance at all. Just connect wires as per the instruction.
Here you need two steps before starting a matrix connection with Arduino as per the 788bs datasheet matrix pins connection given.
1- 8x8 led matrix code generator
This will generate code for your matrix. Just draw anything for the matrix, copy the code, and use it in your program. You can draw different symbols, shapes, or words. [Link for code generator]
2- Add matrix library with Arduino Ide
First, add the 8x8 led dot matrix library in Arduino Ide. hereafter, the library manager in Arduino Ide will run the code. It will display in the matrix.
The connection between the Led matrix display and Arduino UNO
Matrix Rows Pins # ------------ Arduino Uno output Pins #
Pin # 1 ---------- 2
2 ---------- 3
3 ---------- 4
4 ---------- 5
5 ---------- 6
6 ---------- 7
7 ---------- 8
8 ---------- 9
2 ---------- 3
3 ---------- 4
4 ---------- 5
5 ---------- 6
6 ---------- 7
7 ---------- 8
8 ---------- 9
Matrix Column: Pins # ----------------- Arduino Uno output Pins #
Pin # 1 ------------ 10
2 ------------ 11
3 ------------ 12
4 ------------ 13
5 ------------ A1
6 ------------ A2
7 ------------ A3
8 ------------ A4
2 ------------ 11
3 ------------ 12
4 ------------ 13
5 ------------ A1
6 ------------ A2
7 ------------ A3
8 ------------ A4
Example: Using an Arduino with MAX7219
The MAX7219 is a common choice for driving an 8x8 LED matrix. Here's a basic example of how to set it up with an Arduino:
Components Needed:
- Arduino board (e.g., Arduino Uno)
- 8x8 LED matrix
- MAX7219 driver IC
- Connecting wires
- Breadboard
- VCC to 5V
- GND to GND
- DIN to Digital Pin 11 (MOSI)
- CS to Digital Pin 10 (SS)
- CLK to Digital Pin 13 (SCK)
MAX7219 to LED Matrix:
Connect the output pins of MAX7219 to the corresponding pins on the LED matrix.Arduino Code:
You can use the "
LedControl"
library to simplify controlling the LED matrix.#include <LedControl.h>
// Pin 12 is connected to the DataIn
// Pin 11 is connected to the CLK
// Pin 10 is connected to LOAD
LedControl lc = LedControl(12, 11, 10, 1);
void setup() {
lc.shutdown(0, false); // Wake up the MAX7219
lc.setIntensity(0, 8); // Set brightness level (0 is min, 15 is max)
lc.clearDisplay(0); // Clear the display
}
void loop() {
// Example: Display a single pixel at (3,4)
lc.setLed(0, 3, 4, true);
delay(1000);
// Example: Turn off the pixel at (3,4)
lc.setLed(0, 3, 4, false);
delay(1000);
// Example: Display a pattern
for(int row = 0; row < 8; row++) {
for(int col = 0; col < 8; col++) {
lc.setLed(0, row, col, (row + col) % 2 == 0);
}
}
delay(1000);
// Clear the display
lc.clearDisplay(0);
delay(1000);
}
Applications
Scrolling Text Displays:Create dynamic text displays for information boards.
Games:
Games:
Develop simple games like Tetris or Snake.
Visual Patterns:
Visual Patterns:
Display various patterns or animations for decoration or indicators.
sing an 8x8 LED matrix with a controller like the MAX7219 makes it easier to manage and control the individual LEDs, allowing for creative and practical applications.