Go Down

Topic: Text Scrolling with Dot Matrix 8x8 and MAX7219 (Read 27798 times) previous topic - next topic

danigom

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:

http://youtu.be/hPJ8MQTH2i0

My Sketch is:
Code: [Select]
//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!!!

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.
Don't PM me for help as I will ignore it.

danigom


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.

tronixstuff


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.
A couple of Arduino tutorials at http://tronixstuff.com/tutorials - My Arduino book - http://nostarch.com/arduino. Please don't ask for help via direct message - use the forum!

marco_c

#4
Aug 27, 2013, 01:20 am Last Edit: Mar 06, 2015, 10:32 pm by marco_c
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.
Arduino Libraries https://github.com/MajicDesigns?tab=Repositories
Parola for Arduino https://github.com/MajicDesigns/Parola
Arduino++ blog https://arduinoplusplus.wordpress.com

jwhitfield

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...
Code: [Select]

//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 

}

JQuinn

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.

road_thing

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:

http://www.amazon.com/gp/product/B009U7LAS0/ref=oh_aui_detailpage_o00_s00?ie=UTF8&psc=1

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

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.
Don't PM me for help as I will ignore it.

road_thing

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.

W4hyu

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

delreer

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.

Riva

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.
Don't PM me for help as I will ignore it.

Riva

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
Don't PM me for help as I will ignore it.

QuanNg

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

Go Up