Multiple LED Matrices With Arduino

131,038

167

76

Posted in TechnologyLeds

Introduction: Multiple LED Matrices With Arduino

This project is based on a workshop that we organised at Makespace Madrid as part of  "La noche de la electrónica con Jameco".  In a previous instructable we already introduced how to manage a single LED matrix with Arduino. In this project we connect multiple matrices to display text  messages.

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)
- Breadboard

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"

If everything worked fine, your LED matrices  should start scrolling the text "MAKESPACE MADRID" as shown in the video.

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.

Share

    Recommendations

    • Spotless Contest

      Spotless Contest
    • Microcontroller Contest

      Microcontroller Contest
    • Space Challenge

      Space Challenge
    user

    We have a be nice policy.
    Please be positive and constructive.

    Tips

    Questions

    76 Comments

    Buen tutorial tumaku quiero saber si existe librerias que se pueden controlar unas 25 matrices para arriba?

    I have cascaded led matrices 8x32 built together. I did the coded above but the characters are scrolling vertically. Just wondering if the library has function to have it scroll horizontally on 4 cascaded led matrix. Thanks!

    1 reply

    I am not sure what you mean by "scroll horizontally".

    The current library can drive up to 8 matrices (8x8 leds each) with a basic/coarse scroll. If you want another type of scroll, the library or the sketch will require to be updated.

    I have only 2 matrix 8x8. The text is not scrolling but moves from letter to letter. I used the codes from this site. Can anyone help that it can scrolling? Thanks.

    2 replies

    Thanks for the link!

    Hello Tumaku. Great project! I have a question about how can I change the letters to display to display something else? Which file would I change and where would that change be? Thanks.

    Hi, Grate instruction,, But have you found out how to put text on the matrix
    that dont scrol, ?? I got 4 matrix displays, eatch with a Max72 hov can i
    put up the a number ie 2016 without scrolling ??

    Tore

    Hi, How can I change the the direction of the words?, I charge the code, then in each matrix display the same message, thanks for your response

    1 reply

    I am not sure if I understand what you mean by "changing the direction of the words"
    The current code starts displaying the first character on the right-most matrix (index 0) and then it scrols the text moving to the left.
    This means that your matrices are aligned with matrix 0 on the right and matrix 3 on the right and the text scrolls right to left

    To achieve the effect of the text entering through the left-most matrix and scrolling left to right, you should change the code. Alternatively you can:
    - reorder physically the matrices: make matrxi index 0 the left-most and matrix 3 the right-most.
    - reverse the order of the string you want to write (e.g. "DLROW OLLEH" instead of "HELLO WORLD"

    only two of mine are working, i've checked the code and my wiring multiple times but nothing is wrong :/

    1 reply

    I cannot help you without further info. It looks like wrong wiring or wrong soldering (if one matrix is wrong, the other matrices down the lane may not work).

    Two things you could check:

    - make sure that your code includes: #define NBR_MTX 4

    - change the connecting order of your matrices. If the issue is with just one of them, you will be able to identify which one is the culprit.

    Hi Tumaku, very cool. I am trying to get 10 matrices to run, but have only been able to use 8 so far. Is this an issue with the chip or the software?

    1 reply

    Definitely the library (SW) limits the maximum number of matrices to 8.
    I am not usre if the HW sets a limmit to the number of matrices that can be daisy-chained. Searching in Internet I have found this project that uses 12 matrices https://github.com/nickgammon/MAX7219_Dot_Matrix You should also be careful with the power you need to lit so many matrices.

    When I use 5 matrices only four of them display letters, but when I reset they all light up and then go back to only 4, I already edited the code to 5 MTX. Help plz

    3 replies

    never mind I just had to at ch. 4

    Hi joshual40,

    from your comments I guess that you have solved your issues installing and using the library. Let me know otherwise.

    I never used the library with 5 matrices, but I did with 1, 4 or 8 matrices and it worked fine.

    Thanks for following my instructable!

    all I did was declare another character (ch4) and insert it into the code where needed but this instructable was very fun to follow and do

    I'm sill confused on how to install the library. Help please. A video would be best. rsvp Thanks

    I copied and pasted the 4 matrix code and yet when i compile it it say error about the

    #include "LedControlMS.h"

    help please??