Beginner programer trying to use 8x8 LED matrices

So a bit of backstory. A friend and I are doing a collaborative project. He's doing hardware, connecting an Arduino Nano to a series of 8x8 LED matrices. I am tasked with making the code to display images on these matrices.

I know that a matrix works by sending power into a row and resisting a column to display a lit LED and it does this individually for each row. I have a few byte arrays that have the patterns that I want to display. HOWEVER I've not been able to find a way to display a certain pattern on a certain matrix.

We had a diagram (made by somebody else) and code that we were following, but the code didn't work and there was a lot of unimportant parts that we weren't going to use. If I had one single matrix that wouldnt be too difficult, but we are using multiple ones that work in tandem. The problem im thinking of at the moment is how do I assign each one an array to display a pattern. Again im a beginner and have very little idea what im doing. (I'm an IT major freshman, and really only know Basic Java)

(LED Matrix Editor)
This is the website im using to turn the patterns I want into code, so Im likely to have less errors.


This is the blueprint we're going for, Minus the button and resistors. So its just the Matrices and the Nano.

Im sorry if this post is wordy, I just don't really know what im doing. Thank you for any help.

What drivers are on each of the matrix modules?
Possibly a MAX7219 or similar…

OK, now you need to read up a bit on how to drive them.
Probably SPI, using. a bitmap to illuminate all the ‘pixels’ needed for your message or graphic.
In the case shown, a 14x8x8 bit (112 byte) array to be pumped out at the desired refresh rate.

Are there any good tutorials on youtube that you would recommend? The experience I have is getting input from a user using a keyboard. Nothing that I really have to code in, using modules that are already precoded into java. This concept is way out of my league.

Im not sure what SPI or bitmaps are. Im assuming refresh rate is how fast teach row gets updated to make the graphic?

First you'll need 3-1/2 amps of power to run those. Each 8x8 sucks about 1/4A so you can't push that much power thru a nano or a usb so you must use an external 5v power supply.
This project drives a matrix. You create special characters and just print them instead of bit banging each dot in real time.
You may also want to reconsider stringing all those displays all into one. if you're displaying independent data its easier to address individual groups of 2 or four instead of trying to get a char to land on a specific 8x8. The character fonts are proportional so you just can't count chars and know where on the display the data is going to show.
SPI is how you talk to the display. A bitmap is a piece of graph paper you fill squares in on to draw your special char. Anything you draw in a paint progrsm is a bitmap.

From. the block, it looks like they are already strung together as suggested.
Before you can do anything, you need to figure out what LED driver ‘xxxx’ is on each module.

With that, google is your friend ‘arduino xxxx’ will undoubtedly return hundreds of examples.

@madmark2150 was perhaps too subtle in the suggestion to reconsider "unstringing" them.

a7

So, is each driver going to be unique? (This friend and I don't live super close, so coordinating this might be a bit difficult) or are all drivers the same? If each one is different I assume it will be about sending which array I want it to display, possibly through an "if" statement?

if(matrixDriver == (the actual driver)){
display array[];
}

Each group needs a separate CS line. Then you can create multiple objects, each with a different CS. You can the print to each one however you want.

So I need to look up how to do Chip Selects? And from there I can choose which driver I send the array to?

yes. Each module has a CS line wired to a DO so it can be addressed separately.

//
 // Mega 2560 pinout is correct - worked on first try
 //
 const int MISOLED = 50;  // Needed for 8X8 LED matrix comms
 const int MOSILED = 51;
 const int SCKLED = 52; // builtin LED & SPI clock
 const int CSLED = 53; // 8x8 x4 LED matrix CS line
// define addl CS lines as required 
...

#include <LG_Matrix_Print.h> // LED matrix - test works // 
...
// Create 8x8x4 Matrix LED object 
// Number of 8x8 segments 
// 
const int segments = 4; 
//
 LG_Matrix_Print lmd(segments, CSLED); 
// 
// repeat for each CS line.
...
// inside setup()
//
//
 // 8x8x4 LED matrix is cool, readable display
 //
 lmd.setEnabled(true);
 lmd.setIntensity(MatrixBright);   //0 = low, 15 = high - set via pot or LDR or command
 lmd.clear();
 lmd.stopTicker(); //Stop any old message 

// inside loop()
//
 if (!lmd.updateTicker()) lmd.stopTicker(); //Stop at end
 // 
// send to display 
lmd.ticker(Msg, scrollRateMs);
 // 


And each driver for each matrix will be different? Like a unique identifier?

LG_Matrix_Print lmd1(segments, CSLED1); 
LG_Matrix_Print lmd2(segments, CSLED2); 

So for the first part where you have the constant integers. MISOLED, MOSILED, SCKLED, CSLED. What are those values for? I know you have the comments but im not sure where you got the values (50, 51, 52, & 53) from.

the #include <LG_Matrix_Print.h>
Im assuming this is a function to test if the matrix are in fact working. But beyond that isnt necessary?

const int segments = 4;
Four is the number of matracies in that segment, that makes sense. But the
LG_Matrix_Print lmd(segments, CSLED);
What does this do? Is this displaying the graphic on the LEDs in sequence?

Mega 2560 pinout is correct - worked on first try`

@ssaannttoo is use a Nano, so the SPI build-in pins are not right, and the CS pins must also be ones that actual exist on that board.

a7

The constants define the IO's to drive the devices via MISO/MOSI protocol. These pins are GIVENs, the pins shown are for mega, uno etc is different.

The #include makes it work, the comment was put in during test.

LG_Matrix_Print lmd(segments, CSLED);

This binds the driver to the pins and creates the lmd. object. Each set of devices with its own CS lines needs one of these statements. lmd. lmd1. etc each need unique names.

So instead of having 2560 I should put in a7?
Which pins would I be using from the diagram?

So each lmd should be assigned to each of the sets of matrices. So there will be a total of 6 lmds two 8x8x2 two 8x8 and two 8x8x4? and to 'print' a graphic to a matrix I do
LG_Matrix_Print [lmd name](segments, CSLED);

But how will the matrix know what to display?

// send to display
String Msg = "Hello World!";
//
 lmd.ticker(Msg, scrollRateMs);
// send to display #2
lmd2.ticker(Msg, scrollRateMs);

Read here if you like

13 is SCK
12 is MISO
11 is MOSI

and 10 is usually used as a chip select, CS, and your additional CS can be any output pin you want.

And then yes, you would be referring to them sorta like you wrote, I get what you meant if that's what you meant. :expressionless:

@madmark2150 might drag you one step further into the madness which is programming by using an array of matrix groups… a bit tidier in the long run, but perhaps more of a distraction for now.

Oh, you do mean Nano, not Nano Every? A different boad altogether as similar as it is.

a7

I've set my arrays as byte arrays, with hard coded 0b00000000 values. should I do

byte arrayOne[]{
hard coded values.
};

lmd.ticker(arrayOne[]);

And then that will just display the graphics?

Im not going to be doing much of the wiring, my friend will be doing the soldering and what not. But I still need to understand for the code (based not he digram) where to match the outputs.