Layout sounds correct & ss usage agree with the code.
May take some tweaking to make it all play nice.
Usually when they all light up its due to having had bad data sent in, or its in display test mode, or ...
I think setup is coded to have display test turn each one on/off briefly, 50mS or something.
I started with just putting a simple pattern in during setup to confirm that I could send data to each one correctly.
Small steps.
This is rediculous.....I have all 4 matrices wired up now 1 each to each MAX7219..
SCK all in parallel
MOSI all in parallel
SS to each Max7219 (Pinouts assigned)
I'm using 10K resistors for Iset
I would like to email you....I want to include my code in an .ino and see if you could take a minute and browse through it and see if theres anything wrong...
Also, I open the serial monitor and just type hello
it makes everything reset......
IDK
Put the code here as an attachment (pasting in text), can get some other eyes on it too.
How are you powering things? USB port? Any chance it is overloaded?
I emailed you the .ino file
I will have to shrink down the code to try and put it here..it exceeds the 9500 character limit...
To upload, I'm using the USB, but after upload, I have 2 (3.9 V ) lithium batteries = 7.8 V powering it all...
I'll try and shrink it down..
I have a lot of LED commands that would be irrelevant here...
I won't be able to look at that until 8:30pm.
Add it as an attachment here so others might look at it in the meantime.
(Click Additional Options below, browse to your file, and then post)
Ok.....I must've missed that on the datasheet....
I'm going to open up the rats nest (I have it all in an enclosure)
I'm going to replace the R's now...
Ok I have replaced the 10K's with 33 K's I had.....feel much better....the Matrices that would work were very bright......
so I closed it all back up....now the first matrix lights up totally..
the second matrix = Row 2 is only lit up...matrix 3 and 4 = nothing
I'll try and paste my code here....
I may have to shrink it down some....
I'm going to start trying to get the matrices working....
My LCD , LEDs, Buttons all work fine,....
Integrated__Code_for_Final_Box.ino (65.4 KB)
Do me a favor.
make these 2 changes
// *******************Initialize the LCD**************//
/* comment out the LCD and all the delays as a test
lcd.begin(40, 2);
lcd.setCursor(3,0);
lcd.setCursor(0, 1);
lcd.print("<-- Down Control Clock:");
*/ end of commenting out LCD setup code
}
void loop ()
{
Where are the 0.1uF and 1uF (or 10uF) caps on the VCC pin of each device?
Oh yes, I did include a 10 u F and 100 nF on the Vcc line for the first Max7219.....are you saying each chip would need this?
I totally got rid of all the LEDs and LCD commands...I pretty much used your code and just changed ss0-ss3 to the pinouts for the Mega.....
When I open the serial monitor now....the 3rd and 4th matrices blink some but nothing accurate yet....
here is the code I'm using now....
CrossRoads_MyPinOuts.ino (17.8 KB)
Attached is a picture of my project is you're curious.....
Everything works how I would like it to except the matrices.....They are blinking erratically at times...or steady on....etc.
![IMG_4030[1].JPG](https://europe1.discourse-cdn.com/arduino/original/2X/9/9467828d3f761749e5f5d99bb3315be1015bc630.jpg)
Enclosure looks nice! Better than my PCB with Duemilanove cable-tied to it.
Yes, you need caps for each device. 0.1uF keeps high frequency noise, 10uF acts as local current buffer for the large currents being switched on/off.
Looks like you have slightly old code. See if this helps
byte display_test = 0x0D; This needs to be 0x0F,
byte displayArray[192] = { }; // 192 bytes
These need to be written with 0x07:
// scan limit to all 7 columns
digitalWrite (ss0, LOW);
SPI.transfer (scan_limit);
SPI.transfer (0x08);
digitalWrite (ss0, HIGH);
digitalWrite (ss1, LOW);
SPI.transfer (scan_limit);
SPI.transfer (0x08);
digitalWrite (ss1, HIGH);
digitalWrite (ss2, LOW);
SPI.transfer (scan_limit);
SPI.transfer (0x08);
digitalWrite (ss2, HIGH);
digitalWrite (ss3, LOW);
SPI.transfer (scan_limit);
SPI.transfer (0x08);
digitalWrite (ss3, HIGH);
these need to be written with 0x01 for Normal mode (vs shutdown)
// dispay test to normal
digitalWrite (ss0, LOW);
SPI.transfer (display_test);
SPI.transfer (0x00);
digitalWrite (ss0, HIGH);
digitalWrite (ss1, LOW);
SPI.transfer (display_test);
SPI.transfer (0x00);
digitalWrite (ss1, HIGH);
digitalWrite (ss2, LOW);
SPI.transfer (display_test);
SPI.transfer (0x00);
digitalWrite (ss2, HIGH);
digitalWrite (ss3, LOW);
SPI.transfer (display_test);
SPI.transfer (0x00);
digitalWrite (ss3, HIGH);
Why thank you...I made the enclosure with a Vernier Caliper, A dremmel and a file.......took a few days...I bought the 40 x 2 LCD for 2.75 $ and wanted to something with it right....
I then bought a mega and I wanted to have multiple things working on the enclosure....so I made the matrices as well.....
I updating the code now....
I did add the caps....now I can get some type of response from the 3rd and 4th matrix...at least I'm getting there now....
When I power up, its like the first whole matrix is lit, the 2nd row of the 2nd matrix is lit and then all of 3rd and 4th matrices are lit.....
When I open the serial monitor, the LCD resets and goes through the setup again......
getting there.....Arduino is so much fun.....debugging and all...
"Arduino is so much fun.....debugging and all..."
I know what you mean - epsecially doing things like copying addresses wrong from the datasheet - took me two nights to figure that one out!
Or even better - I was saving stuff to EEPROM - totally overlooking the fact that there are only 1023 bytes, while the code happily wrote to 1500 bytes & hosed the data I was putting there. Someone else spotted that for me. Worked great while I was buffering in the 2048 bytes of SRAM even!
The other thing I did was to write 0's to all the digit registers before anything else, right after the pinMode commands, so when they then come out of shutdown mode they don't turn on by themselves.
// clear the MAX7219 digit registers
digitRegister = 0x01; // digit0, up to 0x80 for digit7
for (x = 0; x<8; x=x+1){
digitalWrite (ss0, LOW);
SPI.transfer (digitRegister);
SPI.transfer(0);
digitalWrite (ss0, HIGH);
digitRegister = digitRegister+1;
}
// next digit
digitRegister = 0x01; // digit0, up to 0x80 for digit7
for (x = 0; x<8; x=x+1){
digitalWrite (ss1, LOW);
SPI.transfer (digitRegister);
SPI.transfer (0);
digitalWrite (ss1, HIGH);
digitRegister = digitRegister+1;
}
// next digit
digitRegister = 0x01; // digit0, up to 0x08 for digit7
for (x = 0; x<8; x=x+1){
digitalWrite (ss2, LOW);
SPI.transfer (digitRegister);
SPI.transfer(0);
digitalWrite (ss2, HIGH);
digitRegister = digitRegister+1;
}
// next digit
digitRegister = 0x01; // digit0, up to 0x08 for digit7
for (x = 0; x<8; x=x+1){
digitalWrite (ss3, LOW);
SPI.transfer (digitRegister);
SPI.transfer(0);
digitalWrite (ss3, HIGH);
digitRegister = digitRegister+1;
}
I'm not 100 % sure where you would add this in.....so I took a guess....
attached is my entire code so far....
the schematic and picture is posted...I replaced resistors with 33 K's now instead of 10 K's....
I have an electrolytic 10 uF cap on each device and a .01 u F ceramic cap on each (I was hoping that could work)
disregard the email tonight.....
I'm going to take a video tonight of it working so far.....so you'll have a better image...
attached is the code so far....with a few updates you gave me....
Integrated__Code_for_Final_Box.ino (66.4 KB)
I have recorded a video of what I have so far.....
I was thinking I may need to do a better job with the caps......
I may resolder them in from each Vcc on the max7219s to its ground and not just on a Vcc / Gnd plane......that run parallel ya know on the PCB (Radio shack board)
anyways, heres the video..
I bought 10 more max7219s tonight as well...10 for 4.99 $ can't beat that......
If I can't get this to work, I may just go with the Uno / Duelminove and use an i2c LCD to conserve the I/Os but then redesign the enclosure as well....
anyhows....Still WIP but I'm trying
I noticed and commented in the similar post going on about the coupling caps......It was mentioned to use a 10 uF polarized cap and no less than a 0.1 uF ceramic cap for each device....I'll change up the caps tomorrow because I know I didn't use the correct ceramic caps.....I think I used 0.001 uF
