Monday 3 December 2012

More Christmas clocks

Last year we made some clocks for Xmas. This was because of an earlier ill-fated attempt to charlie-plex a load of LEDs (a 9x10 matrix) in order to create a word clock (which failed) and a bingo machine (which later worked, but using shift registers instead of charlie-plexing).

This year, since we've got a cheap audio playing device and having seen Jason's awesome digital led MatrixFaces, we thought that some digital caricatures of friends and family would make great stocking filling gifts. So promptly ordered a load of 8x8 LED matrices and waited until they arrived...


They're supposed to be two-colour (red and green) 3mm matrix blocks but the ones that arrived are massive! They're also single colour, with just 16 pins - one set of 8 pins for the "rows" and one set of 8 pins for the "columns". By driving the appropriate pins high/low you can activate any single LED in the matrix. Drive each of them quickly enough, and using POV (persistance of vision) you create the illusion of many LEDs being lit at the same time.

Which got us thinking back to our (failed) word clock project about a year ago.
Instead of a home-made 9x10 matrix, perhaps there's some way we could squeeze a word clock into an 8x8 matrix and use these ridiculously large (in LED matrix terms) modules to create a ridiculously small (in wall clock terms) erm wall clock...

No matter how we tried to spell out all the words required, we couldn't quite get them all to fit into an 8x8 grid. So what if we put two of these side-by-side?


Well now, a 16x8 LED matrix not only gives us more than enough letters to spell out all the words needed for our word clock, but also solves a little niggling issue we'd previously tried to ignore:

Word clocks with five minute increments are accurate to the last five minute segment. Between five to, and o'clock, say, the clock will always read "it is five minutes to x". Then at the o'clock position, it read "it is x o'clock" until it's five past.

By having a larger matrix (albeit by accident than design) we've got extra lights to add in some extra words. So we've added "nearly" and "just gone". This should make our clock accurate to about two minutes at worst.

  • At 2 minutes to six o'clock, it would read "it is nearly six o'clock".
  • At six o'clock, it would obviously read "it is six o'clock" 
  • At 2 minutes past six, it would read "it is just gone six o'clock"
  • And at 4 minutes past six, it would read "it is nearly five past six"
  • At five past, it reads "it is five past six" 

and so on - each two minute segment before a five/ten/quarter past would have "nearly" at the front, and each two minute segment after a five/ten/quarter past time would have "just gone" added to it. This means that you should be able to work out to within two minutes the actual time on the clock.

It's not millisecond accuracy, but it's a bit better than most word clocks manage!

To make the clock, we're planning a laser-cut face over the LED matrix with the letters as laid out in the spreadsheet above. We may even coat some glass with semi-opaque paint to give a smoked effect, and laser this off. The exact finish has yet to be decided.

Since the two LEDs matrices side-by-side give us a 16x8 grid, we can simply keep track of the current time and convert this into an array of single-byte values, each sent out over a full output port (PORTB for example) on a PIC microcontroller, while pulling the appropriate cathode "column" low to make the corresponding LED(s) light up:


In the above example, we want to light up the words to spell out "it is five minutes past six".
If we highlight the letters required, and at the bottom of every column add up the values of all the "lit" characters, we can see the array of value(s) required to make the LED matrix light up.

No comments:

Post a Comment