Pages: 1 ... 3 4 [5] 6   Go Down
Author Topic: Scrolling text on LED matrices using SPI and arduino Mega2560  (Read 8196 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

Taken from the Playground site we are mentioning here...I have it in my posting about the scrolling on matrices.....


"By no means these 2 capacitors can be ommitted (Left out), as it might lead to sporadic or permanent malfunctions. These types of errors are really hard to track down. Both capacitors must be placed as near as possible to the V+ and the Gnd pins of the MAX72XX. "


I need to re place the caps closer.....and not just on Vcc and ground planes.....
Logged

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

Now I'm getting conused again......

this is taken from the playground website:

"If you read the datasheet for the MAX72XX you know that the drivers can be cascaded by simply connecting the signal DOut from one chip to DIn on the next chip. The signals Clk and Load(/CS) have to be connected  in parallel to each MAX72XX. There is no strict limit as to how many drivers can be cascaded that way."

I don't have the Loads connected in parallel...they are set up from ss0-ss3 individually from the arduino I/Os  53, 49, 48 and 47......
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 545
Posts: 27352
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

Move the clear digits to immediately after the SPI.begin();

This chunk of code at the end of setup will leave display test on = all LEDs on:

byte display_test = 0x0F;           // 0x00 = normal, 0x01 = display test mode all on full

Code:
  // dispay test to normal
  digitalWrite (ss0, LOW);
  SPI.transfer (display_test);
  SPI.transfer (0x01);
  digitalWrite (ss0, HIGH);
I would put in a brief delay, and then set this register to 0 to turn it off.
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

is there anyway you could take the code I pasted before and update it with your updates and repost it.....I'm starting to lose track of everything...I'd appreciate it....


Also one thing I need to be certain of.....

imagine you have your 4 matrices  going from left to right with each having the max7219 under them.....

the first max7219 that needs to be interfaced from the arduino is farthest to the right then going from right to left correct? Or is it farthest to the left going to the right.....

I know I'm blowing up these forums...I just want to get this right....

Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 545
Posts: 27352
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

#0 is on the left, #3 is on the right.
I'll see if I can fix the code up.
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: 545
Posts: 27352
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

Try this.

* Integrated__Code_for_Final_Box1.ino (66.34 KB - downloaded 16 times.)
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

Thanks for clearing up the sequence layout.:you have been so helpful.....I'm a junior engineer with a good yr. Arduino time......just wanting this to be right....ill upload in the morning once I do the caps better....need to find some 104's
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 545
Posts: 27352
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

Okay, will be watching.
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

ok heres the latest...

I placed all the caps  some 10 uF polarized electrolytic  and some 0.1 uF (104) ceramic caps   on each of the max7219s  Vcc line....

I uploaded the code you fixed up for me.....

before, the matrices would just stay on fully 3 of 4 that is.....

now.....they do go out...I'm sure its due to the register clear you mentioned....

However,

I open the serial monitor with the USB stil plugged into the mega 2560 and type hello...

theres nothing on the matrices....but when I press enter after typing hello, the LCD resets.....

I made sure the layout sequence of the matrices was correct right...and Ohmed for a good 30 minutes that all the paralleling is measuring continuity....


Is there anyway that we can manipulate the code (without changing any wiring) to just have it scroll a string?   ---> no serial monitor...
Logged

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

Ok check out the forum titled "MAX7219 in daisy chain. How many decop capacitors I need" it should be fairly newly updated, and in there is what I did.....I did end up cascading them and its working for the most part but the scrolling isn't going across one matrix to the next, it just scrolls the same letter on each matrix individually...

and the letters are backwards....I tried to swap the wiring on just one matrix to see what that would do and it made it erattic...

Logged

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

latest....not quite working how I would like, but again..........WIP




I had made this sparkfun shield in the past......I want it to do this....



I found how to do that from here:

http://www.arduino.cc/playground/Main/DirectDriveLEDMatrix


but now messing with the max7219s is tricky...
Logged

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

My bad..I posted the video and not the shield.....the video obviously was before the shield...

theres a pic attached of the shield now...


* IMG_4031[1].JPG (841.26 KB, 3264x2448 - viewed 23 times.)
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 545
Posts: 27352
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

You've obviously got the MAX7219's working.
What you need a grasp of now is using arrays to send them data.
Here's the way I did it.
I have an array, called displayArray.
In this example it is 64 bytes,  displayArray[0] to  displayArray[63]. In my code, I made it 1022, so it can  be stored in EEPROM & saved during a power outage.
There is a pointer that keeps track of where the data will start that will be sent to the MAX7219s, called displayStart.
You load up displayArray by whatever means (preload it in the pre-setup byte array definition for example).
Then you use the displayStart pointer and copy the data to the MAX7219.

So if displayStart = 7, then the data from displayArray[7] would be copied into display0 register1, up to displayArray[14] going into  into display0 register8
next, display1 gets displayArray[15] to displayArray[22]
and so on for display2 and display3.
That data sits there for 100mS, then displayStart gets bumped to 8, and the process starts again.

(NOTE -the names below the diagram should have read display0, display1, display2, display3 - little copy & paste error)


* array_discussion.jpg (45.83 KB, 960x312 - viewed 26 times.)
« Last Edit: November 08, 2012, 11:01:05 am by CrossRoads » 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 remember arrays in C++ class but I'm just not a great programmer..still amateur .....

I've attached my latest and somewhat greatest code.....I'm going to build up a protoboard matrix with my Uno...I'm surprised nobody has tried this with the mega 2560 like me....

* Latest_Box_Working_somewhat.ino (65.36 KB - downloaded 12 times.)
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 545
Posts: 27352
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

"I'm surprised nobody has tried this with the mega 2560 like me"
You're sending data out the SPI port to a MAX7219. Choice of microcontroller doing it makes no difference. Its the understanding of the manipulation of the data that makes it work. Uno, Fio, BT, Promini, Maga1280, Duemilanove, Deicamila, Leonardo, Bobuino, the hardware does not matter.
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.

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