Pages: 1 2 3 [4] 5 6   Go Down
Author Topic: Scrolling text on LED matrices using SPI and arduino Mega2560  (Read 6272 times)
0 Members and 1 Guest are viewing this topic.
Raleigh, NC.
Offline Offline
Full Member
***
Karma: 0
Posts: 129
Addicted to Arduino
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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...
Logged

Raleigh, NC.
Offline Offline
Full Member
***
Karma: 0
Posts: 129
Addicted to Arduino
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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,....
Logged

Raleigh, NC.
Offline Offline
Full Member
***
Karma: 0
Posts: 129
Addicted to Arduino
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:

* Integrated__Code_for_Final_Box.ino (65.38 KB - downloaded 13 times.)
Logged

Raleigh, NC.
Offline Offline
Full Member
***
Karma: 0
Posts: 129
Addicted to Arduino
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Attached is my schematic and how its wired up....


* Schematic.jpg (161.78 KB, 1600x852 - viewed 21 times.)
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 435
Posts: 23600
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Do me a favor.

make these 2 changes
Code:
 // *******************Initialize the LCD**************//
  
/*  comment out the LCD and all the delays as a test
  
  lcd.begin(40, 2);
  lcd.setCursor(3,0);

Code:
   lcd.setCursor(0, 1);
    
    lcd.print("<-- Down Control        Clock:");

*/   end of commenting out LCD setup code
}
  
  
  void loop ()
  
  {
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 435
Posts: 23600
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Where are the 0.1uF and 1uF (or 10uF) caps on the VCC pin of each device?
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Raleigh, NC.
Offline Offline
Full Member
***
Karma: 0
Posts: 129
Addicted to Arduino
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Raleigh, NC.
Offline Offline
Full Member
***
Karma: 0
Posts: 129
Addicted to Arduino
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.79 KB - downloaded 12 times.)
Logged

Raleigh, NC.
Offline Offline
Full Member
***
Karma: 0
Posts: 129
Addicted to Arduino
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 (1026.75 KB, 3264x2448 - viewed 25 times.)
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 435
Posts: 23600
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
Code:
  // 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)
Code:
  // 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);

Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Raleigh, NC.
Offline Offline
Full Member
***
Karma: 0
Posts: 129
Addicted to Arduino
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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...
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 435
Posts: 23600
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

"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.
Code:
  // 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;
  }
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Raleigh, NC.
Offline Offline
Full Member
***
Karma: 0
Posts: 129
Addicted to Arduino
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.43 KB - downloaded 10 times.)
Logged

Raleigh, NC.
Offline Offline
Full Member
***
Karma: 0
Posts: 129
Addicted to Arduino
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Raleigh, NC.
Offline Offline
Full Member
***
Karma: 0
Posts: 129
Addicted to Arduino
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Pages: 1 2 3 [4] 5 6   Go Up
Jump to: