Introduction: Multiple LED Matrices With Arduino
It is recommended that you have followed the previous instructable before you do this one.
Step 1: Components
For this project, you need the following components:
- Arduino Uno board
- 4 MAX7219 Red Dot Matrix Module
- 17 jumper wires M/M (male/male)
- 3 jumper wires F/M (female/male)
Although this instructable uses an Arduino Uno board, you can use other Arduino (compatible) boards
IMPORTANT: The LED matrix is common cathode. This module does not work with common anode matrices.
Step 2: Arduino Library
If you have not installed the Arduino library yet (LEDControlMS), do it now. You can find the library and the installation instructions here.
Step 3: Wiring of Common PINs
The LED Matrix modules have two sets of male header PINs, one for input (the PINs located closer to the MAX 7219 chip) and one for output.
All the PINs are named in the modules.
The difference between input and ouput only applies to the data PIN (DIN and DOUT).
For the rest of the PINs (VCC, GND, CS and CLK), the PIN at the input header is physically connected/shortcut to the PIN at the output header (this is because all the MAX7219 are daisy-chained sharing an SPI bus).
Enough talking. Let's wire the LED matrices:
First use the breadboard to plug the matrices. Plug them through the input headers (the MAX7219 chip should be below the LED matrix). and the output header PINs should show up at the top).
Place the four matrices next to each other so that there is no space left between them (see picture)
Now you have to connect all the VCC PINs of all the four matrices. Use 3 jumper wires (M/M) and connect using the breadboard holes:
- VCC of matrix 1 with VCC of matrix 2
- VCC of matrix 2 with VCC of matrix 3
- VCC of matrix 3 with VCC of matrix 4
To avoid errors connecting the wrong cable to the wrong PIN, it is recommended that you use different wire colours for different PINs (red colour in the pictures for VCC)
Repeat the same process to connect all the GND PINs of the four matrices (yellow colour in the pictures)
Repeat the same process to connect all the CS PINs of the four matrices (blue colour in the pictures)
Repeat the same process to connect all the CLK PINs of the four matrices (white colour in the pictures)
Step 4: Wiring of Data PINs
The four LED matrices are daisy-chained and this requires that the DATA output (DOUT) of one matrix is input to the next matrix (DIN).
Connect using F/M jumper wires (orange colour in the picture):
- DOUT of matrix 1 (header PINs) with DIN of matrix 2 (hole in breadboard)
- DOUT of matrix 2 (header PINs) with DIN of matrix 3 (hole in breadboard)
- DOUT of matrix 3 (header PINs) with DIN of matrix 4 (hole in breadboard)
Step 5: Wiring of Arduino
Now you have to connect Arduino to the first LED matrix.
Use 5 M/M jumper wires to connect:
LED Matrix 1 Arduino Colour of wire in picture
(hole in breadboard)
VCC 5V Red
GND GND Yellow
DIN D12 Orange
CS D10 Blue
CLK D11 White
It is important that you double-check all the wires and connections. One wire wrongly connected (or disconnected) is enough to prevent the correct working of the 4 matrices.
Step 6: Arduino Sample Sketch
Download the arduino sketch below (you will need to unzip it), open it from your arduino IDE and upload it to your Arduino
Note1: if the version of your Arduino IDE is "quite" old (0.x) you will need to change the extension of the arduino sketch from .ino to .pde (MakeSpaceTitle_LEDMatrix.ino -> MakeSpaceTitle_LEDMatrix.pde)
Note2: Before uploading the sketch, make sure that you have selected the right card and serial port for your arduino
Step 7: Sketch File (just in Case)
If you have been able to open the sketch file in the previous step, skip this step.
Here is the sketch file with .txt extension. For security reasons, instructable does not allow to upload files with uncommon extensions such as .ino used by arduino sketches.
Open a new sketch in your arduino IDE and copy the text content of this file. You can then upload it to your arduino as explained in the previous step.
Step 8: Scroll "MAKESPACE MADRID"
Study the code in the example sketch and update it to display other texts or create new effects.
Just one hint: most of the methods in the library have a first parameter called 'addr' or 'matrix'. This is the index of the matrix that the command refers to. This index starts from 0, so in our example, the matrix connected to the arduino board is index 0 and the last matrix is index 3 (see picture).
And now, if you really want to learn, dive into the code of the library to understand how it works and create new functions to make the most of your LED matrices.
Participated in the