Arduino clock using an OLED display

See this post here for a Joystick controlled Weather Clock with OLED display.

I have just discovered the amazing OLED display. At just 0.96 inches in size the display is bright, crisp and clear.

Part 2 . of this blog shows how to use the U8gLib library instead of the Adafruit library.

This project uses a DS1307 RTC module to provide the time, a TMP 136 temperature sensor to show local temperature and the results are displayed on a 128×64 pixel display. Time is shown in ‘digital’ and analog format. The date is displayed along with air temperature.

The code for this project can be found on my github page at You will also need the Adafruit OLED library found at This page has a link to the Adafruit GFX library that you will need as well.

All this code leaves very little room on an Arduino Uno but enough for the clock code. Wiring details for the various units are given in the comments in the code. The RTC and OLED are I2C devices and have just four connections, 5volts, ground, SDA and SLC. SDA connects to Analog pin 4 (on a UNO) and SLC connects to Analog pin 5. The TMP136 has three connections, ground, output and Vcc. This code sets the ARef to 3.3 volts and Vcc on the TMP 136 is connected to 3.3 volts as well.

The display is built up in the buffer, then displayed with the command display.display


If the TMP136 is not required then it can be ignored (see the code for details).


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your 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