Go Down

Topic: 8x32 Matrix Control With MAX7219 (Read 7286 times) previous topic - next topic

snowvictim2

Hello!

Can anyone give me a link to a good, up-to-date tutorial on using a 8x32 (4 8x8 modules) LED matrix with a single MAX7219 module? I've done a few animations on my 8x8 LED matrix using LedControl, but it doesn't work for the 8x32 matrix. Everything regarding the 8x32 matrix is in a state of absolute disarray and disorganisation, and I couldn't find any tutorial that actually helped me.

Thanks!

CrossRoads

Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

snowvictim2

Parola doesn't work either. It requires the MAX7219 library (which, as I understand, is no longer made, replaced by the LedControl library?). I've downloaded Parola and tried running example sketches. It kept on looking for the 7219 library, which is unavailable.
Any other ideas?

CrossRoads

Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

snowvictim2

Parola doesn't work for me. It gives a bunch of errors in the console about 'typedef' being ignored in this declaration. I was hoping someone would help me with the "dot" method I was using. I have this DMD animation that I made for my mini pinball backbox. It basically does a little Extra Ball animation.

Quote
#include <LedControl.h>

int DIN = 12;
int CS =  11;
int CLK = 10;

LedControl lc=LedControl(DIN,CLK,CS,4);

void setup(){
 lc.shutdown(0,false);       //The MAX72XX is in power-saving mode on startup
 lc.setIntensity(0,2);      // Set the brightness to maximum value
 lc.clearDisplay(0);         // and clear the display
}

void loop(){
  lc.setRow(0,0,B00000000);
  lc.setRow(0,1,B00011000);
  lc.setRow(0,2,B00001100);
  lc.setRow(0,3,B01111110);
  lc.setRow(0,4,B01111110);
  lc.setRow(0,5,B00001100);
  lc.setRow(0,6,B00011000);
  lc.setRow(0,7,B00000000);
  delay(50);
  lc.setRow(0,0,B00000000);
  lc.setRow(0,1,B00001100);
  lc.setRow(0,2,B00000110);
  lc.setRow(0,3,B00111111);
  lc.setRow(0,4,B00111111);
  lc.setRow(0,5,B00000110);
  lc.setRow(0,6,B00001100);
  lc.setRow(0,7,B00000000);
  delay(50);
  lc.setRow(0,0,B00000000);
  lc.setRow(0,1,B00000110);
  lc.setRow(0,2,B00000011);
  lc.setRow(0,3,B00011111);
  lc.setRow(0,4,B00011111);
  lc.setRow(0,5,B00000011);
  lc.setRow(0,6,B00000110);
  lc.setRow(0,7,B00000000);
  delay(50);
  lc.setRow(0,0,B00000000);
  lc.setRow(0,1,B00000110);
  lc.setRow(0,2,B00000011);
  lc.setRow(0,3,B00011111);
  lc.setRow(0,4,B00011111);
  lc.setRow(0,5,B00000011);
  lc.setRow(0,6,B00000110);
  lc.setRow(0,7,B00000000);
  delay(50);
  lc.setRow(0,0,B00000000);
  lc.setRow(0,1,B00000011);
  lc.setRow(0,2,B00000001);
  lc.setRow(0,3,B00001111);
  lc.setRow(0,4,B00001111);
  lc.setRow(0,5,B00000001);
  lc.setRow(0,6,B00000011);
  lc.setRow(0,7,B00000000);
  delay(50);
  lc.setRow(0,0,B00000000);
  lc.setRow(0,1,B00000001);
  lc.setRow(0,2,B00000000);
  lc.setRow(0,3,B00000111);
  lc.setRow(0,4,B00000111);
  lc.setRow(0,5,B00000000);
  lc.setRow(0,6,B00000001);
  lc.setRow(0,7,B00000000);
  delay(50);
  lc.setRow(0,0,B00000000);
  lc.setRow(0,1,B00000000);
  lc.setRow(0,2,B00000000);
  lc.setRow(0,3,B00000011);
  lc.setRow(0,4,B00000011);
  lc.setRow(0,5,B00000000);
  lc.setRow(0,6,B00000000);
  lc.setRow(0,7,B00000000);
  delay(50);
  lc.setRow(0,0,B00000000);
  lc.setRow(0,1,B00000000);
  lc.setRow(0,2,B00000000);
  lc.setRow(0,3,B00000001);
  lc.setRow(0,4,B00000001);
  lc.setRow(0,5,B00000000);
  lc.setRow(0,6,B00000000);
  lc.setRow(0,7,B00000000);
  delay(50);
  lc.setRow(0,0,B00000000);
  lc.setRow(0,1,B00000000);
  lc.setRow(0,2,B00000000);
  lc.setRow(0,3,B00000000);
  lc.setRow(0,4,B00000000);
  lc.setRow(0,5,B00000000);
  lc.setRow(0,6,B00000000);
  lc.setRow(0,7,B00000000);
  delay(50);
  lc.setRow(0,0,B00000000);
  lc.setRow(0,1,B00000000);
  lc.setRow(0,2,B00000000);
  lc.setRow(0,3,B10000000);
  lc.setRow(0,4,B10000000);
  lc.setRow(0,5,B00000000);
  lc.setRow(0,6,B00000000);
  lc.setRow(0,7,B00000000);
  delay(50);
  lc.setRow(0,0,B00000000);
  lc.setRow(0,1,B00000000);
  lc.setRow(0,2,B10000000);
  lc.setRow(0,3,B11000000);
  lc.setRow(0,4,B11000000);
  lc.setRow(0,5,B10000000);
  lc.setRow(0,6,B00000000);
  lc.setRow(0,7,B00000000);
  delay(50);
  lc.setRow(0,0,B00000000);
  lc.setRow(0,1,B10000000);
  lc.setRow(0,2,B11000000);
  lc.setRow(0,3,B11100000);
  lc.setRow(0,4,B11100000);
  lc.setRow(0,5,B11000000);
  lc.setRow(0,6,B10000000);
  lc.setRow(0,7,B00000000);
  delay(50);
  lc.setRow(0,0,B00000000);
  lc.setRow(0,1,B11000000);
  lc.setRow(0,2,B01100000);
  lc.setRow(0,3,B11110000);
  lc.setRow(0,4,B11110000);
  lc.setRow(0,5,B01100000);
  lc.setRow(0,6,B11000000);
  lc.setRow(0,7,B00000000);
  delay(50);
  lc.setRow(0,0,B00000000);
  lc.setRow(0,1,B01100000);
  lc.setRow(0,2,B00110000);
  lc.setRow(0,3,B11111000);
  lc.setRow(0,4,B11111000);
  lc.setRow(0,5,B00110000);
  lc.setRow(0,6,B01100000);
  lc.setRow(0,7,B00000000);
  delay(50);
  lc.setRow(0,0,B00000000);
  lc.setRow(0,1,B00110000);
  lc.setRow(0,2,B00011000);
  lc.setRow(0,3,B11111100);
  lc.setRow(0,4,B11111100);
  lc.setRow(0,5,B00011000);
  lc.setRow(0,6,B00110000);
  lc.setRow(0,7,B00000000);
  delay(50);
  lc.setRow(0,0,B00000000);
  lc.setRow(0,1,B00011000);
  lc.setRow(0,2,B00001100);
  lc.setRow(0,3,B01111110);
  lc.setRow(0,4,B01111110);
  lc.setRow(0,5,B00001100);
  lc.setRow(0,6,B00011000);
  lc.setRow(0,7,B00000000);
  delay(100);
  lc.setRow(0,0,B01111110);
  lc.setRow(0,1,B01111110);
  lc.setRow(0,2,B01100000);
  lc.setRow(0,3,B01111100);
  lc.setRow(0,4,B01111100);
  lc.setRow(0,5,B01100000);
  lc.setRow(0,6,B01111110);
  lc.setRow(0,7,B01111110);
  delay(300);
  lc.setRow(0,0,B01100110);
  lc.setRow(0,1,B01100110);
  lc.setRow(0,2,B00111100);
  lc.setRow(0,3,B00011000);
  lc.setRow(0,4,B00011000);
  lc.setRow(0,5,B00111100);
  lc.setRow(0,6,B01100110);
  lc.setRow(0,7,B01100110);
  delay(300);
  lc.setRow(0,0,B01111110);
  lc.setRow(0,1,B01111110);
  lc.setRow(0,2,B00011000);
  lc.setRow(0,3,B00011000);
  lc.setRow(0,4,B00011000);
  lc.setRow(0,5,B00011000);
  lc.setRow(0,6,B00011000);
  lc.setRow(0,7,B00011000);
  delay(500);
  lc.setRow(0,0,B01111100);
  lc.setRow(0,1,B01111110);
  lc.setRow(0,2,B01100110);
  lc.setRow(0,3,B01100110);
  lc.setRow(0,4,B01111100);
  lc.setRow(0,5,B01111100);
  lc.setRow(0,6,B01100110);
  lc.setRow(0,7,B01100110);
  delay(300);
  lc.setRow(0,0,B00111100);
  lc.setRow(0,1,B01111110);
  lc.setRow(0,2,B01100110);
  lc.setRow(0,3,B01100110);
  lc.setRow(0,4,B01111110);
  lc.setRow(0,5,B01111110);
  lc.setRow(0,6,B01100110);
  lc.setRow(0,7,B01100110);
  delay(500);
  lc.setRow(0,0,B01111100);
  lc.setRow(0,1,B01111110);
  lc.setRow(0,2,B01100110);
  lc.setRow(0,3,B01111100);
  lc.setRow(0,4,B01111100);
  lc.setRow(0,5,B01100110);
  lc.setRow(0,6,B01111110);
  lc.setRow(0,7,B01111100);
  delay(300);
  lc.setRow(0,0,B00111100);
  lc.setRow(0,1,B01111110);
  lc.setRow(0,2,B01100110);
  lc.setRow(0,3,B01100110);
  lc.setRow(0,4,B01111110);
  lc.setRow(0,5,B01111110);
  lc.setRow(0,6,B01100110);
  lc.setRow(0,7,B01100110);
  delay(300);
  lc.setRow(0,0,B01100000);
  lc.setRow(0,1,B01100000);
  lc.setRow(0,2,B01100000);
  lc.setRow(0,3,B01100000);
  lc.setRow(0,4,B01100000);
  lc.setRow(0,5,B01100000);
  lc.setRow(0,6,B01111110);
  lc.setRow(0,7,B01111110);
  delay(200);
  lc.clearDisplay(0);
  delay(100);
  lc.setRow(0,0,B01100000);
  lc.setRow(0,1,B01100000);
  lc.setRow(0,2,B01100000);
  lc.setRow(0,3,B01100000);
  lc.setRow(0,4,B01100000);
  lc.setRow(0,5,B01100000);
  lc.setRow(0,6,B01111110);
  lc.setRow(0,7,B01111110);
  delay(300);
  lc.setRow(0,0,B00111100);
  lc.setRow(0,1,B01111110);
  lc.setRow(0,2,B11111111);
  lc.setRow(0,3,B11111111);
  lc.setRow(0,4,B10111101);
  lc.setRow(0,5,B10011001);
  lc.setRow(0,6,B01100110);
  lc.setRow(0,7,B00111100);
  delay(1000);
}

void printByte(byte character [])
{
  int i = 0;
  for(i=0;i<8;i++)
  {
    lc.setRow(0,i,character);
  }
}
I've played around it in so many ways and I can't get access to the other three LED matrix displays. The only thing that even made a difference was changing the specified number of displays from 4 to 2, which resulted in the first and third displays working (albeit upside down).
Any ideas?

marco_c

#5
Apr 27, 2017, 06:43 am Last Edit: Apr 27, 2017, 06:45 am by marco_c
Quote
It gives a bunch of errors in the console about 'typedef' being ignored in this declaration
Just for the record these are warning messages and do not stop the executable from being created.

Quote
using a 8x32 (4 8x8 modules) LED matrix with a single MAX7219 module?
This makes no sense. Each matrix needs its own 7219 IC. So if you have 4 modules you will have 4 7219 ICs.
Arduino Libraries https://github.com/MajicDesigns?tab=Repositories
Parola for Arduino https://github.com/MajicDesigns/Parola
Arduino++ blog https://arduinoplusplus.wordpress.com

snowvictim

#6
Apr 27, 2017, 12:54 pm Last Edit: Apr 27, 2017, 01:01 pm by snowvictim
Yes, correction (sorry, I don't know what I was on yesterday haha). Each matrix does have it's own MAX7219, but I can't seem to access the LEDs on the next matrix in the code. When I set the number of MAXs to 4, it allows me to control the first matrix no problem. I think the problem is the wiring.

Just so I understand this correctly, the 5V and ground only have to be attached to the first MAX7219, yes? I thought this was the case as just running the 5V and ground to the first one does light up all the other LEDs. The DIN works "in series", yes? So that means that only each CLK and CS port need to be fed back to the Arduino?

I guess what I don't understand is, how, if I define 4 MAXs for the LedControl, do I access them later? If I do lc1.setRow(1,0,B10000000); that should set the first row on the second matrix to shine the first light from the left, no? Running this code:

Code: [Select]

#include <LedControl.h>

int DIN = 12;
int CS =  11;
int CLK = 10;

LedControl lc1=LedControl(DIN,CLK,CS,4);
//LedControl lc2=LedControl(DIN,8,7,0); ????

void setup(){
 lc1.shutdown(0,false);       //The MAX72XX is in power-saving mode on startup
 lc1.setIntensity(0,2);      // Set the brightness to maximum value
 lc1.clearDisplay(0);         // and clear the display
     // and clear the display
}

void loop(){
  delay(500);
  lc1.setRow(0,1,B10101010);
  lc1.setRow(1,1,B10000000);
}

void printByte(byte character [])
{
  int i = 0;
  for(i=0;i<8;i++)
  {
    lc1.setRow(0,i,character);
  }
}



kills all the lights, but the moment I remove this:

Code: [Select]

  lc1.setRow(1,1,B10000000);


line from it, the first matrix works again. I'm very confused by this.

marco_c

You need to post a link to a photo of your matrix. are they 4 individual matrices or a PCB with 4 units already connected?
Arduino Libraries https://github.com/MajicDesigns?tab=Repositories
Parola for Arduino https://github.com/MajicDesigns/Parola
Arduino++ blog https://arduinoplusplus.wordpress.com

snowvictim

https://www.amazon.co.uk/gp/product/B01IROOH8G/ref=oh_aui_detailpage_o01_s01?ie=UTF8&psc=1

This one. It's basically 4 1088AS matrices each with a 7219. I think it's the wiring that's wrong. I'm really confused by the instructions. For example, one person said "VCC, GND, CLK and CS are common to all". I have no idea what he means by this in terms of wiring.

marco_c

You only need to connect the wires to the DIN side. The links between the matrices are built into the PCB.
Arduino Libraries https://github.com/MajicDesigns?tab=Repositories
Parola for Arduino https://github.com/MajicDesigns/Parola
Arduino++ blog https://arduinoplusplus.wordpress.com

snowvictim

Ok, so say I have the device (4 MAXs and 4 matrices) connected to my Arduino. VCC connected to 5V, GND connected to the ground pin, DIN at pin 12, CS at pin 11, and CLK at pin 10. Would you be kind enough to provide a code that would display one thing on the first matrix, but something else on the other?

snowvictim

I finally got it to work. Thanks!

marco_c

#12
Apr 27, 2017, 09:53 pm Last Edit: Apr 27, 2017, 09:53 pm by marco_c
There are a ton of examples that all work in the MD_Parola and MD_MAX72xx library. :)

Glad it works. Good luck.
Arduino Libraries https://github.com/MajicDesigns?tab=Repositories
Parola for Arduino https://github.com/MajicDesigns/Parola
Arduino++ blog https://arduinoplusplus.wordpress.com

tkbyd

2/19: I've just been playing with MAX7219-managed 8x8 LED matrices (4 and 8 module units), using LEDControl.h.

Sourcecode downloadable. Limited "tutorial" to go with it...

http://sheepdogguides.com/arduino/aht3matrixLED7219.htm

As presented, it produces scrolling text. Don't be alarmed if the letters are "the wrong way up"... that happens because different mfgs wire the LEDs differently. It is easily... if tediously... fixed by transforming the character definition matrices.

The software would also do if you only need static text.

marco_c

Quote
It is easily... if tediously... fixed by transforming
Avoid the tedium and use a library that allows you to tell it which way the matrix is wired, like MD_MAX72xx
Arduino Libraries https://github.com/MajicDesigns?tab=Repositories
Parola for Arduino https://github.com/MajicDesigns/Parola
Arduino++ blog https://arduinoplusplus.wordpress.com

Go Up