Led matrix with HT1632C controller (4)

by luca
20 comments

In my previous tutorial, you learned how to display a fixed text, coded and saved in Arduino’s program memory, on your display. Now you’re going to learn how to display dynamic text…

FONT CODING

If you want to compose a text at runtime, you need to code each character, saving them in the program memory.

You can do it manually (“drawing” characters on paper); to speed up the activity I developed a Windows tool, LetterToBinary:

Program’s source code (C#) is available in a GitHub’s repository; you can also download a compiled version here.

With LetterToBinary you can easily get a character’s coding and copy it in Windows clipboard; I used this tool to code all the characters in Ai Pointe font, by Ritchie Ned Hansel:

Font is then saved in a PROGMEM array:

FONT DESCRIPTOR

Arduino needs two more informations to create a text using the font you coded:

  • the length (= number of bytes) of each character
  • the offset, i.e. the position of the array the character starts at

I divided the font from the main sketch saving it in a .h file, which also contains the definition of FONT_INFO struct:

typedef struct {  
  unsigned char length;  
  unsigned int offset;
} FONT_INFO;

and an array with FONT_INFO elements, one for each character:

FONT_INFO aipoint_info[] = {
  {2, 0},	// !
  {5, 2},	// "
  {5, 7},	// #
  {5, 12},	// $
  {5, 17},	// %
  ...

From this array Arduino can learn that – for example – the $ character is 5 bytes long and starts from byte 12 of aipointe_font[] array.

If you observe an ASCII table, you can notice I started coding the font from character ! This character has a decimal value of 33 and its informations are saved in element 0 of aipointe_info[] array: this means that, to know the position each character has in that array, you need to substract 33 from their decimal value.

In the next page, we’re going to use the font just coded in a sketch

Related Posts

20 comments

Locomolo Sunday October 14th, 2012 - 12:45 PM

Hi Luca,

I have a 3208 matrix display likes yours, but when i upload the arduino’s sketch all is working well but the text display is rotated 90 degres. It’ s like the leds panels aren’t wired in the same position.

This is my 3208 led matrix:

http://fw.hardijzer.nl/?p=148

How can i modify your sketch to getting the correct position?

Thanks!

Reply
luca Sunday October 14th, 2012 - 01:12 PM

Hi Luis,

mmm it seems they rotated each matrix 90 degrees? What does it happen if you run the “static text” example (nr 3)? Could you please post a photo?
Thanks

Reply
Locomolo Sunday October 14th, 2012 - 06:59 PM

Hi Luca!

Yes, each matrix is rotated 90 degrees.

http://imageshack.us/photo/my-images/402/20121014194624.jpg/sr=1

Thanks

Reply
luca Tuesday October 16th, 2012 - 04:23 PM

Hi Luis,

mmm I wasn’t able to find any datasheets about your display to know how they connected each matrix to the controller. I’m going to send you a demo sketch via mail to do some tests…

Reply
Locomolo Tuesday October 16th, 2012 - 11:25 PM

Hi Luca, here some info about this led matrix( datasheet…)

http://fw.hardijzer.nl/?p=148.

Thanks a lot, i ‘am ready for testing.

Reply
luca Thursday October 18th, 2012 - 09:09 AM

Hi Luis,

could you try to run my first sketch: http://www.lucadentella.it/2012/10/03/matrice-di-led-con-ht1632c-2/ and write down the sequence leds turn on? So we can understand how leds are mapped to RAM cells… thanks!

Reply
Locomolo Sunday October 21st, 2012 - 01:25 PM

Hi luca, i upgraded my fileshack library with the images, arduino UNO running your first sketch.

The order is, the first dot begins at the rightest matrix, at bottom right, and the last is the upperest left, always in horizontal direction form the right to the left. Similar for the four matrix.

Check it please
http://imageshack.us/photo/my-images/402/20121014194624.jpg/sr=1

Reply
luca Saturday October 27th, 2012 - 09:40 AM

Hi Luis,

I’ve just sent you a demo sketch for your display, let me know how it works

Reply
Toni B. Sunday November 4th, 2012 - 02:45 PM

Thanks vor the great help ! I Try the same Projekt but i try to make 2 led Matrix with 8x 32 Leds with 16.000 mcd each red led. I want go give any Text out of my rear from my Car XD such as the German Police .

Great thanks from Germany !

Reply
luca Sunday November 4th, 2012 - 10:59 PM

Thanks Toni!

Reply
Locomolo Thursday November 15th, 2012 - 09:17 PM

Hi Lucca thanks for your help, finally i found a compatible library in Github, otherwise i keep regarding your project 🙂

Reply
luca Friday November 16th, 2012 - 08:48 AM

Good news, Luis!
Could you please send me the link of your library? I’ll add it in my article…
thanks

Reply
Martin Wednesday September 18th, 2013 - 02:16 PM

Hi Luca,

forgot to tell, yes. I’m using same matrix as Locomolo (mcu 3208 matrix clock, with atmega removed) and chars and scroll direction is rotated 90 degrees.

Searched all over github (and the rest of the internet :)) but can’t find working solution.

Reply
luca Thursday September 19th, 2013 - 12:46 PM

Hi Martin,

hope that Locomolo will send you the link to the library he found on Github because I can’t find it too… 🙁

Reply
xyz Monday March 18th, 2013 - 11:03 PM

Hello,

Currently I am working on Sure Electronics 0832 Display interfacing with PIC16F1937.
I am using SPI interface between PIC16F1937 and Display.

I am facing problem with Scrolling Message across Led display. I made 4*7 character library. Every time i am shifting 4 columns in address for displaying next char. but it overlaps.I am starting with R-L shifting but when it goes beyond 0x00 address ,it overlaps with last addresses(0x3E).

Can you please provide some guidelines for scrolling text. in C?

Reply
luca Thursday March 21st, 2013 - 09:30 AM

Hello! Give a look to my Arduino code (on Github): it’s in C. If you have any questions about it write me a comment!

Reply
Martin Sunday September 15th, 2013 - 12:53 PM

hello,

i’m also having the same problem with mcu matrix but can’t find working code on github.
Could you point me in right direction?

tnx, martin

Reply
luca Tuesday September 17th, 2013 - 09:07 AM

Hi Martin,

do you mean the same problem as Locomolo?

Reply
Doug Thursday February 12th, 2015 - 11:25 AM

Hi Luca,

Has been googling and browsing the internet to no result of getting info about manually trigger character from switches.

Now i found your article which is the closest thing i can find related to my needs and i hope you can give me some light in the darkness.

I just need to output automatic transmission gear position (P R N D 3 2 1 O) to 5×8 led matrix.
The input will be +12v via automatic gear selector/switch (no clock generator or such, just a simple open/close switch).

Could you please help me ?

Thanks in advanced luca.

Reply
luca Friday February 13th, 2015 - 09:29 PM

Hi Doug: how do you “know” which gear is selected? Does a single switch corrispond to a specific gear (I mean, do you have 8 switches for 8 gears)? You could monitor the status of each switch using a digital PIN of Arduino and then, with some if display the correct letter on the led matrix

Reply

Leave a Reply to luca Cancel Reply

19 − 14 =