April 18, 2012 AT 10:21 am

OLED Stylized Clock

While watching Tron for the umpteenth time, I started thinking about how data could be displayed in abstract, but still readable, ways.  The OLED display, with its crispness, seemed like a good fit for what I had in mind.  After considering a few different options, I settled on a building a stylized clock display.

I used the following parts in this project:

OLED Clock Zoomed

The blocks are drawn so that, from outside to inside, each ring represents hours, minutes, and seconds.  The current hour and minute are indicated by the empty block in each ring.  The current second is drawn as a solid block (this ends up looking like a square moving around the inside ring).  In the above picture, the time can be read as 8:23 and about 38 seconds.  The overall circuit is set up by following the wiring in the tutorial on the monochrome 128×64 OLED and plugging the RTC breakout board directly into the Arduino as shown in the DS1307 tutorial.

OLED Clock Protoboard

The main sketch file handles reading the current time and drawing the rectangles.  A second file contains the coordinates for each rectangle.  The rectangles are broken up into three arrays - hour_rects, minute_rects, & second_rects and ordered by the appropriate time value.  The advantage of this approach is that modifying the design of the clock is as easy as adjusting the values in the appropriate array entry.  The biggest downside was the increase in memory usage; I ended up keeping the arrays in program memory by declaring the arrays with the prog_uint8_t type and PROGMEM attribute:

prog_uint8_t hour_rects[12][4] PROGMEM = {
...
};

Also, reading from the arrays required the use of an appropriate function:

pgm_read_byte_near(&rectangles[i][0]);

The full source is available on github - I’d love to see what other designs for clock displays people come up with or if someone extends this to display other types of data.

Related

2 Comments

  1. Very slick!

    I did a similar time display for my DOTKLOK project:
    http://www.flickr.com/photos/aom/5597209280/in/set-72157625965276784

    Each big block represents an entire hour, and each pixel making up the blocks represents 5 minutes, so the design slowly fills up over 12 hours.

  2. Thanks! :)

    Wow, that’s a really nice build! I like the design of the blocks filling up – has a very intuitive feel.

Sorry, the comment form is closed at this time.