Displaying Time using OLED And Real Time Clock Modules

The modules needed for this setup are the following:

  1. Arduino UNO (or any Arduino board)
  2. Real Time Clock (RTC) DS1302 Module
  3. OLED (I use the 0.96 128×64 i2c module

Let’s take a look at this RTC Module’s pinout:

  1. VCC – connects to Arduino’s VCC
  2. GND – connects to Arduino’s GND
  3. CLK – connects to Arduino’s Digital Pin 6
  4. DAT – connects to Arduino’s Digital Pin 7
  5. RST – connects to Arduino’s Digital Pin 8

The OLED’s pinouts are the following. Usually when a module is using i2c, it will have four (4) pins:

  1. GND – connects to Arduino’s GND
  2. VCC – connects to Arduino’s VCC
  3. SCL – connects to Arduino’s A5 pin
  4. SDA – connects to Arduino’s A4 pin

Now we connect some jumper wires to the modules. I used female to male jumper wires. Though you can use any wire colors, I make it a personal standard to use red for VCC (+5V) and black for ground:

For the OLED module:

  1. GND – black female to male jumper wire
  2. VCC – red female to male jumper wire
  3. SCL – yellow female to male jumper wire
  4. SDA – blue female to male jumper wire

For the RTC DS1302 module:

  1. VCC – red female to male jumper wire
  2. GND – black female to male jumper wire
  3. CLK – orange female to male jumper wire
  4. DAT – yellow female to male jumper wire
  5. RST – blue female to male jumper wire

Connect the OLED module’s jumper wires to the Arduino board. Refer to the pinouts stated above.

Connect the RTC module’s jumper wires to the Arduino board, as mentioned above.

Now, the coding part begins. Before writing any code for our setup, download this library (MyRealTimeClock.zip) and add it to the Arduino IDE.
Compile and upload the following code below:

– Explain code here –

After uploading, the time (and other date-related values will be displayed to the OLED module, as seen below:

This is the complete setup, with my Arduino UNO clone:

This is the complete setup using my DIY Arduino on breadboard:

The RTC Module and the 0.96″ 128×64 i2c OLED module are purchased from ConnectedCities. Orders amounting to P500 above are eligible for FREE delivery!

Advertisements

Leave a Reply

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

WordPress.com Logo

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