Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Register Log in

ds1307 rtc time changing

Status
Not open for further replies.

raman00084

Full Member level 6
Joined
Nov 29, 2010
Messages
344
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,298
Activity points
3,881
i connected ds 1307 chip to pic micro controller 18f4620 every thing is working fine date and time. i took another stop watch and synchronized the time after 4 to 5 hours i found the time in the pic is 1 second faster finally after 30 hrs i found that the rtc 1307 is running 4 seconds faster compared to stop watch why this happens what is wrong the code is working fine. please guide me.


regards
kalyan
 

horace1

Advanced Member level 5
Joined
Nov 18, 2008
Messages
2,123
Helped
596
Reputation
1,188
Reaction score
573
Trophy points
1,393
Location
Norwich, UK
Activity points
13,071
the crystal must meet the specification, e.g. in terms of load capacitance etc, and the PCB layout as per datasheet is critical otherwise you get problems with accuracy
also temperature can cause drift
 

horace1

Advanced Member level 5
Joined
Nov 18, 2008
Messages
2,123
Helped
596
Reputation
1,188
Reaction score
573
Trophy points
1,393
Location
Norwich, UK
Activity points
13,071
how to avoid this
it could inaccuracies in the crystal, it not being too specification or problems with PCB layout
some RTCs (e.g. Microchip MCP79410) have digital trimming commands to compensate for intrinsic inaccuracies in the clock (in one project where we were getting cases of 15 minutes error in three months we had to calibrate several hundred individual devices in this way)
other (more expensive) devices have temperature compensated internal oscillators, e.g. Maxim DS3231
http://www.maximintegrated.com/en/products/digital/real-time-clocks/DS3231.html

or NXP2129
http://www.nxp.com/products/interface_and_connectivity/real_time_clocks/rtcs_with_temp_compensation/

it all comes down to the requirements of the project and cost
 

hobbyckts

Advanced Member level 1
Joined
Mar 12, 2015
Messages
481
Helped
88
Reputation
176
Reaction score
85
Trophy points
28
Activity points
2,457
even I faced same issue with DS1307
 

horace1

Advanced Member level 5
Joined
Nov 18, 2008
Messages
2,123
Helped
596
Reputation
1,188
Reaction score
573
Trophy points
1,393
Location
Norwich, UK
Activity points
13,071
I don't think the DS1307 has the digital trimming of devices such as Microchip MCP79410
however, you could do a similar thing by determining the error, e.g. 3 seconds/day, and every day read the current time, add or subtract the error and write the time back

if your micro is connected to the internet you could read the internet time at regular intervals and write it to the ds1307

otherwise the only way to really fix the problem is to use a device such as the Maxim DS3231 with a temperature compensated internal ocsillator
 

hobbyckts

Advanced Member level 1
Joined
Mar 12, 2015
Messages
481
Helped
88
Reputation
176
Reaction score
85
Trophy points
28
Activity points
2,457
Yup.. In my office they are doing it with reading the time from the GPS. This RTC is just acts as dummy..
 

andre_teprom

Super Moderator
Staff member
Joined
Nov 7, 2006
Messages
9,181
Helped
1,141
Reputation
2,301
Reaction score
1,116
Trophy points
1,403
Location
Brazil
Activity points
53,328
you could do a similar thing by determining the error, e.g. 3 seconds/day, and every day read the current time, add or subtract the error and write the time back
This is a good approach to turn around, however must take care to determine if there exists some dependency of frequency drift to the weather temperature so that can vary according to the seasons. Another advise is to certify if exists the risk to occur problem due to data return, in the case of time clock be read by different task/threads of the program.
 

Status
Not open for further replies.
Toggle Sidebar

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top