Pages: [1] 2   Go Down
Author Topic: 5x5 Font for LED Matrix  (Read 8278 times)
0 Members and 1 Guest are viewing this topic.
Zürich
Offline Offline
Newbie
*
Karma: 0
Posts: 49
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello!

I've made on the basis of the LedControl library a font file to use with a LED Matrix.

Code:
 byte a[8]={0x00,0x7c,0x44,0x44,0x7c,0x44,0x00,0x00};    
  byte b[8]={0x00,0x7c,0x44,0x78,0x44,0x7c,0x00,0x00};  
  byte c[8]={0x00,0x7c,0x40,0x40,0x40,0x7c,0x00,0x00};  
  byte d[8]={0x00,0x78,0x44,0x44,0x44,0x78,0x00,0x00};  
  byte e[8]={0x00,0x7c,0x40,0x78,0x40,0x7c,0x00,0x00};
  byte f[8]={0x00,0x7c,0x40,0x70,0x40,0x40,0x00,0x00};
  byte g[8]={0x00,0x7c,0x40,0x4c,0x44,0x7c,0x00,0x00};
  byte h[8]={0x00,0x44,0x44,0x7c,0x44,0x44,0x00,0x00};
  byte i[8]={0x00,0x7c,0x10,0x10,0x10,0x7c,0x00,0x00};
  byte j[8]={0x00,0x0c,0x04,0x04,0x44,0x7c,0x00,0x00};
  byte k[8]={0x00,0x44,0x48,0x70,0x48,0x44,0x00,0x00};
  byte l[8]={0x00,0x40,0x40,0x40,0x40,0x7c,0x00,0x00};
  byte m[8]={0x00,0x44,0x6c,0x54,0x44,0x44,0x00,0x00};
  byte n[8]={0x00,0x44,0x64,0x54,0x4c,0x44,0x00,0x00};
  byte o[8]={0x00,0x38,0x44,0x44,0x44,0x38,0x00,0x00};  
  byte p[8]={0x00,0x78,0x44,0x78,0x40,0x40,0x00,0x00};              
  byte q[8]={0x00,0x7c,0x44,0x44,0x7c,0x10,0x00,0x00};            
  byte r[8]={0x00,0x78,0x44,0x78,0x44,0x44,0x00,0x00};            
  byte s[8]={0x00,0x7c,0x40,0x7c,0x04,0x7c,0x00,0x00};            
  byte t[8]={0x00,0x7c,0x10,0x10,0x10,0x10,0x00,0x00};              
  byte u[8]={0x00,0x44,0x44,0x44,0x44,0x7c,0x00,0x00};            
  byte v[8]={0x00,0x44,0x44,0x28,0x28,0x10,0x00,0x00};            
  byte w[8]={0x00,0x44,0x44,0x54,0x54,0x28,0x00,0x00};            
  byte x[8]={0x00,0x44,0x28,0x10,0x28,0x44,0x00,0x00};            
  byte y[8]={0x00,0x44,0x44,0x28,0x10,0x10,0x00,0x00};            
  byte z[8]={0x00,0x7c,0x08,0x10,0x20,0x7c,0x00,0x00};            
  
  byte ze[8]={0x00,0x7c,0x4c,0x54,0x64,0x7c,0x00,0x00};            
  byte on[8]={0x00,0x10,0x30,0x10,0x10,0x38,0x00,0x00};            
  byte tw[8]={0x00,0x78,0x04,0x38,0x40,0x7c,0x00,0x00};            
  byte th[8]={0x00,0x7c,0x04,0x38,0x04,0x7c,0x00,0x00};            
  byte fo[8]={0x00,0x40,0x40,0x50,0x7c,0x10,0x00,0x00};            
  byte fi[8]={0x00,0x7c,0x40,0x78,0x04,0x78,0x00,0x00};            
  byte si[8]={0x00,0x7c,0x40,0x7c,0x44,0x7c,0x00,0x00};            
  byte se[8]={0x00,0x7c,0x04,0x08,0x10,0x10,0x00,0x00};            
  byte ei[8]={0x00,0x7c,0x44,0x7c,0x44,0x7c,0x00,0x00};            
  byte ni[8]={0x00,0x7c,0x44,0x7c,0x04,0x7c,0x00,0x00};


you may leave out the 0x00 of the first and the two last rows to save some memory..
to implement see the documentation of the LedControl library or the examples.

Thanks for any comments or suggestions for improvement!

Cheers from Switzerland  smiley-wink

-andreas
Logged

UK
Offline Offline
Sr. Member
****
Karma: 1
Posts: 491
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

A video or picture of it in use would be nice  smiley

Andrew
Logged

Zürich
Offline Offline
Newbie
*
Karma: 0
Posts: 49
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

ok ok smiley-wink I've got a video up on youtube..

Logged

UK
Offline Offline
Sr. Member
****
Karma: 1
Posts: 491
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks. That looks nice and clear and readable actually, quite difficult to do in 5x5.

This sort of thing takes me back to when I was a young lad, colouring in squares of graph paper for user defined graphics on a ZX81... Who'd have thought I'd still be doing it nearly 30 years later?

Andrew
Logged

Zürich
Offline Offline
Newbie
*
Karma: 0
Posts: 49
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

had a ZX81 myself.. I guess it's still around at the attic..

well.. I used Excel to get the values. It's much easier and faster. I am also about to do some other fonts and I will publish them too..

What I need to do is to learn how to scroll the characters in and out of the matrix.. any hints? smiley-wink

Cheers from Switzerland,

-andreas
Logged

UK
Offline Offline
Sr. Member
****
Karma: 1
Posts: 491
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
What I need to do is to learn how to scroll the characters in and out of the matrix.. any hints?
You could take a look at my code for a scrolling message here: http://www.arduino.cc/playground/Main/DirectDriveLEDMatrix or see this thread: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1203747843/21#21

I didn't use any LED driver chips so you'll have to adapt the display() routine that's called by an interrupt to actually light up the matrix.

Andrew
« Last Edit: February 09, 2009, 09:36:14 am by Andrew » Logged

Zürich
Offline Offline
Newbie
*
Karma: 0
Posts: 49
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Andrew,

Thanks a lot for your sample code.. I will have a look later at home.. Maybe I can use it with my MAX7221 Chip..

Cheers,

-andreas
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 13
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Can you post your code that you are using for your YouTube video setup?
Logged

Birmingham, AL
Offline Offline
Jr. Member
**
Karma: 2
Posts: 91
Arduino, disobey me.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for the font!

Does anyone have a 3x5 font for numbers?

With a 3x5 font you can put 2 numbers (the temperature) on an 8x8 matrix without scrolling.

Logged

Connecticut, US
Offline Offline
Edison Member
*
Karma: 2
Posts: 1036
Whatduino
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I was going to say that in a previous life, I was assimilated into the borg (Microsoft).  I developed the 4x6 and 6x8 pixel fonts that you can use in the Command Prompt windows.  (Choose "Raster Fonts" and select 4x6 or 6x8 for the size.)  The 4x6 case would have 3x5 digits since the 4x6 measurement includes the space between columns and rows.

Getting maximum readability out of very few pixels can take a while, especially when you have to make è e é all distinct enough to read.  I didn't convert them to hex or binary digits for C sketches but a script can do that easily enough.

Here are 3x5 digits.

Code:
struct cgr { char c, byte d[5] };
static cgr _digits =
{
'0', { 0x2, 0x5, 0x5, 0x5, 0x2 },
'1', { 0x2, 0x6, 0x2, 0x2, 0x7 },
'2', { 0x6, 0x1, 0x2, 0x4, 0x7 },
'3', { 0x6, 0x1, 0x2, 0x1, 0x6 },
'4', { 0x1, 0x5, 0x7, 0x1, 0x1 },
'5', { 0x7, 0x4, 0x6, 0x1, 0x6 },
'6', { 0x3, 0x4, 0x6, 0x5, 0x2 },
'7', { 0x7, 0x1, 0x2, 0x2, 0x2 },
'8', { 0x2, 0x5, 0x2, 0x5, 0x2 },
'9', { 0x2, 0x5, 0x3, 0x1, 0x6 },
};

I haven't double-checked it, but that seems right.  To fit both digits in an 8x8 space, you would just shift the bits:  (tens << 4 | ones).
« Last Edit: February 10, 2009, 03:01:38 pm by halley » Logged

Birmingham, AL
Offline Offline
Jr. Member
**
Karma: 2
Posts: 91
Arduino, disobey me.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks halley.  I'll see what I can do with that.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 16
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

thx for this .. I just thinking that if i need  to build the font table for character.

unfortunately , It seems impossible to build up the word stock for Chinese characters....It's too huge :-/
« Last Edit: February 24, 2009, 04:32:49 am by sosox » Logged

Connecticut, US
Offline Offline
Edison Member
*
Karma: 2
Posts: 1036
Whatduino
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

For Chinese hanzi, you really need a minimum of about 12x12 per character (plus a gap between them), and more like 16x16 if you can't use per-pixel dimming to enhance the shapes.  These characters are made up of smaller components we call radicals, but the layout and sizes of these radicals are not consistent enough to "construct" a whole hanzi character from its parts.  There are over 100,000 hanzi, but only about 4,000 in daily use.

Japanese use the same characters (though not the most rare ones), but also two phonetic alphabets called hiragana and katakana.  These are visually simpler, and someone posted a page from some datasheet that illustrated an 8x8 font for katakana.  They've used these fonts for all domestic release videogames since the 70s, just spelling everything phonetically instead of with the kanji.

Korean has a semi-phonetic system called hangeul.  Like hanzi, the characters are made up of parts, but I think they're more consistent so you can construct a character from its parts.  They're also simpler shapes, so you can probably fit it in 10x10, and maybe even in 8x8.

I know nothing of Arabic lettering, but Hebrew seems to be fairly straightforward.
« Last Edit: February 24, 2009, 01:19:37 pm by halley » Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 16
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Now I can use the the LED matrix  show the Number and letteres , but I still can not show the moving things that like a letter left  in and  right out.  It shows clouded when moving...may be i need to modify the delay for display

now I have another problem is that I don't know how to use the timer inside the AVR to count for me .. I would like to make a function that with a time variable to set the display duration.
like : void DispChar(ASCII,Color,time)~ now just the time ,it's hard for me to  get  accurately~ i don't know how to use the the time0 and 1 ...  :-?
Logged

Russia, Moscow
Offline Offline
Newbie
*
Karma: 0
Posts: 16
Russian Arduino Community
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

2 b00lean

I bought this LED matrix, but not work with him.) Thanks for your contribution!
Logged

Pages: [1] 2   Go Up
Jump to: