SparkFun Forums 

Where electronics enthusiasts find answers.

General suggestions or questions about the SparkFun Electronics website
By stevech
#5412
The DS1307 PC board from Spark Fun is interfaced to my Atmel Mega32 via I2C. Works fine. BUT - it loses about 5 seconds a day as compared to NIST's time of day using either NTP in windows to resynch my PC time just before comparing times, and versus a WWV-based "atomic clock" I have.

I was hoping the DS1307 would be as accurate as a wristwatch, since the crystal seems similar. I hope the crystal used in the PCB has the load capacitance required by the DS1307 chip (12 pf as I recall).

Since it runs slow, all I could do is put a capacitor in series (not parallel) with the crystal to increase the freq. slightly. Or try a different crystal. Or maybe it cannot be more accurate. But 5 parts in 86000 (seconds per day) isn't so great.
User avatar
By sparky
#5481
:shock: That's actually really bad. The RTC Module crystals have a load of 12.5pF matched specifically for the DS1307. There shouldn't be any need for parallel loads. 5 seconds though...

Are you power cycling the unit or does it see 5V normally? We've had issues with a few bad coin cells.

-Nathan
By Philba
#5490
5 seconds a day is 57 ppm. what's the crystal spec'd for? some cheap crystals are 60 or 80 ppm. I'm using a ds1302 (spi/trickle charger version of the '07) with a 30 ppm crystal (citizen, cfs206... - $.30 from mouser) and gaining around 45 seconds a month which is in line. In the way you mounted it, is there anything that might capacitively couple to the leads of the crystal?

by the way, the ds1302 is really nice. You can hook up a supercap to it and it will trickle charge it. Auto switch-over on power loss. I find SPI a lot easier to use than I2C, especially if you have to bit bang it.

Phil
User avatar
By sparky
#5507
In an odd twist of fate, it looks like the crystal we used is actually spec'd at 6pF - never trust faxed datasheets... The only saving grace is that the 1302 uses a 6pF crystal. So I'll see about wiring up a module for the DS1302 with our current crystal and then batching the current RTC-I2C module with the correct 12.5pF crystal.

CMR200 is what we need for SMD. +/-20ppm 12.5pF and 6.0pF load.

-Nathan
By itsneil
#9049
Philba wrote:5 seconds a day is 57 ppm. what's the crystal spec'd for? some cheap crystals are 60 or 80 ppm. I'm using a ds1302 (spi/trickle charger version of the '07) with a 30 ppm crystal (citizen, cfs206... - $.30 from mouser) and gaining around 45 seconds a month which is in line. In the way you mounted it, is there anything that might capacitively couple to the leads of the crystal?

by the way, the ds1302 is really nice. You can hook up a supercap to it and it will trickle charge it. Auto switch-over on power loss. I find SPI a lot easier to use than I2C, especially if you have to bit bang it.

Phil
HI,
I have a DS1337 and using a 6pf xtal with 10 ppm. Can anyone tell me the accuracy of this? And please how I would calculate this?

Many thanks
Neil
By Philba
#9078
you can do it yourself.

ppm means parts per million. so your 10 ppm crystal should be between 10 fast and 10 slow after 1M cycles. You can express this as a simple ratio - 10/1M. Then, you calculate the number of seconds in a day and multiply it by the ratio. That's your worst case error in seconds - assuming you've got the right caps, no parasitic capacitance or stray noise being picked up.
By itsneil
#9082
Philba wrote:you can do it yourself.

ppm means parts per million. so your 10 ppm crystal should be between 10 fast and 10 slow after 1M cycles. You can express this as a simple ratio - 10/1M. Then, you calculate the number of seconds in a day and multiply it by the ratio. That's your worst case error in seconds - assuming you've got the right caps, no parasitic capacitance or stray noise being picked up.
Thanks very much for the information :)

Can you tell me if my calculations as correct?
10/1M=0.00001
There are 86400 seconds in a day
so 86400 * 0.00001 = 0.864 seconds a day

so a year would be 0.864 * 365 = 315 seconds a year, this correct?

Neil
By itsneil
#9083
Add to the above:

Im using a 6pf crystal especially for dallas rtc , so no need for capacitors, here is the link
http://www.golledge.com/docs/products/xtl_ld/gdx1.htm

Im using the DS1337 , and have placed the device and xtal at the corner of the board, not close to any signals, so no noise and pickup.

So with the formula above and using the 10ppm, the accuracy of 5.25 minutes a year isnt too bad. Any thought from anyone?

thanks
Neil
By Philba
#9207
I think that spec says to use 6pf caps (though two pieces of wire twisted together will probably be pretty close...).

You are correct on your calcs though 5 mins per year can be annoying since it's cumulative. There are tricks like using a leap day/week/month approach to increase accuracy. Requires keeping track of time adjustments and periods in between.