# 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(&amp;rectangles[i][0]);
```

# OLED TRON Clock

## Downloads

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

### DS1307 Real Time Clock breakout board kit

[DS1307 Real Time Clock breakout board kit](https://www.adafruit.com/product/264)
**[We've upgraded this RTC breakout and made it even easier to use! Now available as a fully assembled board, it has the same components, chip, size, etc but you don't have to put it together. It's also less expensive! Check out...](https://www.adafruit.com/product/3296)**

No Longer Stocked
[Buy Now](https://www.adafruit.com/product/264)
[Related Guides to the Product](https://learn.adafruit.com/products/264/guides)
### Monochrome 0.96" 128x64 OLED Graphic Display - STEMMA QT

[Monochrome 0.96" 128x64 OLED Graphic Display - STEMMA QT](https://www.adafruit.com/product/326)
These displays are small, only about 1" diagonal, but very readable due to the high contrast of an OLED display. This display is made of 128x64 individual white OLED pixels, each one is turned on or off by the controller chip. Because the display makes its own light, no backlight is...

In Stock
[Buy Now](https://www.adafruit.com/product/326)
[Related Guides to the Product](https://learn.adafruit.com/products/326/guides)
### Adafruit METRO 328 Fully Assembled - Arduino IDE compatible

[Adafruit METRO 328 Fully Assembled - Arduino IDE compatible](https://www.adafruit.com/product/50)
We sure love the ATmega328 here at Adafruit, and we use them&nbsp;_a lot_&nbsp;for our own projects. The processor has plenty of GPIO, Analog inputs, hardware UART SPI and I2C, timers and PWM galore - just enough for most simple projects. When we need to go small, we use a <a...></a...>

Out of Stock
[Buy Now](https://www.adafruit.com/product/50)
[Related Guides to the Product](https://learn.adafruit.com/products/50/guides)
### Monochrome 1.3" 128x64 OLED graphic display - STEMMA QT / Qwiic

[Monochrome 1.3" 128x64 OLED graphic display - STEMMA QT / Qwiic](https://www.adafruit.com/product/938)
These displays are small, only about 1.3" diagonal, but very readable due to the high contrast of an OLED display. This display is made of 128x64 individual white OLED pixels, each one is turned on or off by the controller chip. Because the display makes its own light, no backlight is...

In Stock
[Buy Now](https://www.adafruit.com/product/938)
[Related Guides to the Product](https://learn.adafruit.com/products/938/guides)

## Related Guides

- [SSD1306 OLED Displays with Raspberry Pi and BeagleBone Black](https://learn.adafruit.com/ssd1306-oled-displays-with-raspberry-pi-and-beaglebone-black.md)
- [Arduino Lesson 4. Eight LEDs and a Shift Register](https://learn.adafruit.com/adafruit-arduino-lesson-4-eight-leds.md)
- [Making Adabot: Part 2](https://learn.adafruit.com/making-adabot-part-2.md)
- [Arduino Lesson 7. Make an RGB LED Fader](https://learn.adafruit.com/adafruit-arduino-lesson-7-make-an-rgb-led-fader.md)
- [Stepper Motor Turntable](https://learn.adafruit.com/stepper-motor-turntable.md)
- [Adafruit Proto Shield for Arduino](https://learn.adafruit.com/adafruit-proto-shield-arduino.md)
- [Adafruit  PCA9685 16-Channel Servo Driver](https://learn.adafruit.com/16-channel-pwm-servo-driver.md)
- [RePaper eInk Development Board](https://learn.adafruit.com/repaper-eink-development-board.md)
- [Adafruit Ultimate GPS Logger Shield](https://learn.adafruit.com/adafruit-ultimate-gps-logger-shield.md)
- [Collin's Lab: MIDI](https://learn.adafruit.com/collins-lab-midi.md)
- [Adafruit Ultimate GPS](https://learn.adafruit.com/adafruit-ultimate-gps.md)
- [WiFi Controlled Mobile Robot](https://learn.adafruit.com/wifi-controlled-mobile-robot.md)
- [SMS Texting Pet Food Dish](https://learn.adafruit.com/sms-texting-pet-food-dish.md)
- [TTL Serial Camera](https://learn.adafruit.com/ttl-serial-camera.md)
- [Adafruit PN532 RFID/NFC Breakout and Shield](https://learn.adafruit.com/adafruit-pn532-rfid-nfc.md)
