connect 2 led matrix on Arduino Micro

Hello,

As said in the title, my main goal is to use 2 led matrix (2 X 8x32 MAX7219) with an Arduino Micro to can make a clock with 2 time zones.
I already done this using an Arduino Uno and my program works with it.

But with the Micro i’ve got 2 problems that i don’t understand. (i use official Micro, not a clone)

To can test my wiring, i use the demo program from MD_MAX72XX lilbrary. the “PrintText exemple”

When defining pin as bellow, no problem, with 1 led matrix, it’s work:
#define CLK_PIN SCK
#define DATA_PIN MOSI
#define CS_PIN SS

But when trying to use pin number in the define, it doesn’t work anymore:
#define CLK_PIN 9
#define DATA_PIN 10
#define CS_PIN 8

I cannot figure out why … this should be the same !

2nd:
I’m just not able to find on what pin i should connect my second led matrix. i tried to use all other different pin but no one works.

For exemple, on the Arduino Uno, this is my used pin for all i need (2 led matrix, 2 push button and a DS3231 breakout):
SCL
SDA
13 DISPLAY B CLK
11 DISPLAY B DIN
10 DISPLAY B CS
9 Bouton B
8 DISPLAY A CLK
7 bouton A
6 DISPLAY A DIN
5 DISPLAY A CS

Well, can someone help me for that please ?

Thank’s

(in Attachment i give my program working on Arduino Uno)

Clock.ino (5.3 KB)

adsofts:
When defining pin as bellow, no problem, with 1 led matrix, it's work:
#define CLK_PIN SCK
#define DATA_PIN MOSI
#define CS_PIN SS

But when trying to use pin number in the define, it doesn't work anymore:
#define CLK_PIN 9
#define DATA_PIN 10
#define CS_PIN 8

I cannot figure out why ... this should be the same !

Those are not the same pins. On the Micro, SCK is pin 15, MOSI is pin 16, SS is pin 17 (reference. These pins are only available on the Micro's ICSP header:

If you are going to use the hardware SPI pins, you should use the

MD_MAX72XX(moduleType_t mod, uint8_t csPin, uint8_t numDevices=1);

constructor instead of the other constructor where you define the data and clock pins. That one is for when you are using arbitrary Arduino pins instead of the hardware SPI pins.

I don't have experience with the MAX7219, but from reading the library documentation, my understanding is that you can use multiple of these chips by chaining them together, so you only need to use 3 Arduino pins to control as many as you like 2 + n pins to control n MAX7219:
https://majicdesigns.github.io/MD_MAX72XX/page_connect.html

The modules are connected through a 4-wire serial interface (SPI), and devices are cascaded, with communications passed through the first device in the chain to all others. The Arduino should be connected to the IN side of the first module in the chain.

Hello Pert and thank's for your reply.

Ok for the Pin number. I checked on Google to get pinout for the Micro and it was not the same than you say. But i will try it, you certainly right.

For the constructor i already know that, thank's.

I know that MAX7219 can be chained. But the library not allow to control text on distinct module.
I want to use 2 X 4x32 MAX7219 to can display 2 différents texts on each group of 4 MAX7219...or maybe i didn't understood well how works this library.

adsofts:
I checked on Google to get pinout for the Micro and it was not the same than you say.

Please post a link to the pinout you found so I can see what it shows.

adsofts:
I know that MAX7219 can be chained. But the library not allow to control text on distinct module.
I want to use 2 X 4x32 MAX7219 to can display 2 différents texts on each group of 4 MAX7219...or maybe i didn't understood well how works this library.

The example at File > Examples > MD_MAX72XX > MD_MAX72xx_PrintText_ML shows how to do it. It turns out you need a separate CS pin for each MAX7219, but you can share the clock and data pins between as many MAX7219 as you like.

Hi again,

this is the pinout i found on google :

Ok, i will try this code

thank's a lot for your time

So i tried the MD_MAX72xx_PrintText_ML i works using same pin for CLK and DATA and 2 pins for CS.
I just have a little last problem, on the 2nd display, the first led's line shows only 2 fixed led lighted up (but others lines are OK) ... don't know why, i will search on Google ... in case you have idea .. :slight_smile:
Anyway thank's for your help