Text Scrolling with Dot Matrix 8x8 and MAX7219

Hello to everyone!! I'm new in this forum and I haven't found the subforum of presentations, if someone is kind enough to tell me I'd appreciate it.

I have got to this forum because I have been trying to build a text scrolling on a 8x8 LED matrix for several days unsuccessfully. I am using one MAX7219 multiplexing with an Arduino UNO R3. The problem is in the software part.

The connections I have made ??in the following way:

According to software, I am using "LedControl.h" library. I've got that each letter appears and disappears completely in the matrix, but independently. What I want is that a letter follows the previous one with 2 or 3 columns separation between letters. Can anyone help me with this?

Here is a video of the result I get with this:

My Sketch is:

//We always have to include the library
#include "LedControl.h"

//pin 12 is connected to the DataIn 
//pin 11 is connected to the CLK 
//pin 10 is connected to LOAD 

//LedControl(int dataPin, int clkPin, int csPin, int numDevices);
LedControl lc=LedControl(12,11,10,1);

void setup() {
  //The MAX72XX is in power-saving mode on startup, we have to do a wakeup call   
  lc.shutdown(0,false);
  //Set the brightness to a medium values (0~15 possible values)
  lc.setIntensity(0,2);
  //and clear the display
  lc.clearDisplay(0);
}

#define SP {0, 0, 0, 0, 0}               //Espacio
#define EX {0, 125, 0, 0, 0}             //Exclamacion !
#define A {31, 36, 68, 36, 31}
#define B {127, 73, 73, 73, 54,}
#define C {62, 65, 65, 65, 34}
#define D {127, 65, 65, 34, 28}
#define E {127, 73, 73, 65, 65}
#define F {127, 72, 72, 72, 64}
#define G {62, 65, 65, 69, 38}
#define H {127, 8, 8, 8, 127}
#define I {0, 65, 127, 65, 0}
#define J {2, 1, 1, 1, 126}
#define K {127, 8, 20, 34, 65}
#define L {127, 1, 1, 1, 1}
#define M {127, 32, 16, 32, 127}
#define N {127, 32, 16, 8, 127}
#define O {62, 65, 65, 65, 62}
#define P {127, 72, 72, 72, 48}
#define Q {62, 65, 69, 66, 61}
#define R {127, 72, 76, 74, 49}
#define S {50, 73, 73, 73, 38}
#define T {64, 64, 127, 64, 64}
#define U {126, 1, 1, 1, 126}
#define V {124, 2, 1, 2, 124}
#define W {126, 1, 6, 1, 126}
#define X {99, 20, 8, 20, 99}
#define Y {96, 16, 15, 16, 96}
#define Z {67, 69, 73, 81, 97}

//Escribimos la frase separando cada letra por comas
//En el primer numero lo adaptaremos la longitud de la frase (caracteres)
byte frase[5][5]={H,O,L,A,SP};
int largo = sizeof(frase)/5;
int gnd[18]={-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10,11,12};

void loop() { 

  for (int letra=0; letra<largo; letra++){
    for (int desplaza = 18; desplaza>=5; desplaza--) {
      for (int i=0; i<5; i++){ 
        lc.setRow(0,gnd[i+desplaza-5],frase[letra][i]); 
      }
    delay(100); // speed of animation
    lc.clearDisplay(0);
    } 
    if(letra == largo){
    letra = 0;}
  }//end for letra  

}

Thank you very much!!!

I have attached code I modified for someone. It was designed for 4x MAX7219's (32x8 LED matrix) but should/might work for you without modification.

ScrollTest4MAX2.ino (15.1 KB)

Riva:
I have attached code I modified for someone. It was designed for 4x MAX7219's (32x8 LED matrix) but should/might work for you without modification.

Thank you very much for your help, I'll take a look of it tomorrow. However, i think that is something missing in my code and I will get it with a small modification.

Riva:
I have attached code I modified for someone. It was designed for 4x MAX7219's (32x8 LED matrix) but should/might work for you without modification.

It worked perfectly for me as well, thank you.

It looks to me like you are not inserting the next letter before the first one is completed off the display? You are also clearing the display in the loop - should this be outside the loop?

I don't use the ledControl library as I have my own (see the Parola link below or the MD_MAX72XX library in the repository). These have examples of what you want to do using my library - it may be useful.

I took the liberty of tweaking the code to remove magic numbers and reverse the direction for my LED matrix (and translate to English, sorry)

In short, the reason you see only one letter at a time is that is precisely the way it is written. Each letter is 5 columns wide, and the scrolling calls for a leading and trailing bunch of columns, totalling 18 columns.

One quick approach to a fix is drop the leading and trailing blanks, have one leading 7 column blank, and then OR the columns of letters as the next character comes on. I haven't done that yet, but I wanted to post the de-magic-numbering. Here goes...

//We always have to include the library
#include "LedControl.h"

//pin 12 is connected to the DataIn 
//pin 11 is connected to the CLK 
//pin 10 is connected to LOAD 

//LedControl(int dataPin, int clkPin, int csPin, int numDevices);
LedControl lc=LedControl(12,11,10,1);

void setup() {
  //The MAX72XX is in power-saving mode on startup, we have to do a wakeup call   
  lc.shutdown(0,false);
  //Set the brightness to a medium values (0~15 possible values)
  lc.setIntensity(0,2);
  //and clear the display
  lc.clearDisplay(0);
}
#define CHAR_WIDTH 5
#define SP {0, 0, 0, 0, 0}               //Space
#define EX {0, 125, 0, 0, 0}             //Exclamation !
#define EX2 {0, 125, 0, 125, 0}             //Exclamation !
#define A {31, 36, 68, 36, 31}
#define B {127, 73, 73, 73, 54,}
#define C {62, 65, 65, 65, 34}
#define D {127, 65, 65, 34, 28}
#define E {127, 73, 73, 65, 65}
#define F {127, 72, 72, 72, 64}
#define G {62, 65, 65, 69, 38}
#define H {127, 8, 8, 8, 127}
#define I {0, 65, 127, 65, 0}
#define J {2, 1, 1, 1, 126}
#define K {127, 8, 20, 34, 65}
#define L {127, 1, 1, 1, 1}
#define M {127, 32, 16, 32, 127}
#define N {127, 32, 16, 8, 127}
#define O {62, 65, 65, 65, 62}
#define P {127, 72, 72, 72, 48}
#define Q {62, 65, 69, 66, 61}
#define R {127, 72, 76, 74, 49}
#define S {50, 73, 73, 73, 38}
#define T {64, 64, 127, 64, 64}
#define U {126, 1, 1, 1, 126}
#define V {124, 2, 1, 2, 124}
#define W {126, 1, 6, 1, 126}
#define X {99, 20, 8, 20, 99}
#define Y {96, 16, 15, 16, 96}
#define Z {67, 69, 73, 81, 97}

#define BLOCK_WIDTH 15
// Write the sentence with commas separating each letter
// In the first issue we will adapt the length of the sentence (characters)
byte phrase[4][CHAR_WIDTH]={B,O,O,EX2};
int len = sizeof(phrase)/CHAR_WIDTH;
//int gnd[18]={-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10,11,12};
int gnd[BLOCK_WIDTH]={10,9,8,7,6,5,4,3,2,1,0,-1,-2,-3,-4};

void loop() { 

  for (int letter=0; letter<len; letter++){
    for (int moves = BLOCK_WIDTH; moves>=CHAR_WIDTH; moves--) {
      for (int i=0; i<CHAR_WIDTH; i++){ 
        lc.setRow(0,gnd[i+moves-CHAR_WIDTH],phrase[letter][i]); 
      }
      delay(100); // speed of animation
      lc.clearDisplay(0);
    } 
    if(letter == len){
      letter = 0;
    }
  }//end for letter  

}

Try using 'Max78xxPanel' library this has a sketch called 'Ticker' which is a scrolling display controlling up to 8 (eight) 'Max7219' 8x8 displays, this one worked for me.

Riva:
I have attached code I modified for someone. It was designed for 4x MAX7219's (32x8 LED matrix) but should/might work for you without modification.

Riva, thanks for that code, it works great, but I would like to modify it so that the display is rotated 90 degrees so that I can daisy-chain several of these max-driven modules:

side-by-side without a gap. Can you help me get started on this?

Can you shoot a short video of the displays connected together and scrolling using my code so I can see how it all scrolls between one matrix and the next. I assume your matrix is not wired up in the same manner mine was and will need the font data rotating. The advantage of this other way of wiring the matrix together is font scrolling should become a lot easier.
Might also be worth checking out Marco's code here as I think it may be written for your type of matrix.

Riva:
Can you shoot a short video of the displays connected together and scrolling using my code so I can see how it all scrolls between one matrix and the next. I assume your matrix is not wired up in the same manner mine was and will need the font data rotating. The advantage of this other way of wiring the matrix together is font scrolling should become a lot easier.
Might also be worth checking out Marco's code here as I think it may be written for your type of matrix.

Riva, thanks for the reply. I don't have the displays put together yet, I'm just working with one for now. I'll get back to you when I get them chained together.

Hi Danigom, Tronixstuff,

i was uploading the sketch to Arduino Nano, its working perfectly up to 4 display (32x8), but when i put additional 4 display (total : 64x8), the last 4 display were not working, even i change 'const int numDevices = 8;', any advice?.Thank you

Hello, I know this is a very old post but I am hoping you can still help me out!

I do not see the attachment for 4X MAX7219 (I am assuming this is 4 matrices that you combine to make a text)?

Also, that is the purpose of gnd on the code?

Thank you very much.

W4hyu:
i was uploading the sketch to Arduino Nano, its working perfectly up to 4 display (32x8), but when i put additional 4 display (total : 64x8), the last 4 display were not working, even i change 'const int numDevices = 8;', any advice?.Thank you

Missed this as with the last forum update all alerts for old posts never got ported. If your referring to my code in #1 then it was only written for 4 panels.

delreer:
I do not see the attachment for 4X MAX7219 (I am assuming this is 4 matrices that you combine to make a text)?

Also, that is the purpose of gnd on the code?

My code is attached to reply #1

I mean how to update the scroll text, because the variable scrollText is on PROGMEM.

Hi,

I'm pretty new to Arduino as well (not so new to programming), I have been playing around with scrolling text and have written a sketch that works pretty well for me.

Inside the loop() you just call the LED display function, e.g. ledText("Your text here"), as many times as you want, each time it will scroll the text on the display.

I only have a single LED matrix so I haven't tried linking them together, I expect you could do it if you just modify the last loop that actually sends the data to the LEDs, and maybe add some more blank columns at the start and end.

I only made this to see if I could so no guarantee it will fit your purpose but maybe you can use some of it.

My plan is to try hooking up some sensors and using it to display the output

Let me know how you get on and if you have any questions!

Thanks,
Kris.

P.S. I tried to embed the code but it is too big, so attached instead!
P.P.S. Man, this is an old original post... just noticed that... anyway I will leave the code in case someone can use it!

LED_Scrolling_Text_v3.ino (9.09 KB)

Hi,

thank you @KrisAndrews I want to use your code to build a clock. I add numbers and colon. Someone other can also use it.
For example 0:

{B01111100,B10100010,B10010010,B10001010,B01111100},

The scrolling is also working. Thanks
LED_Scrolling_Text_v4.ino (10,0 KB)