# OLED TRON Clock

## Overview & Parts

http://www.youtube.com/watch?v=ExEXTzzFYUs

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

- [Arduino Uno](http://www.adafruit.com/products/50)
- [Monochrome 128×64 OLED graphic display](http://www.adafruit.com/products/326)
- [DS1307 Real Time Clock breakout board kit](http://www.adafruit.com/products/264)

![](https://cdn-learn.adafruit.com/assets/assets/000/002/264/medium800/lcds___displays_oled_clock_zoom.jpg?1396781113)

The blocks are drawn so that, from outside to inside, each ring represents hours, minutes, and seconds. &nbsp;The time is read with 0 at the top left corner. &nbsp;The current hour and minute are indicated by the empty block in each ring. &nbsp;The current second is drawn as a solid block (this ends up looking like a square moving around the inside ring). &nbsp;In the above picture, the time can be read as&nbsp;8:23 and about 38 seconds.

# OLED TRON Clock

## Code & Wiring

The overall circuit is set up by following the wiring in the [tutorial on the monochrome 128×64 OLED](http://learn.adafruit.com/monochrome-oled-breakouts/wiring-096-128x64-oled-display "Link: http://learn.adafruit.com/monochrome-oled-breakouts/wiring-096-128x64-oled-display") and plugging the RTC breakout board directly into the Arduino as shown in [the DS1307 tutorial](http://learn.adafruit.com/ds1307-real-time-clock-breakout-board-kit).

![](https://cdn-learn.adafruit.com/assets/assets/000/002/266/medium800/lcds___displays_oled_clock_protoboard.jpg?1396781129)

The main sketch file handles reading the current time and drawing the rectangles. &nbsp;A second file contains the coordinates for each rectangle. &nbsp;The rectangles are broken up into three arrays -&nbsp;hour\_rects,&nbsp;minute\_rects, &&nbsp;second\_rects and ordered by the appropriate time value. &nbsp;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. &nbsp;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:

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

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

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

# OLED TRON Clock

## Downloads

[Download the latest code on GitHub](https://github.com/dmalec/OLED-Stylized-Clock)
## Related Guides

- [DS1307 Real Time Clock Breakout Board Kit](https://learn.adafruit.com/ds1307-real-time-clock-breakout-board-kit.md)
- [IR Sensor](https://learn.adafruit.com/ir-sensor.md)
- [4x4 Rotary Encoder MIDI Messenger](https://learn.adafruit.com/4x4-rotary-encoder-midi-messenger.md)
- [Monitor Your Greenhouse with a No-Code Environmental Sensor](https://learn.adafruit.com/monitor-your-greenhouse-with-a-no-code-environmental-sensor.md)
- [MIDI Melody Maker](https://learn.adafruit.com/midi-melody-maker.md)
- [Adafruit CAN Bus BFF](https://learn.adafruit.com/adafruit-can-bus-bff.md)
- [Faderwave Synthesizer](https://learn.adafruit.com/faderwave-synthesizer.md)
- [CircuitPython OLED and Dual Knob Sketcher](https://learn.adafruit.com/circuitpython-oled-knob-sketcher.md)
- [Adafruit BME680](https://learn.adafruit.com/adafruit-bme680-humidity-temperature-barometic-pressure-voc-gas.md)
- [CircuitPython Powered Sip & Puff with ST LPS33HW Pressure Sensor](https://learn.adafruit.com/st-lps33-and-circuitpython-sip-and-puff.md)
- [Stepper Motor Turntable](https://learn.adafruit.com/stepper-motor-turntable.md)
- [Gravity Falls Memory Gun](https://learn.adafruit.com/gravity-falls-memory-gun.md)
- [Pico W HTTP Server with CircuitPython](https://learn.adafruit.com/pico-w-http-server-with-circuitpython.md)
- [Huzzah Weather Display](https://learn.adafruit.com/huzzah-weather-display.md)
- [Using the TRRS Trinkey as an Assistive Technology Device](https://learn.adafruit.com/using-the-trrs-trinkey-as-an-assistive-technology-device.md)
- [How to Build a Testing Jig](https://learn.adafruit.com/how-to-build-a-testing-fixture.md)
