Introduction: DS1302 + 1602 LCD Clock

In this project I'm not going to make a clock, I try to experiment DS1302 and 1602 LCD brought recently. I have followed other instructablers but cannot get an expected result, so I tried and tried until it done and publish my project here to share with all.

In my project I have only changed some wiring and software to make it work, so I will concern on the changes.

Step 1: LCD and RTC Wiring Change

This is not much breakthrough in fact any wiring could be worked, but I've found one wire in question caused my LCD no display, so I correct it as follow.

/*LCD Display (1602)
1.VSS to Arduino GND

2.VCC to Arduino 5V

3.VEE to Arduino GND

4.RS to Arduino pin 10

5.R/W to Arduino pin 9

6.E to Arduino pin 8

11.DB4 to Arduino pin 7

12.DB5 to Arduino pin 6

13.DB6 to Arduino pin 5

14.DB7 to Arduino pin 4

15.LED+ to Arduino 5V

16.LED- to Arduino GND*/

/*DS1302 RTC

RST to Arduino 13

DAT to Arduino 12

CLK to Arduino 11*/

Step 2: Software Change

There are nothing wrong in the software found in the web, what my changes are only adopted in my project.

Firstly you have to include the LCD

#include <LiquidCrystal.h>

Secondly amend the RTC and LCD initialization

DS1302 rtc(13,12,11);
LiquidCrystal lcd (10,9,8,7,6,5,4);

Thirdly format the day time string to be printout from LCD

char buf_1[16], buf_2[16];
snprintf(buf_1, sizeof(buf_1), "%s %04d-%02d-%02d", day.c_str(), t.yr, t.mon,, day.c_str());

snprintf(buf_2, sizeof(buf_2), "%02d:%02d:%02d",, t.min, t.sec);

lcd.setCursor(1, 0);

lcd.setCursor(4, 1);


Step 3: Finally You're Done

A clock may simply tells time, but the code inside have other opportunities to trigger some activities, for examples