Friday, 28 June 2013

DS1307 RTC IC





A DS1307 is a pretty simple , inexpensive and easy to use real time clock IC. This IC can count date and time accurately. Once the time and date is set, it will continue its counting if the power(backup battery) is there ! The backup battery ( coin cell battery) is there to keep the DS1307 counting operation if the main power supply is cut off.



Have you ever wanted to make yourself a digital clock ? If the answer is yes, then this post is for you !
I will be explaining roughly about how to get started on getting the time, date and day of the week.

The hardware that you need for this are :
- DS 1307 RTC IC x 1
- 32.768kHz Quartz Crystal X 1
- Coin cell CR2032 & the holder
- 10k resistor x 2 
- LCD board x 1
- Arduino x 1



The software required :
- Arduino IDE 

Ok, let's get started.

First of all, connect the DS1307 circuit as below :

Below are the details that I obtained from datasheet of DS1307 :


I make use of 10k pull up resistor at the SDA and SCL pins. This is because the DS1307 communicates through I2C interface,

SDA - arduino pin A4
SCL - arduino pin A5

Next, wire up the LCD according to the schematic below :
       The R3 value normally to be 220 ohm/330 ohm as a current limiting resistor.




I read from my friend, Wai Hung's blog that there is actually a pretty easy to use library for this purpose.
The library is RTClib which you can download it here :


Library download  
RTClib

This library is so much easy to use that a few lines of coding will do the trick !
I uploaded below sketch to my arduino UNO.


Download Code

This code basically just set the time and date according to when the sketch is compiled. It might have some slight delay. Then the set date , time and day of the week will be displayed on a LCD screen. In my case, I am using a 20 x 4 LCD screen. :)

The picture of my clock :
HAHAHA


The main controller circuit ( constructed on prototyping shield) :



I have made a simple DIY DS1307 RTC Module V1.0 for easy interface :

Below is the simple demo on my digital clock :


More to improve soon, probably will add on more features such as timer, alarm and etc.

Thanks for reading and hope you enjoy !


-VK

Google+   




5 comments:

  1. Code page not found! (Error 404)

    ReplyDelete
  2. Hello,
    Great survey, I’m sure you’re getting a great response. For more information visit here:Remote camera control Thank u...

    ReplyDelete
  3. Hiii,
    Wonderful blog! This is very informative site. I am totally pleased by your excellent work. For more information visit here:Inflatable Advertising BalloonsMany thanks for sharing.

    ReplyDelete
  4. Hiii,
    Stone Walls stock images in HD and millions of other royalty-free stock photos, illustrations and vectors in the Shutterstock collection.thanks for the tips and information..i really appreciate it..

    ReplyDelete
  5. Hello Guys,
    Wow! It's very nice comment for these Exterior facades improve the thermal efficiency of the building and reduce thermal bridges to avoid condensation of water vapour, thus act as a shield to the building. Thank u...

    ReplyDelete