LED Matrix Demo
This project demonstrates how to use a 32×8 LED matrix display. The display comprises four connected 8×8 panels, each of which is powered by a MAX7219 chip:
The matrix is controlled via an SPI interface. It has the following pins: CLK, CS, DIN, GND & VCC. 5V is required to operate the matrix. In this demo an Arduino Uno clone is used to control the matrix. A separate power supply is used to power the matrix to avoid overloading the Uno's built in power source.
A breadboard was used to connect the Uno to the LED matrix as shown below:
Power from my bench power supply comes from the left and is connected to the breadboard via crocodile clips. A second pair of smaller crocodile clips connects the power to the LED matrix. Note the electrolytic capacitor across the power rails to smooth the power. I think the capacitor should be between 470μF and 1000μF.
The Uno is powered via its USB connection:
Arudino pin | Attached to |
---|---|
GND | Ground rail of the breadboard and from there to the GND pin of the LED matrix and the power supply ground. |
10 (SPI CS) | LED matrix CS pin. |
11 (SPI COPI) | LED matrix DIN pin. |
13 (SPI SCK) | LED matrix CLK pin. |
Additionally, the matrix's VCC pin is connected to the breadboard's 5V rail.
The demo source code is available from the cahamo/demo-projects
repository on GitHub. The relevant code will be found in the max7219-led-matrix--uno
directory. All the C++ code is in max7219-led-matrix--uno/src/main.cpp
.
This demo is a PlatformIO project for use with Visual Studio Code. It can be modified for use with the Arduino IDE simply by copying the code from max7219-led-matrix--uno/src/main.cpp
into a new, blank Arduino API project and ensure that the MD_MAX72XX
and MD_Parola
libraries by MajicDesigns are installed.
Once the code is compiled and uploaded to the Uno and the external power supply is switched on you should see the text <Hello>
begin to scroll quickly down the display before pausing a while and then scrolling again. You can see the demo running in the following video.