Arduino WordClock

Home at last and after testing I can add more characters to the font10x7[] definitions and then alter the 0x7f bound in loadBufferLong to display them. I'm not using the wordclock to display though (one is 400 miles away and the other my wife won't allow me to play with any more) but am using a Rainbowduino with the same core code as used in the clock, just the rendering routine is different.
I knocked up an extended (0x20-0xff) double width font based on the Windows Terminal font while at work but it's now 12x8 instead of 10x7 so will need a few more changes to get it working + not all the extended characters are correctly defined. I also had the original (pre double width) 6x8 version but unwittingly messed it up when doing a final search/replace to make it arduino compatible. I will do it again when I go back to work next week.
I used a free GLCD font creator from here to import and convert the terminal font and then knocked up a quick VB6 program to change the font program output from hex to binary and rotate the data through 90 degrees, another VB6 program I had already was then used to double the width.

Well, in that case I must be doing something wrong or missing something!

I've extended the loadBufferLong to support ascii codes until 255:

void loadBufferLong(int ascii){
    if (ascii >= 0x20 && ascii <= 0xff) {
   ...

and then, I've just added some test character to the end of the font10x7 definition. So, that additional character is now after 0x7f, so it is on the 0x80 position (at least I think so).

If I explicitly call that character for example in the code below, i don't see anything different in the new scrolling text...
The first position of the array that should hold the new character 0x80, just don't display anything. It is just like a space...

void doTemperature(){
    chrBuffer[0] = 0x80;
    chrBuffer[1] = ' ';
    chrBuffer[2] = 'I';
    chrBuffer[3] = 't';
    chrBuffer[4] = 's';
    chrBuffer[5] = ' ';
    chrBuffer[6] = 0x0;

Thank you for the link for the GLCD font creator. I didn't knew it and I am going to try it out. From my quick review, It appears that it only exports to an hexadecimal format, that need a good amount of work to make it usable in this project.

Some time ago I came across The LED Matrix Studio here, but didn't did anything with it yet.

I really appreciate your help, support and time.
Best regards

Riva,

Great work on the clock!
I'm midway through building one with a 6x16 array (6 rows high, 16 columns (two max7219 driving 6x8 each)).
I've got all the basics going great, thanks for the code.

However, the scrolling message doesn't scroll from right to left across both arrays - it runs on both arrays independently (with a slight delay).

I have the MAX7219s cascaded (DOUT to DIN) with parallel load and clk

I can't find why it is doing this. Could it be something to do with my matrix being 6x8 rather than 8x8?
I've tried other code that's supposed to scroll correctly (Text Scrolling with Dot Matrix 8x8 and MAX7219 - #2 by Riva - LEDs and Multiplexing - Arduino Forum and others) but all have the same effect.

Any help is appreciated.
Code attached.

Turns out I had the Max7219 in the wrong order. Riva pointed out in another post that the first Max7219 should be on the right side of the display (I had it on the left...). Swapped over wiring and all fixed!

Clock_v6006_mod.ino (51.4 KB)

pippin88:
Turns out I had the Max7219 in the wrong order. Riva pointed out in another post that the first Max7219 should be on the right side of the display (I had it on the left...). Swapped over wiring and all fixed!

Glad you got it sorted. Had I seen this post earlier I would have asked the chip order but you managed to find the problem okay.

Riva,
Wondering if you can help me with scrolling font?

My matrix is 6x16 (6 rows, 16 columns).
Now that I have the Max7219s in the correct order, your code works great, however the bottom two rows don't exist, so of course the font is cut off at the bottom.

Can you point me in the right direction for modifying the code to work with my size matrix?

EDIT: Looks like SetScanLimit might be what I need, will have a fiddle.

Thanks heaps,
Nick

pippin88:
My matrix is 6x16 (6 rows, 16 columns).
Now that I have the Max7219s in the correct order, your code works great, however the bottom two rows don't exist, so of course the font is cut off at the bottom.
You will have to re-design the font as it's currently 7 rows high.

Can you point me in the right direction for modifying the code to work with my size matrix?
Every character would need to be reduced in height.
From this...

    B00111111, B00000000,	//A

B11000000, B11000000,
    B11000000, B11000000,
    B11000000, B11000000,
    B11111111, B11000000,
    B11000000, B11000000,
    B11000000, B11000000,
    12,



to something like this...


B00111111, B00000000, //A
    B11000000, B11000000,
    B11000000, B11000000,
    B11111111, B11000000,
    B11000000, B11000000,
    B11000000, B11000000,
    B00000000, B00000000,
    12,



You would also need to do the same to the 6x7 number font. You could also adjust the code to take account of the smaller font but it's easier if you just reduce the height and leave the padding at the bottom to maintain 7 rows of font data and one kerning value.
EDIT: Looks like SetScanLimit might be what I need, will have a fiddle.
Scan limit will not help here as the font is physically to large to fit in 6 rows.

Riva,

Thanks, working on that now. I arrived at the same conclusion regarding using padding at bottom (rather than modifying the row iteration code).

Many thanks for your help.
Can I buy you a beer via donation or something?

pippin88:
Can I buy you a beer via donation or something?

Just exhibit your finished clock for all to see, as it differs from this design it may be of more use to somone.

Once again many thanks to Riva for his code and his help.
After many hours fiddling and learning a bit of C++ I've come up with my own branch of his code.

Features:
Uses push buttons rather than a rotary encoder

  • set button if pressed briefly displays date and temp. If held for >2 seconds enter setup.
  • once in setup use up & down buttons to change value, and hit set to enter that value
  • brightness button to change LED brightness in steps
    Added explanation prompts to setup (time entry)
  • now display 'Hour' before entering hours, then 'Min' before entering minutes etc. Easier than remembering order!
    (quite happy with this one, mainly because I worked out how to implement it logically and did so quite quickly rather than headbutting a wall for hours as with my other changes!)
    Font adjusted for 6 row high matrix
  • needs a little more work
  • an odd numbered matrix is better for font display (e.g. showing a 5 on an even number row display means the sizing is not equal to other characters)
    Adjusted clock display to suit my requirements.

I currently have 5 buttons (set, up, down, mode, brightness). I'm thinking I can minimise that to 3 but using 'mode' and 'brightness' as 'up' and 'down' once in setup

Clock_v6006_mod_19.ino (46.5 KB)

Hi pippin88,
Glad your managing to adapt the hardware/code to your needs.

The first word clock I built (code attached) used 3 buttons but I did not like them sticking out so opted for a rotary encoder hidden behind the back panel instead. It's spindle length is set so pressing the back panel will trigger the encoder button. I have only had to adjust the time about twice in the last 18 months so taking the back off to do so is no real problem. I was considering implementing a wireless connection so I could update/adjust over bluetooth or using a radio clock module . I cannot get GPS time in the house so that was not an option.

The time adjust code should/does light a character to denote what your adjusting but the prompt you have is a good idea.
You have prompt strings defined in PROGMEM but choose to built them in RAM one char at a time Is this an oversight or orphan code?

I'm looking forward to some pictures/video when you finished/happy with your clock.

Clock_v5013.ino (47 KB)

Riva,

I'd planned to implement the prompt strings in PROGMEM up the top, but late last night found it easier to just implement a character at a time at that point in code. I've now done so (was easier than I thought, but hey - you don't have to understand code to copy it and fiddle it in to working!)

I plan to have my buttons recessed into the side. I've built up a few toys (CNC router, laser) that I'll be using in the build. I plan to make the clock body with light baffles etc all from one piece of wood, with an acrylic (perspex) from and back cover.

Attached is new revision which uses messages defined up top of program (easy to change) for the prompts in time setup.

I should note I haven't actually changed the daylight saving stuff (dates etc) just changed the naming to DST (terminology with use in Australia)

Clock_v6006_mod_20.ino (45.1 KB)

pippin88:
I'd planned to implement the prompt strings in PROGMEM up the top, but late last night found it easier to just implement a character at a time at that point in code. I've now done so (was easier than I thought, but hey - you don't have to understand code to copy it and fiddle it in to working!).
The code I wrote may not be the best as this was the first project I had done using C++ but I could get the idea of what to do by looking at others code. Also I used a program that converts VB to C++ to see how to implement some of the conditional stuff

I plan to have my buttons recessed into the side. I've built up a few toys (CNC router, laser) that I'll be using in the build. I plan to make the clock body with light baffles etc all from one piece of wood, with an acrylic (perspex) from and back cover.
CNC router & laser. I wish I had the time/money & space for such items.

I should note I haven't actually changed the daylight saving stuff (dates etc) just changed the naming to DST (terminology with use in Australia)
BST is the Brit terminology but most people here would probably understand DST.

Hi,
I am also planning to make a word clock, but I was wondering if it is possible to control a 10x11 display + 4 separate leds for the display of the minutes. I noticed that the max7219 controller only supports 8x8 displays. So there is no problem when making a 8x16 display, but when using a 10x11 display, I have to use parts of the second controller to control the bottom lines. Is this possible?

Each MAX7219 can control 64 LED's with 8x8 display being the most common layout but you could arrange the LED's in any pattern you want as long as they are wired on the 8x8 matrix style needed by the MAX7219 chip. Where it would become more complicated is determining what LED is what when they are set out in a non 8x8 pattern. For a simple word clock this would be relatively easy as the LED's go on/off in set patterns but if you want to include scrolling text then it will become really complex.

Thanks for the answer.
Maybe I 'll try to reorder my text so I am able to use a different size matrix. Is there anyone who used a dutch layout?

From a PM sent to me...

wien23:
hi riva,
im sorry if my english to bad.
im try that code do you add in the forum, but error if i try to comply.
please help me, im Indonesian, and im wan to tray like you.

thank's a lot..

Your English is a lot better than my Indonesian. :slight_smile:

I do not know why you cannot compile the code. I just downloaded the sketch and libraries from this post and the code compiled fine using IDE version 1.0.6 (here).
Have you installed the libraries in the right place?
Have you selected the correct Arduino in the IDE? I wrote the code for the UNO and don't know if it will work properly on other types of Arduino.

Please direct any other messages to the original thread.

I had exact the same problem: I was using version 1.6.6. Using 1.0.6 fixed the problem.

Hi Eva,
i'm very happy you reply my message. I am happy and thanks to you about problems had been solved compiled.
but i have a new problem cause i use arduino uno, how about the schematic, and the pins are to be used? if any change about the code?

please help me, :slight_smile: :slight_smile:

wien23:
Hi Eva,
i'm very happy you reply my message. I am happy and thanks to you about problems had been solved compiled.
but i have a new problem cause i use arduino uno, how about the schematic, and the pins are to be used? is any change about the code?

If your using the UNO then the only pins you need worry about from the schematic are the ones on the right side of IC3.
Schematic pin 23 (PC0) connects to A0 on UNO
Schematic pin 27 (PC4) connects to A4 on UNO
Schematic pin 28 (PC5) connects to A5 on UNO
Schematic pin 2 (PD0) is not needed/connected as the UNO uses this for USB serial
Schematic pin 3 (PD1) is not needed/connected as the UNO uses this for USB serial
Schematic pin 11 (PD5) connects to D5 on UNO
Schematic pin 12 (PD6) connects to D6 on UNO
Schematic pin 13 (PD7) connects to D7 on UNO
Schematic pin 16 (PB2) connects to D10 on UNO
Schematic pin 17 (PB3) connects to D11 on UNO
Schematic pin 18 (PB4) connects to D12 on UNO

Hi Riva,
it's hard to me to understang that scematich, cause i'm haven't electro baground, but i wanna make once for a gift..
so yesterday i buy some parts again.
can you help me make the schematic if i use arduino mega or uno (stand alone)
this a material i have :

  1. 7805 Regulator
  2. MAX7219
  3. DS 3231
  4. Switch
  5. LDR
  6. Cristal 16MHz
  7. 22pF, 0.1uF, 0.33uF, 10uF Capacitor
    8.10 K Resistor
  8. 27 K resistor
  9. arduino mega orarduino uno stand alone
    thanks for your help..