Pages: [1] 2   Go Down
Author Topic: 10x led matrix with 7219 for clock  (Read 1733 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi all,

I have started a project to make a large digital clock (12cm height and 30cm wide) with LED matrix displays, 10 in total with the clock having two rows. I want to add a RTC and alarm option to it but before i can get to them I need some help in the best way of driving the displays to get the output I want. I indent to use the code from here.

The layout I want is shown in the attachment, the problem I have is with addressing the right displays with a specific number of the time, the first and last digit are on 1 matrix, so I see no problem here. The middle two digits overlap to the next matrix and here is where I am lost at the moment. The middle matrix need to display the outer row from its neigbours digit, and in the perfect world I would like the dots (smiley to blink.

I have been thinking on making patterns for every minute from 00:00 up to 23:59 but that seems like total overkill. Second option i have is making the basic patterns for digit 1 and 4 and and for digit 2 and 3 separate patterns and re-using the double one. Then I need a conversion table to use what patterns for what time to display.

All together it seems like a lot of overhead and I wonder if there could be some better way in doing this, basicly only needing the patterns for the digits itself and some code to light the right LEDs. Any help is appreciated !

Erwin


* matrix_clock.jpg (46.07 KB, 909x369 - viewed 70 times.)
Logged

Valencia, Spain
Offline Offline
Faraday Member
**
Karma: 150
Posts: 5649
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

If you rotate the matrices 90 degrees clockwise then the problem vanishes. You get 40 rows of 16  pixels and it's easy to draw a digit starting at any row (which is the real problem).

If you can't physically rotate the matrices then do the same thing in software:

Store an imaginary clock display as 80 bytes in RAM (two bytes per row, 40 rows) as if the matrix were rotated. This really simplifies the drawing code. Update your imaginary display in those 80 bytes of RAM.

Now you need a function to shuffle those bits around to match the hardware layout, then copy them to the physical matrix.

Logged

No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

Offline Offline
Sr. Member
****
Karma: 12
Posts: 381
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Or,

Think of the matrix as 40 columns by 16 rows (no rotation). Then, just write a function to display a number at an offset from the left most column (0) to the right most column (39).

So, to display the time, you would have something like:

Code:
void DrawCurrentTime()
{
   // the first parameter is the column to draw in, the second parameter is the character to draw
   DrawNum(0, '8');   // draw the number '8' on the very left
   DrawNum(9, '8');   // draw the number '8' starting in the 9th column
   DrawNum(19, ':');  // draw the ':'
   DrawNum(23, '8');
   DrawNum(32, '8');
}
« Last Edit: November 03, 2013, 02:34:37 pm by arduinodlb » Logged

Do not IM me. I will not respond. Ask questions in the forum.

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

Or just spread the 1,2 and 4,5 digits apart so that real space makes the gap instead of an LED that will not be on.
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.

Sydney, Australia
Offline Offline
Edison Member
*
Karma: 33
Posts: 1284
Big things come in large packages
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Agree with Crossroads. unless you are going to do animations or other graphics type fancy stuff, then you really only need the matrices for digits 1, 2, 3, 4. The ':' between the digits can just be LEDs (two or more), driven directly from the microcontroller.

If you want to use the displays as you have them, you may also want to look at the hardware and code for the Parola displays (see the signature block below). You can define your own character set as the top and bottom half of each digit and then write the data using the offset technique, as stated in a previous post.
« Last Edit: November 03, 2013, 07:08:16 pm by marco_c » Logged

Arduino libraries http://arduinocode.codeplex.com
Parola hardware & library http://parola.codeplex.com

Valencia, Spain
Offline Offline
Faraday Member
**
Karma: 150
Posts: 5649
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Agree with Crossroads. unless you are going to do animations or other graphics type fancy stuff, then you really only need the matrices for digits 1, 2, 3, 4. The ':' between the digits can just be LEDs (two or more), driven directly from the microcontroller.

It won't look as pretty. The extra column of pixels on the digits adds a lot.
Logged

No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

Valencia, Spain
Offline Offline
Faraday Member
**
Karma: 150
Posts: 5649
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Think of the matrix as 40 columns by 16 rows (no rotation). Then, just write a function to display a number at an offset from the left most column (0) to the right most column (39).

Writing code to do that isn't easy.

The whole point of rotating the matrices/data was to make that part of the code easy at the expense of having to transpose the data later on (not too difficult).
Logged

No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

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

Put a bezel in front, enhances viewability, disguises the fact that you don't have 42 columns.
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: 27353
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 agree with the data as columns idea.
Write the fonts as ints, upper byte goes to upper MAX7219, lower byte goes to lower MAX7219.
For example:
Code:
c 01234567
0 01111110
1 11111111
2 11000011
3 11000011
4 11000011
5 11000011
6 11000011
7 01111110
8 01111110
a 11000011
b 11000011
c 11000011
d 11000011
e 11111111
f 01111110
So the int's would be (just the columns above):
Code:
digitArray[] = {
0b0111111001111110,  // 8 ints for #8
0b1100000110000011,
0b1100000110000011,
0b1100000110000011,
0b1100000110000011,
0b1100000110000011,
0b1100000110000011,
0b0111111001111110,
}
« Last Edit: November 03, 2013, 08:05:11 pm 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.

Offline Offline
Sr. Member
****
Karma: 12
Posts: 381
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Think of the matrix as 40 columns by 16 rows (no rotation). Then, just write a function to display a number at an offset from the left most column (0) to the right most column (39).

Writing code to do that isn't easy.


Yes it is.

Quote
The whole point of rotating the matrices/data was to make that part of the code easy at the expense of having to transpose the data later on (not too difficult).

I get that. I'm just providing an alternative. Conceptually, it's easier to think of the panel in the horizontal plane so if it were me, I would do it that way. The code is no harder, just different.
« Last Edit: November 03, 2013, 08:46:59 pm by arduinodlb » Logged

Do not IM me. I will not respond. Ask questions in the forum.

Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for the ideas so far !

Rotating is an good option since I have not build anything, I will take this as a first choice at the moment and search for some good solutions from there. I have only got 2 matrices at the moment, orderd some more but will try to make some code soon for testing the rotated matrix with those two.

Keeping a 'gap' between the matrix is not an option, I want to be able to change the layout later on to display the alarm time when set on a side (90 degrees rotated or so) and then make the digits smaller.
Logged

Valencia, Spain
Offline Offline
Faraday Member
**
Karma: 150
Posts: 5649
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

If you can physically rotate the matrices than it's definitely, 100% the way to go.
Logged

No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 545
Posts: 27353
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 don't see how rotating an 8x8 matrix helps?
If they are common cathode, they really need to be arranged as 8 vertical columns, otherwise you have to mess around a lot in software to rotate things.
If you have an array of 40 ints holding your digits or pattern or whatever, then you only need to send the upper byte to one display and the byte to the display below, and work your way thru 40 bytes across the 5 pairs of MAX7219s.
Want to change a digit? Pull the 8 ints from progmem and put them in the array, then send the array to the MAX7219s.
Is there any chance we are saying the same thing but in different words?
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.

Valencia, Spain
Offline Offline
Faraday Member
**
Karma: 150
Posts: 5649
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I don't see how rotating an 8x8 matrix helps?

It makes the code for drawing the graphics much easier.
Logged

No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

Valencia, Spain
Offline Offline
Faraday Member
**
Karma: 150
Posts: 5649
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Think of the matrix as 40 columns by 16 rows (no rotation). Then, just write a function to display a number at an offset from the left most column (0) to the right most column (39).

Writing code to do that isn't easy.


Yes it is.


No it isn't. Drawing text at an arbitrary horizontal position needs a lot of bit shifting and twiddling. It's basically a monochrome sprite routine.

Logged

No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

Pages: [1] 2   Go Up
Jump to: