Digital clock using ds1307 and PIC microcontroller
Digital clock using ds1307 and pic16f877a microcontroller is designed in this project. Digital clock using ds1307 displays time and date on LCD. PIC16F877A microcontroller is used to design digital clock. I2C communication protocol is used to read time and date from digital clock ds1307. PIC16F877A microcontroller is interfaced with LCD to display time and date. Digital clock ds107 use I2C serial communication proctol to send data to microcontroller. pic16f877a microcontroller receives data from ds1307 through I2C serial communication protocol. I will discuss it detail in later part of this article. Before reading this article further, you should know how to interface LCD with PIC16F877A microcontroller. If you don’t know, I recommend you to read following article first.
Digital clock DS1307
DS1307 is an integrated circuit based real time clock. It counts minutes, seconds, hours, date of month, days and years. It also have functionality to include leap year compensation up to 2100. It is binary coded decimal clock (BCD). This clock operates in either in 12 hour or 24 hour format. Indication of Am and Pm can also be included on LCD display through programming. It also have automatic power failure circuit. Automatic power failure circuit detects power failure and switch to 3 volt battery to keep record of time. It have battery back up. Battery back up is used to keep record of time in case of main power failure. It have 56 bytes non-volatile RAM for data storage. DS1307 use two wire serial communication I2C. It consumes very less power and current in the order of 500nA. It can operate in harsh temperature environment in the range of -40ºC to +85°C.
Digital clock DS1307 Pin configuration
It is 8-pin DIP IC. Pin configuration of DS1307 is given below:
Description of each pin is given below:
- SQW/OUT : Square wave and output driver pin
- SCL: Serial clock used for I2C communication
- SDA : Serial data pin for I2C serial communication
- GND: Ground pin of power supply is connected with this pin
- VBAT : It is 3 volt back up battery. It is use in case of main power failure
- X1 and X2 : 32.768 crystal connects with these pins
- Vcc : Main power supply connects with this pin
Digital clok DS1307 interfacing with microcontroller
Now I will discuss how to interface digital clock ds1307 with microcontroller. Basic block diagram of digital clock interfacing with microcontroller is given below:
In I2C serial communication, one device acts as a slave and other device acts as a master. Slave only respond to instructions of master. Slave can not give instructions to master. Digital clock DS1307 acts as a slave and respond to instructions of microcontroller. Built in register in ds1307 is used to respond to instructions of microcontroller. As shown in above circuit diagram, SCL pin of ds1307 is connected to SCL pin of microcontroller. It is used to synchronize serial data on serial wire. SCL stands for serial clock input. SDA stands for serial data input/output. SDA pin of ds1307 is connected with SDA pin of microcontroller. SDA is used as a serial data input or output for 2 wire serial communication. SDA pin of ds1307 is open drain that is why its required external pull up resistor as shown in figure above. Standard 32.876KHz quartz crystal is used with real time clock ds1307.
Circuit diagram of digital clock ds1307 using pic microcontroller
Circuit diagram of digital clock ds1307 using pic mirocontroller is given below. DS1307 real time clock is interfaced with PIC16F877A microcontroller. Instructions for interfacing real time clocl ds130 is given. 3 volt battery is used as back up which is used in case of main power supply faliure.PIC16F877A microcontroller fetch time and date values from DS1307 real time clock. After doing some calculations through programming, PIC16F877A microcontroller displays time and date on LCD.
Code of digital clock DS1307 using pic microcontroller
Code for real time clock using DS1307 and pic microcontroller is written using Mikro C pro compiler. Necessary comments are also made in code for your understanding.
If you need code for digital clock DS1307 using pic microcontroller, comment on this post with your email address. If you feel any issue while designing digital clock project, let me know with your comments.
hi
yes?
Plz send me code
pls send me the material for writing this project
great great work. Thanks for your help. Can you please send me the code
Sir, can u send me the code , Thank you very much.
please
please send me , lethongminh4@gmail.com
thank u for this project
plz send me the code
sorry my email mouradnaili50@gmail.com
Great Work. Send me the code please. jorlij@outlook.com
Hi,
Good work, please send me the code to king2003@ymail.com
hi send me the code mani.electronics11@gmail.com
Sir, can u send me the code ashrafz_0795@yahoo.com tq.
Sir, can u send me the code to me ashrafz_0795@yahoo.com
tq
can you give me code of digital clock DS1307 using PIC microcontroller written using MPLAB ?
Thanks for your generous help
can you please send me the code
adnan.saood2061998@gmail.com
can you please send me the code
tarikulislam1994@gmail.com
I really need the code please michaelmaged69@gmail.com
Please send it here. sirjaard@gmail.com
Please send it here. sharaf_bs@yahoo.com
anurag
please send me code
email id anurag662272@gmail.com
code is given in article
do you have the code file with you?? if you have, then please comment the link to the code. It will help us a lot. thanks.
Dear Bilal please suggest to me for digital display institute, i m in Mumbai.
Pls do you have the one with using 7-segment display, pls send it to my email: joseph4real4u@yahoo.com
icxuseen@gmail.com
I so much appreciate your work, please i need code to ring a bell starting from 0800hrs for 8 seconds and delay for 40 minutes in 8 school periods.
Thanks for your anticipated response.
I really need the code please blknm@yahoo.fr
thanks
Hi,
Your work is really good, this is really what i need to get to grips with the ds1307.
please could you send me the code.
Email:
Mattyb01@hotmail.co.uk
Thank You
S’il vous plait envoyez moi le code et merci 🙂
this is great can you please send the codes this is my email jjames_angayao@yahoo.com
hi Bilal please send me the code for clock ds1307 at ab4rising@gmail.com
please send me the project
thanks!
Please send the full coding and what component that you use 🙂
please send me code on vermashalu29@gmail.com
Please send me the code.
I need it for a project
PROJET my email youcefmohamedkouider10@gmail.com
Hi malik
i want the source code in Mplap program
What is the different b/w Micro c and Molap code.
i’m using mickroC joshuaayomikun@gmail.com
may i? yascun94@gmail.com
can you please send me the code
abdallahygazy@gmail.com
Hi,
please could you send me the code and the ISIS simulation
Email:
ridacharaf90@gmail.com
Thank You
Hi, please could you send me the code and the ISIS simulation. This is my email: garnetpro2000@gmail.com
Thank you.
please…..
ahmedimraj1213@gmail.com
Hi, please could you send me the code and the ISIS simulation. This is my email: ramiboujlida@gmail.com
Thank you.
Please send me a code
shanmuganathan25@gmail.com
Sir, can u send me the code please lahlou.adil1612@gmail.com .
Thank you 😀
i want this code for my project
please send me the code at ( basitcase@gmail.com )
please send me the code a
maliksaad84@gmail.com
Please send me the
umairali9048@gmail.com
Looking nice let me have it, Thanks
Please Send me the code to :
abdelrhmanabdo@hotmail.com
thnx
i greatly appreciate your work. please can i get the code….janieabutu@gmail.com
Please send me codes for clock
ranasinghesameera89@gmail.com
here too fareesfazir@gmail.com
SIR CAN U SENT ME THE DETAILED WORKING OF THIS DIGITAL CLOCK CIRCUIT
plz send the code to my E-mail
thank you
best wish
also I need ISIS simulation.
please share code.. thanks
Dear Sir,
Please share code and Hard ware details. This is my mail id somkaram7@gmail.com
Please send code for digital clock and calendar. My gmail id ayulaa76@gmail.com
Please send me the code rassuncaoguimaraes@gmail.com
plz snd me code….. deepalipawar4615@gmail.com
Please send me the code : mailtocate at gmail.com
Hi can you send me rtc code thanks dunkyoung25@gmail.com
I need the code please,
adinainggolan12@gmail.com
sir i need codes kindly send it to me at kidrees367@gmail.com
Hi,
Please Send me the code
sujinkoovery@gmail.com
please send me the code ravi.bokale@gmail.com
great project ……plz send this code….plz
Sir, can u send me the code please kshgunawardena@gmail.com .
Thank you ????
Nice work I need code for rtc to pic. Plz send me code.
bshivamath@gmail.com
Please send me the Hex Code
email : cellzonkw@hotmail.com
please I need code can you send to me
Hello, I tried using my code but its showing the time and date in the source code area of Proteus but not showing on LCD. Any idea why?
Thanks
sir pleaes send me code adiluddin62@googlemail.com
Pls send me hex file and the code for this
Thank you for assisting Students with your projects. Can you please send me the code along with the hex file… Thank uou
Please send the code asap to Dhammyjj@gmail.com
Pls send it here. Dhammyjj@gmail.com
more power to your elbow,
please send the code to my mail
idrisishola061@gmail.com
please send me the project into my email:shemghiwet@gmail.com
Pls send me hex file and the code for this
mosedb54@gmail.com
i need the cod myalimo2110@gmail.com
code is given in article
pliz, i need the code mario_glur@hotmail.com
please send me a code and hex file thank you
Thanks for your nice discussion.
Would you give me this code. My email: shaddam96@gmail.com
Great Work. Can you end me the code please ?
please send me a code and hex file. thank you!
Nice project. can I use 7segment 4digit display what will be the code and hex file. can you please send me the same
thanks,
Hi, we will try to post an article on the 7-segment display based real-time clock. But right now we do not have any project on this on our website.
But you can check these articles:
http://microcontrollerslab.com/7-segment-display-interfacing-with-pic-microcontroller/
74HC595 Interfacing with 7-segment Display and Pic Microcontroller
http://microcontrollerslab.com/74hc595-interfacing-with-7-segment-display-pic16f877a/
MAX7219 Interfacing with 8-digit 7 Segment Display and PIC16F877A
http://microcontrollerslab.com/max7219-interfacing-8-digit-7-segment-display-pic16f877a/
Thank you. Can you send to me code
Hello.. Can you give me code of digital clock DS1307 using microcontroller written using MPLAB… Thank you
arduino code of digital clock DS1307. Thank you.
You can check Arduino code here:
http://microcontrollerslab.com/real-time-clock-ds1307-interfacing-arduino/
hi can you send me the code for this project i badly need the code for my mplab
Thank you for the work you have done on the digital clock. I am a beginner on uPs and would appreciate if you would send me the code. Thanks and regards
dntoorkey@gmail.com
Hello.. Can you give me code of digital clock DS1307 using microcontroller written using MPLAB… Thank you
Hello, Can you give me HEX code of digital clock DS1307 using microcontroller. Thank you!
HI. Great Work. Send me the code please.
good afternoon, is it possible for you to send me the code?
Thank you for the project. I constructed the clock but find it to be misbehaving as follows:
1) The AM/PM indication is random. Eg. 15:00 hrs shows as 15;00:00 pm instead of 3:00:00 pm.
2) Setting of the clock is problematic. Set key randomly selects from the time/date digits.
3) At 8:00am or pm, the hrs digit resets to 1:00.
4) Does the DS1307 require a +5V supply at pin 8? (Not shown in schematic)
5) The date does not update even after 24 hrs.
Thanks and regards