Go Down

Topic: Scrolling message 8X8 LED array - Max7221? (Read 8567 times) previous topic - next topic

danielNC

Jul 23, 2012, 07:43 pm Last Edit: Jul 23, 2012, 08:35 pm by danielNC Reason: 1
Okay, I have built this project ( http://arduino.cc/playground/Main/DirectDriveLEDMatrix ) several times to display characters using direct drive fro the Arduino board.  Although I've tried this several times with my R/G LED array, I simply cannot get it to work properly.  I only receive some very rapid flashing of all the LEDs in various brightness.  With that said, I do believe that it may be drawing too much current for a proper build anyhow....

So, I bought a couple of Max7221 ICs as they seem to be the choice for this type of project, however I cannot locate my original site for building/programming that O bought the 7221 for.....

Would anyone out there be able to point me in the direction of some good instructions where I could create a scrolling message on my Arduino (with or w/o the max7221). One color is fine as I know the pin arrangement of the bi-color 8x8 LED array.  here is a YouTube that makes it look simple.... ( http://www.youtube.com/watch?v=WdwSnZ8dMLw&feature=endscreen )  For  some reason i cannot get this direct drive method to work!

Any help/code/instructions would be helpful.  :)

JoeN

#1
Jul 23, 2012, 09:26 pm Last Edit: Jul 23, 2012, 09:28 pm by JoeN Reason: 1
If no one has posted a better example, I will post something I did with a 7219 (pin compatible with 7221) that scrolls a message later today in about six hours if I can figure out how to post a video to YouTube.
I have only come here seeking knowledge. Things they would not teach me of in college.

CrossRoads

I wrote some code a while back, I will see if I can find it, the message to be scrolled was stored on an array, 8 x 80 or whatever.
During setup, some initial 8 bytes was sent to the MAX7221 via 8 SPI commands in no-decode mode.
Then every 200mS, or whatever scroll speed you wanted, the location pointer into the array would be incremented by 1 and the 8 bytes from there on would be sent to the MAX7221. 200mS later, the pointer would again be moved over 1 and the data sent out again.
If the pointer was at the end, then bytes from the beginning would be used to wrap the message around. (example 97,98,99,0,1,2,3,4).
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

danielNC

I would love to see what you have already done.  Kind of new to the Arduino and learning a lot as I go along.

I have been searching for about a week and cannot find anything else out there.

Can you either post or send to my email....  arduino@alich.com

Cheers, and thank you in advance!
Dan


JoeN

#5
Jul 24, 2012, 04:30 am Last Edit: Sep 23, 2012, 06:24 am by JoeN Reason: 1
OK, here is my text scroller, no schematic but basically it is simple:  Hook up the first MAX7219 to the pins indicated in the software, daisy chain them, despike them, give them a reasonable value resistor, hook them up to the Matrices after you determine the correct matrix pins via their datasheet.  The resistors chosen are 33K.  The scrolling is a little choppy, but readable.  Not really sure why.  Code is attached.

http://www.youtube.com/watch?v=dl7_QG1xJfo


I have only come here seeking knowledge. Things they would not teach me of in college.

danielNC

Very nice, I'll have to play with this.  Not sure on the build, but I'll do some research.

Dan

Riva

Attached is code I used to test scrolling messages on a pair of MAX7219 chips wired as a 16x8 matrix.

CrossRoads

Nice work Riva.

Code: [Select]

const int DIN = 12;            //DataIn pin (18)
const int CLK = 11;            //Clock pin (17)
const int LOAD = 10;           //Load pin (16)


Why not use SPI for these transfers?
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

danielNC

Thank you Riva.  Looks great.  I do some research on how to hook up the array to the chip and see what happens.

I have a 7221 and from what I've been reading, they are very similar in function and seem to be nearly interchangeable.

I think this is the code I was looking for.  Thanks again!

    Crossroads....  SPI?  I guess you just went over this newbies head again.  :)  So much to learn!

Riva


Nice work Riva.

Code: [Select]

const int DIN = 12;            //DataIn pin (18)
const int CLK = 11;            //Clock pin (17)
const int LOAD = 10;           //Load pin (16)


Why not use SPI for these transfers?

The MAX7219 library (based on LedControl libray but butchered to reduce size) was written to allow the defining of the pins and bitbangs so I just left it at that. The project originally ran on an ATMega8 and only had 68 bytes program memory free so probably would not have taken the SPI library. I have since de-soldered the 8 and replaced with a 328 to give more memory to add more functions but did not bother to change it.

JoeN

#11
Sep 23, 2012, 06:22 am Last Edit: Sep 23, 2012, 06:25 am by JoeN Reason: 1
This is a dup of another post because my crap code is on this thread too.

The flaw in the design where there is some jitter in the display is a software problem on my side, not the LED library or hardware.  What this software does is scan each row by advancing the current bit being displayed on the current character in the string until it gets to the end of that character (by length lookup) and then advancing to the next character.  After each row it restores the position and advances the row until it gets to row 8.  At the end of writing the rows, the software restores the position and advances by one bit (column) to achieve the scrolling effect.  It has to know the correct current character to look up the current character length.  Even though the software it restores the start bit position and character in string position it does not restore the current character correctly for length lookup, it uses whatever character was displayed (or partially displayed) last.  This causes the counter not to advance a lot of the time and the jitter.  If you are using my software for scrolling purposes, fix it with this change.  Add the one line indicated.

Code: [Select]
   curcharix = curcharixsave2;
   curcharbit = curcharbitsave2;
 
   // advance the current character bit of current character


to

Code: [Select]
   curcharix = curcharixsave2;
   curcharbit = curcharbitsave2;
 
   curchar = msg[curcharix];
 
   // advance the current character bit of current character


Sorry for anyone that was inconvenienced by this bug.  I actually totally rewrote the part of the code that writes to the MAX7219s and eliminated the LEDLibrary and this bug persisted which led me to the obvious conclusion that my code sucked somewhere.   At least now I know how the MAX7219 works on a register level, though.  The new version can scroll the display so fast it is not readable without a decent delay.

Attached code has been updated.
I have only come here seeking knowledge. Things they would not teach me of in college.

Pedro147

#12
Sep 25, 2012, 03:32 am Last Edit: Sep 25, 2012, 09:02 am by Pedro147 Reason: 1
Hi  JoeN,  

I have been playing around with some Max 7219's and scrolling text code and would like to try out your code posted here.I love the AC / DC lyrics as the message‚ĶAngus would be proud of you   8) Just a questions if I may:

So to scroll text across more than one 8 x 8 matrix just daisy chain the 7219'S with each 7219 connected to it's own matrix

Thanks for sharing this and keep Rockin' brother   8)

Pedro.
http://www.pedroduino.com

JoeN


Hi  JoeN,  

I have been playing around with some Max 7219's and scrolling text code and would like to try out your code posted here.I love the AC / DC lyrics as the message‚ĶAngus would be proud of you   8) Just a questions if I may:

So to scroll text across more than one 8 x 8 matrix just daisy chain the 7219'S with each 7219 connected to it's own matrix

Thanks for sharing this and keep Rockin' brother   8)

Pedro.


So sorry, I never got this question.  I am going to have to use the 'replies' feature more.

Yes, that is exactly what you do.  The 7219's are just shift registers to the microcontroller.  The library is just shifting in data.  Any "extra" data just falls off the "left" end.   I am using 6 displays and 6 7219 driver chips.  Providing more data than displays/7219 driver chips doesn't hurt anything, it is just not efficient.  When you have more than six displays you will have to modify the following line to make it work:

Code: [Select]
for (i=5;i>=0;i--) // Loop through our 8 displays

Note I say 8 displays, it is actually 6, I think I intended it to be 8 in the beginning.

I have only come here seeking knowledge. Things they would not teach me of in college.

Pedro147

Thanks for getting back to me JoeN. Yes I used your code to scroll across two matrices... very nice thanks. I do prefer scrolling code like yours, where you just type in the text you wish to scroll and it is accessed from a font file within the code rather than entering an array into the actual loop for every char (tiresome  8) )

Thanks again and happy soldering / coding Pedro.
http://www.pedroduino.com

Go Up