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*/
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
Secondly amend the RTC and LCD initialization
LiquidCrystal lcd (10,9,8,7,6,5,4);
Thirdly format the day time string to be printout from LCD
char buf_1, buf_2;
snprintf(buf_1, sizeof(buf_1), "%s %04d-%02d-%02d", day.c_str(), t.yr, t.mon, t.date, day.c_str());
snprintf(buf_2, sizeof(buf_2), "%02d:%02d:%02d", t.hr, t.min, t.sec);
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