MAX7219 Four-in-One Dot Matrix Display Module
The four-in-one dot matrix display module uses the MAX7219 as a controller. It is an integrated serial input/output common cathode display driver that connects the microprocessor to an 8-digit 7-segment LED display, as well as to bar graph displays or 64 independent LEDs. It includes an on-chip BCD encoder, multiplex scanning circuits, segment drivers, and an 8*8 static RAM for storing each piece of data. There is only one external register to set the segment current for each LED. It can connect to all general-purpose microprocessors. Each data point can be addressed without needing to rewrite the entire display when updating.
The entire device includes a low-power shutdown mode of 150μA, analog and digital brightness control, a scan limit register that allows users to display 1-8 digits of data, and a test mode that lights up all LEDs.
You only need 3 IO pins to drive one dot matrix! The display is flicker-free! It supports cascading!
Module Source
Baidu Netdisk Download Link:
https://pan.baidu.com/s/19WdOd8D2QlPi1Q_EWlb3fQ
Password:b822
Specifications
Operating Voltage:4-5.5V
Operating Current:8-330MA
Scanning rate:500-1300Hz
Communication protocol:Serial Communication
Pin Count:5 Pin (2.54mm pitch header)
Hardware Connection
For the four-in-one dot matrix module (typically containing four 8x8 matrices driven by a single MAX7219 chip), the connection is as follows:
- VCC: Connect to the development board's 5V.
- GND: Connect to the development board's GND.
- DIN: Data input, connect to a digital pin on the development board (for example, connect DIN to digital pin 11).
- CS: Chip select, also known as load (LOAD) or slave select (SS), connect to a digital pin on the development board (for example, connect CS to digital pin 10).
- CLK: Clock, connect to a digital pin on the development board (for example, connect CLK to digital pin 13).
Usage Method
Installing Library Files (skip this step if already installed)
- Open the Arduino IDE.
- Go to “Tools” > “Manage Libraries…”.
- Install the LedControl library via "Manage Libraries" (search for LedControl in Tools > Library > Manage Libraries… and install it).
Enter the code:
/******************************************************************************
* Test Hardware: LCSC ColorEasyDuino Development Board
* Version Number: V1.0
* Modified By: www.lckfb.com
* Modification Date: March 28, 2024
* Function Overview:
*****************************************************************************
* Open-source development board hardware and software information and related projects hardware and software information on official website
* Development board official website: www.lckfb.com
* Technical support resident forum, any technical problems are welcome at any time to exchange learning
* LCSC Forum: club.szlcsc.com
* Follow our Bilibili account: [立创开发板], stay toned to our latest news!
* We focus on cultivating Chinese engineers rather than profiting from board sales.
******************************************************************************/
#include "LedControl.h"
// 参数分别是DIN, CLK, CS, 设备数量(现在是4)
LedControl lc = LedControl(11, 13, 10, 4);
void setup() {
// 初始化所有模块
for (int module = 0; module < 4; module++) {
lc.shutdown(module, false); // 启动模块(关闭省电模式)
lc.setIntensity(module, 2); // 设置亮度,0是最低,15是最高
lc.clearDisplay(module); // 清屏
}
}
void loop() {
for (int module = 0; module < 4; module++) {
drawSmiley(module);
delay(500);
}
// 清除所有模块的显示
for (int module = 0; module < 4; module++) {
lc.clearDisplay(module);
}
delay(500);
}
void drawSmiley(int module) {
// 定义笑脸图案,1表示亮,0表示灭
byte smiley[] = {
B00111100, //第一行
B01000010, //第二行
B10100101, //第三行
B10000001, //第四行
B10100101, //第五行
B10011001, //第六行
B01000010, //第七行
B00111100 //第八行
};
// 遍历数组,绘制图案到指定模块
for (int row = 0; row < 8; row++) {
lc.setRow(module, row, smiley[]);
}
}
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