MAX7219 LED Matrix Module Micro Word Clock

WordClockA Word Clock is a clock that tells the time using words.

In an era when super-accurate digital clocks are available to most people on the planet, it intrigues me that Word Clocks have a place as they only show the time to the nearest five minutes!

Building one has been on my project to-do list for a while, but I didn’t want to invest the time and money needed for the various ‘from scratch’ build projects that I found online.

My inspiration for this project comes from the Adafruit website, where an 8×8 neopixel matrix is used to create a colorful Word Clock. It seemed to me that I could build a mini version using 8×8 monochrome LED matrix run by a MAX7219 IC. The challenge I set myself was making it as small as I could.

The Word Matrix

The word matrix is the main ‘display’ for a word clock and is the starting point for the design, as everything else fits around that. Fortunately the hard work of creating the word matrix for an 8×8 format was done by Adafruit for their project. As you would expect, having a limited number of LEDs means there need to be compromises compared to the larger word clocks, with some words split up.

WordClock Word PlanIn this implementation, the mask is in 3 sections – the top 3 lines for minutes, line 4 for past/to text, and the last 4 lines for the hour. A plan for how the words are built up is shown on the right (click to enlarge). Alternatives for some words  are highlighted in green.

Each letter of the mask is aligned over one of the LEDs of the matrix. I created an appropriately sized WordClock Text Mask using Microsoft Word. The idea was to print the mask on paper and cover the LED matrix. Testing confirmed this would work, with the LEDs able to shine through the paper. As a bonus, the paper also acted as a very satisfactory light diffuser.

System Hardware

Once I was sure that the concept was valid, it was time to consider the system architecture.

WordClock System
System Block Diagram

To simplify the sketch I  use my MD_MAX72XX library to run the LED module, connected through an SPI interface to an Arduino Pro Mini.

WordClock LED Module
Word Clock components

The real time clock is either a DS3231 or DS1307 (I have my own libraries for these) module using the I²C interface. As a word clock has a 12 hour clock cycle, only a few functions of the RTC are used – we don’t care about AM/PM, date or week day. All we use are hours, minutes and seconds. Any RTC that can provide this can be substituted with appropriate changes in the software.

Finally, a momentarily-on switch is used for setting and displaying the time, and the project is powered through a USB socket.

The hardware was prototyped using available existing modules and an Arduino Uno, shown below.

WordClock Prototype
Word Clock prototype

Software

The software for this project is available from my library site. Essentially it does  3 things:

  1. Periodically update the display.
  2. Display the time as digits when the mode switch is pressed.
  3. Manage time setup when the mode switch is double pressed.

Display Update. With a time resolution of 5 minutes, this is not a critical activity and it is done every 5 seconds by counting elapsed milliseconds. In displaying the time a few of things needed to be considered:

  • In order to keep things flexible, each word is mapped in a data table, used to turn on the correct LEDs in the matrix. Changing what is displayed is a matter of changing the data table rather than any code.
  • To get to the nearest 5 minutes, each five minute interval encompasses 2 minutes before and 2 minutes after the actual 5 minute mark (eg, 5 past the hour is 3 past until 7 past).
  • Once we are beyond the half hour, the hour needs to be incremented for a word clock (ie, 1:35 is twenty five to two).

WordClock Digits

Actual Time. It is sometimes useful to know the real time! Pressing the mode switch once displays the time in digits on the LEDs, two digits for the hours followed by 2 digits for the minutes. The digits are a small number font defined in the code, where each digit is 3 LEDs wide and 7 high, with one blank column. At 4 columns total width, two digits can be displayed across the 8 columns of the LED matrix.

Time Setup. The time needs to be set up somehow. This is  accomplished by double pressing the mode button. At first the hours are displayed as 2 digits and single presses (or auto repeat, as I am using the MD_KeySwitch library) of the mode button will increment the hour with wraparound. Once the hours are set a double press moves to editing the minutes in a similar manner. Another double press completes the editing and returns to the word display. A 10 second inactivity timeout prevents the display from remaining in edit mode indefinitely.

The Clock Case

I wanted the unit to sit on a desk and look like a small old-style computer monitor, so I built a small case to suit. To keep the unit as small as possible, the case was proportioned around the size of the LED matrix.

WordClock Case
Case Components

The case is made from three parts – the main body, a removable back, and a transparent screen. The body is a simple mitered construction using 6mm plywood. To reinforce the mitered joints and add some interest, splines in a darker thin veneer were set into the edges. The back is constructed similarly and is screwed in from underneath.

The front ‘screen’ is a small square of perspex (acrylic) cut to fit the front opening. The size of the window is slightly larger than the LED matrix and the border was sprayed black after masking off the central area.

The inside of the case is painted black to minimize any stray light in the closed box. The outside is finished in a citrus based woodworking oil (smells great!).

Putting it all together

WordClock Mask on Matrix
Mask on Matrix

The first step was to attach the word mask to the LED matrix using thin double sided tape on the flaps and folding them over the side of the matrix, as in the picture on the left.

This was then hot-glue tacked to the acrylic window, which was then placed inside the case and hot glued to it from the inside. With this case design it was easy to align the window flush with the front by placing it face down on a flat surface and pressing it out from the inside. The matrix circuit board was then reattached to the LED matrix, being mindful of orientation.

WordClock_Inside
Inside the Word Clock

The USB connector and the switch were added to the back panel and wired in. Hot glue was again used to lock the USB socket in place and reinforce the wire connections on the back.

All wires were then soldered to the Pro Mini and it was hot glued to the base of the back. The LED SPI connection was then plugged in and the entire unit tested before finally closing the case.

WordClock FB
The Finished Product
Advertisements

2 thoughts on “MAX7219 LED Matrix Module Micro Word Clock

  1. The link in codeplex that point here is wrong because it has a day 24 instead of 28.

    Well done, you have also a setup time that I found missing in many clocks projects.

    Like

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s