Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics 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.

ds1307 rtc time changing

Status
Not open for further replies.

raman00084

Full Member level 6
Joined
Nov 29, 2010
Messages
362
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,298
Activity points
4,006
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
 

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
 

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
**broken link removed**

or NXP2129
https://www.nxp.com/products/interf...real_time_clocks/rtcs_with_temp_compensation/

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

even I faced same issue with DS1307
 

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
 

Yup.. In my office they are doing it with reading the time from the GPS. This RTC is just acts as dummy..
 

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.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top