MAX7219 does not scroll (or do other things as expected)

Hello,
My first post, so please be kind and patient. I have searched this forum for an answer and either have missed it or it is not listed. I have some hardware, especially analogue, design experience, but I am learning some programming.
I have connected a MAX7219 (8 x 32) to an Arduino Mega. As test I used a guide from “Makerguides”. I copied code from the website and modified to suit the Mega’s SPI connections/pin out and to just scroll the letter “A” for simplicity.
What I am getting is the letter “A” scroll right to left across the most left-hand block of 8x8, then the next and then next, until the fourth RHS block of 8x8. It then repeats. I’ve chosen this example for this question as it is among the most simple.
I’ve tried other examples of code and what appears on my LED matrix display only vaguely reflect what is expected.
Help please. I was expecting that by copying example code I would not have a problem :frowning:
Code is:

/* Example code for scrolling text effect on MAX7219 LED dot matrix display with Arduino. More info: https://www.makerguides.com */

// Include the required Arduino libraries:
#include <MD_Parola.h>
#include <MD_MAX72xx.h>
#include <SPI.h>

// Define hardware type, size, and output pins:
#define HARDWARE_TYPE MD_MAX72XX::FC16_HW
#define MAX_DEVICES 4
#define CS_PIN 53

// Create a new instance of the MD_Parola class with hardware SPI connection:
MD_Parola myDisplay = MD_Parola(HARDWARE_TYPE, CS_PIN, MAX_DEVICES);

// Setup for software SPI:
//#define DATA_PIN 50
//#define CLK_PIN 51
//MD_Parola myDisplay = MD_Parola(HARDWARE_TYPE, DATA_PIN, CLK_PIN, CS_PIN, MAX_DEVICES);

void setup() {
  // Intialize the object:
  myDisplay.begin();
  // Set the intensity (brightness) of the display (0-15):
  myDisplay.setIntensity(0);
  // Clear the display:
  myDisplay.displayClear();
  myDisplay.displayText("A", PA_CENTER, 300, 0, PA_SCROLL_LEFT, PA_SCROLL_LEFT);
}

void loop() {
  if (myDisplay.displayAnimate()) {
    myDisplay.displayReset();
  }
}

How many MAC7219 do you have connected? Your descriptions reads like just 1.

Sorry, I will try to clarify.
I have one item that comprises a set of interconnected four MAX7219, each MAX7219 drives a matrix of 8x8 LEDs. The assembly is therefore 8x32 LEDs.
Is this clearer?

I would add an image; photo or similar, but do not know how.

Ok, that makes more sense.

To post an attachment: Click the three dots next to Reply, then the Up arrow in the middle of the menu bar in the message box that opens.

Sorry - I didn’t say thanks for replying earlier.
I can see the upload option - cheers.
I’m off to bed now. Thanks for your help.

Stay well, Steve

This sets the type of matrix you have. The choices are in the MD_MAX72xx documentation. IT sounds to me k=like this is the wrong choice for the matrix you are using. You can try the other choices to see if they work (no hardware damage will occur), or if you post a photo or link to the matrix you have we can provide more specific help.

When you refer to “k”, do you mean the number of MAX7219 in the chain? In the line " #define MAX_DEVICES 4"?
I have tried the value 1,2,3 and 4 without the result being as described in the original webpage description.
The display I am using is one of these:-

.

k= was a typo, sorry, now struck out. The number of devices should be 4 as each matrix is a device.

The matrix you show is usually a FC16 type, but it is still worth trying different types to see if you have something different.

I should be extraordinarily surprised if it was anything other than a FC-16. :astonished:

Yes I would be too, but the symptoms are same as an incorrect matrix selection.

Thank you Marco,

I do not know the differing display types. I will have to Google the differing types to gain an understanding.

Bu tnot today - son has urgent carpentry work needed doing, ha ha.

Steve

Hello Paul,
As I just replied to Marco, I will have to search the different types; unless someone can direct me to an ‘idiots’ guide :wink:

Steve

Hi.
I have the same 4 block matrix module on a UNO.
I ran your code just changed

#define CS_PIN 53

To;

#define CS_PIN 10

For the UNO pinouts.

I got the letter A scrolling right to left and sequentially as wanted.
I changed the symmetrical A to a E to check if the character was back to front and it is oriented correctly.

Tom… :grinning: :+1: :coffee: :australia:

1 Like

Thanks Tom,

Your video shows exactly what I expected - as you already know :slight_smile:

I will try to connect to an Arduino UNO. However the makerpage (https://www.makerguides.com/max7219-led-dot-matrix-display-arduino-tutorial/) has an image that shows the connections to the Uno, then the code lists connections as:
#define CS_PIN 2
// #define DATA_PIN 3
// #define CLK_PIN 4

The image is not large enough or clear enough to exactly see the coonections, but they are certainly not adjacent pins as per the definitions.

I have not enough time to try this myself this until next week. Could you explain the seemingly discrepency between the code pin numbers and the image?

Thanks for your help. Steve

Hi,
Mate, making CS to pin2, did not change my result.
Still scrolls correctly.
Can you post some images of the front and back of your display module please?

Tom… :grinning: :+1: :coffee: :australia:

As per my previous post, the choices are listed and explained in the MD_MAX72xx library documentation. No need to Google. You can just read the documentation that is in the docs subfolder of the MD_MAX72xx library.

Even easier is to run the MD_MAX72xx_Dynamic_HW example to display text on the display while cycling through the library supported hardware types. It prints out the module type on the display - the one that is legible on the display is the type of hardware being used.

Hi,
I ran the MD_MAX72xx_Dynamic_HW example on my project that I post the video clip for.
CS = Pin 10, CLK = Pin 13, Din = Pin 11.
Mine came up as FC16.

Tom… :grinning: :+1: :coffee: :australia:

Actually one other thing you may want to try is just reloading the library from the IDE Library Manager. If you have been previously manually changing settings (as advised by some other tutorials) in the library header file they may now be wrong.

In any case reloading can’t hurt an we’ll all know you have the latest and a clean install.

Hi,

Good idea. :+1: :+1: :+1:
I had to load up the library because I did all my work first work, many many months ago, on another laptop and hadn’t had to use it on the current upgraded laptop, so I would have downloaded the latest version.

Tom… :grinning: :+1: :coffee: :australia:

If I may elaborate, Marco’s old code required you to actually edit a library file to specify the type of the display assembly. Obviously, the MAX7219 always works the same way, but it is a matter of how the matrix is wired to the MAX7219 on the PCB.

This was plausibly convenient if you were only ever using the one display type… :sunglasses:

Now, the display type goes in your code:

but if you were using an old version of the library it would just ignore the #define and use the library default which was the original board Marco designed, made and at some time, sold. :grin:

There are really only two boards available on eBay, Aliexpress and such nowadays, the neat FC-16 module in single and quad matrix boards, and the old “clunky” module using the DIP chip with which I started in 2013

and was basically impractical to chain.