Shop OBEX P1 Docs P2 Docs Learn Events
DS1302 RTC Accuracy — Parallax Forums

DS1302 RTC Accuracy

ArchiverArchiver Posts: 46,084
edited 2002-01-04 10:37 in General Discussion
I've built a school-bell alarm system for my old High School. The time
seems to be running a little fast (gains a couple seconds an hour). Any
good ideas on how I can increase the accuracy? I have the crystal as close
as I can wire-wrapping. Should I solder it directly to the X1/X2 leads?

The data sheets call for a 6pf crystal, but I think I am using a 10pf,
standard RTC issue 32.768KHz.

Thanks,
Martin Hebel
.

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2002-01-03 14:48
    Hi Martin,

    How temperature friendly is your environment? You could put a variable
    capacitor across the crystal and use it to "pull" the frequency. You
    could either measure the frequency with a counter or trial and error
    until you aren't losing time. A small trimmer capacitor (10 or 20pf)
    would probably do the trick. This allows you to dynamically compensate
    for circuit capacitance that you can't easily predict without heavy-duty
    modeling. However, trimmers are not known for great temperature
    accuracy.

    Also, crystals themselves are fairly temperature sensitive. In very
    critical circuits they are put in an "oven" that keeps them hot.
    Probably overkill here though.

    I'm not sure if some types of variable capacitors are more temperature
    stable than others? The little trimmers would probably be pretty good. A
    mica compression trimmer might be more or less stable, I really don't
    know.

    Al Williams
    AWC
    * Easy RS-232 Prototyping
    http://www.al-williams.com/awce/rs1.htm

    >
    Original Message
    > From: martin@s... [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=SRkmkdKCnLuyr2P2Qf6002Wv1mNiK6MdiGKG4oxzQqTi__FIS71_z4J0jMrI-yeWVEKeu7d25mFOAQ]martin@s...[/url
    > Sent: Thursday, January 03, 2002 8:34 AM
    > To: basicstamps@yahoogroups.com
    > Subject: [noparse][[/noparse]basicstamps] DS1302 RTC Accuracy
    >
    >
    > I've built a school-bell alarm system for my old High School.
    > The time seems to be running a little fast (gains a couple
    > seconds an hour). Any good ideas on how I can increase the
    > accuracy? I have the crystal as close as I can
    > wire-wrapping. Should I solder it directly to the X1/X2 leads?
    >
    > The data sheets call for a 6pf crystal, but I think I am
    > using a 10pf, standard RTC issue 32.768KHz.
    >
    > Thanks,
    > Martin Hebel
    > .
    >
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    > from the same email address that you subscribed. Text in the
    > Subject and Body of the message will be ignored.
    >
    >
    > Your use of Yahoo! Groups is subject to
    > http://docs.yahoo.com/info/terms/
    >
  • ArchiverArchiver Posts: 46,084
    edited 2002-01-03 15:00
    Thanks Al,
    I'll give it a shot. Hope Radio Shack carries trimmer pots because
    I'm out of time for ordering!
    -Martin


    --- In basicstamps@y..., "Al Williams" <alw@a...> wrote:
    > Hi Martin,
    >
    > How temperature friendly is your environment? You could put a
    variable
    > capacitor across the crystal and use it to "pull" the frequency. You
    > could either measure the frequency with a counter or trial and error
    > until you aren't losing time. A small trimmer capacitor (10 or 20pf)
    > would probably do the trick. This allows you to dynamically
    compensate
    > for circuit capacitance that you can't easily predict without heavy-
    duty
    > modeling. However, trimmers are not known for great temperature
    > accuracy.
    >
    > Also, crystals themselves are fairly temperature sensitive. In very
    > critical circuits they are put in an "oven" that keeps them hot.
    > Probably overkill here though.
    >
    > I'm not sure if some types of variable capacitors are more
    temperature
    > stable than others? The little trimmers would probably be pretty
    good. A
    > mica compression trimmer might be more or less stable, I really
    don't
    > know.
    >
    > Al Williams
    > AWC
    > * Easy RS-232 Prototyping
    > http://www.al-williams.com/awce/rs1.htm
    >
    > >
    Original Message
    > > From: martin@s... [noparse][[/noparse]mailto:martin@s...]
    > > Sent: Thursday, January 03, 2002 8:34 AM
    > > To: basicstamps@y...
    > > Subject: [noparse][[/noparse]basicstamps] DS1302 RTC Accuracy
    > >
    > >
    > > I've built a school-bell alarm system for my old High School.
    > > The time seems to be running a little fast (gains a couple
    > > seconds an hour). Any good ideas on how I can increase the
    > > accuracy? I have the crystal as close as I can
    > > wire-wrapping. Should I solder it directly to the X1/X2 leads?
    > >
    > > The data sheets call for a 6pf crystal, but I think I am
    > > using a 10pf, standard RTC issue 32.768KHz.
    > >
    > > Thanks,
    > > Martin Hebel
    > > .
    > >
    > >
    > > To UNSUBSCRIBE, just send mail to:
    > > basicstamps-unsubscribe@y...
    > > from the same email address that you subscribed. Text in the
    > > Subject and Body of the message will be ignored.
    > >
    > >
    > > Your use of Yahoo! Groups is subject to
    > > http://docs.yahoo.com/info/terms/
    > >
  • ArchiverArchiver Posts: 46,084
    edited 2002-01-03 15:19
    Not pots -- caps. No, I doubt you'll be able to pick them up at RS. They
    might be able to RSU them for you. Might take apart a cheap digital
    clock and see if you could find one :-)

    http://www.radioshack.com/category.asp?catalog%5Fname=CTLG&category%5Fna
    me=CTLG%5F010%5F002%5F025%5F000&Page=1

    If you need just a little pull, you can make your own variable capacitor
    of unknown characteristics. Two wires twisted together are known as a
    "gimmick" capacitor. The insulation of the wire is the dielectric. Two
    pieces of metal tubing and an insulating sleeve will work if you have
    one metal tube big enough to hold the insulating sleeve and the sleeve
    large enough to hold the smaller tube. Adjust it to the right spot and
    glue it together :-)

    Believe it or not, I've either done these things or seen them done first
    hand :-) A quick Web search shows I'm not the only one that remembers
    the gimmick: http://www.shol.com/kuggie/cttip/pix/gimmic.jpg

    This is one of those weird things that someone eventually applied for a
    patent on it even though there were 50 years of prior art. Don't know
    how that turned out :-)

    Al Williams
    AWC
    * Floating point math for the Stamp, PIC, SX, or any microcontroller
    http://www.al-williams.com/awce/pak1.htm



    >
    Original Message
    > From: selmaware [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=Uuc732Tk3pdASlXo4HCafGhswtI7RzvPmvhBcsx-j9INdhyfb5D9AqFMGNuf1i7LCGVLumgQKPiEBg]martin@s...[/url
    > Sent: Thursday, January 03, 2002 9:01 AM
    > To: basicstamps@yahoogroups.com
    > Subject: [noparse][[/noparse]basicstamps] Re: DS1302 RTC Accuracy
    >
    >
    > Thanks Al,
    > I'll give it a shot. Hope Radio Shack carries trimmer pots because
    > I'm out of time for ordering!
    > -Martin
    >
    >
    > --- In basicstamps@y..., "Al Williams" <alw@a...> wrote:
    > > Hi Martin,
    > >
    > > How temperature friendly is your environment? You could put a
    > variable
    > > capacitor across the crystal and use it to "pull" the
    > frequency. You
    > > could either measure the frequency with a counter or trial
    > and error
    > > until you aren't losing time. A small trimmer capacitor (10
    > or 20pf)
    > > would probably do the trick. This allows you to dynamically
    > compensate
    > > for circuit capacitance that you can't easily predict without heavy-
    > duty
    > > modeling. However, trimmers are not known for great temperature
    > > accuracy.
    > >
    > > Also, crystals themselves are fairly temperature sensitive. In very
    > > critical circuits they are put in an "oven" that keeps them hot.
    > > Probably overkill here though.
    > >
    > > I'm not sure if some types of variable capacitors are more
    > temperature
    > > stable than others? The little trimmers would probably be pretty
    > good. A
    > > mica compression trimmer might be more or less stable, I really
    > don't
    > > know.
    > >
    > > Al Williams
    > > AWC
    > > * Easy RS-232 Prototyping http://www.al-williams.com/awce/rs1.htm
    > >
    > > >
    Original Message
    > > > From: martin@s... [noparse][[/noparse]mailto:martin@s...]
    > > > Sent: Thursday, January 03, 2002 8:34 AM
    > > > To: basicstamps@y...
    > > > Subject: [noparse][[/noparse]basicstamps] DS1302 RTC Accuracy
    > > >
    > > >
    > > > I've built a school-bell alarm system for my old High
    > School. The
    > > > time seems to be running a little fast (gains a couple seconds an
    > > > hour). Any good ideas on how I can increase the
    > accuracy? I have
    > > > the crystal as close as I can wire-wrapping. Should I solder it
    > > > directly to the X1/X2 leads?
    > > >
    > > > The data sheets call for a 6pf crystal, but I think I am using a
    > > > 10pf, standard RTC issue 32.768KHz.
    > > >
    > > > Thanks,
    > > > Martin Hebel
    > > > .
    > > >
    > > >
    > > > To UNSUBSCRIBE, just send mail to:
    > > > basicstamps-unsubscribe@y...
    > > > from the same email address that you subscribed. Text in the
    > > > Subject and Body of the message will be ignored.
    > > >
    > > >
    > > > Your use of Yahoo! Groups is subject to
    > > > http://docs.yahoo.com/info/terms/
    > > >
    >
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    > from the same email address that you subscribed. Text in the
    > Subject and Body of the message will be ignored.
    >
    >
    > Your use of Yahoo! Groups is subject to
    http://docs.yahoo.com/info/terms/
  • ArchiverArchiver Posts: 46,084
    edited 2002-01-03 23:55
    Al said:

    >
    >Also, crystals themselves are fairly temperature sensitive. In very
    >critical circuits they are put in an "oven" that keeps them hot.
    >Probably overkill here though.

    IIRC, crystals have a parabolic tempco curve.
    Those designed to operate in an oven are cut so that the
    inflection point of the curve is at the oven's operating
    temperature.

    Ordinary crystals are designed with the inflection point
    nominally at room temperature. I think if you put one of
    those in an oven, it will actually accentuate the frequency
    change vs. temperature.

    Of course if the oven's temperature regulation is good
    enough, that won't make an difference.

    Reg
  • ArchiverArchiver Posts: 46,084
    edited 2002-01-04 00:05
    Hi,

    One other way that works for both slow and fast crystals is to use a
    software adjustment.
    Your crystal's accuracy may be a bit off, your crystal's stability probably
    isn't.
    So if you monitor the clock for exactly 24 hour and find it is 96 seconds
    fast (4 secs per hour),
    you could compensate for that by waiting for the time to be hh[noparse]:mm:[/noparse]04 and
    then
    resetting the time to hh[noparse]:mm:[/noparse]00 (adjust per hour).

    Regards peter



    Oorspronkelijk bericht
    Van: martin@s... [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=aM92TOsXzQDTR4lavi6UbGnjRQT6jzrIDHx7LiWtzyAVGwoIuIzOX_LbEU5hel_GU4qr_b-SY95xsmnpgIw]martin@s...[/url
    Verzonden: donderdag 3 januari 2002 6:34
    Aan: basicstamps@yahoogroups.com
    Onderwerp: [noparse][[/noparse]basicstamps] DS1302 RTC Accuracy

    I've built a school-bell alarm system for my old High School. The time
    seems to be running a little fast (gains a couple seconds an hour). Any
    good ideas on how I can increase the accuracy? I have the crystal as close
    as I can wire-wrapping. Should I solder it directly to the X1/X2 leads?

    The data sheets call for a 6pf crystal, but I think I am using a 10pf,
    standard RTC issue 32.768KHz.

    Thanks,
    Martin Hebel
    .


    To UNSUBSCRIBE, just send mail to:
    basicstamps-unsubscribe@yahoogroups.com
    from the same email address that you subscribed. Text in the Subject and
    Body of the message will be ignored.


    Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
  • ArchiverArchiver Posts: 46,084
    edited 2002-01-04 02:32
    At 8:33 AM -0600 1/3/02, <martin@s...> wrote:
    >The time seems to be running a little fast (gains a couple seconds
    >an hour). Any good ideas on how I can increase the accuracy? I
    >have the crystal as close as I can wire-wrapping. Should I solder
    >it directly to the X1/X2 leads?


    Hi Martin,

    Soldering directly to X1/X2 might help. the wire-wrapping probably
    adds inductance in series with the xtal as well as capacitance in
    parallel, both of which will pull the frequency down.

    The frequency of a watch xtal should fall within +/-30 ppm at 25
    degrees C. That amounts to 30/1000000 * 3600 ~< 0.1 second per hour.

    As Reg pointed out, the temperature response of tuning fork watch
    crystals is parabolic downward, so they run slower at temperatures
    either lower or higher than 25 degrees C. A wristwatch has the
    luxury of operating in the constant temperature "oven" of a person's
    wrist!

    Other ideas (but not without ordering something):
    -- The Dallas DS32kz oscillator is guaranteed within 4 minutes per
    year over the entire industrial temperature range.
    -- A link to WWVB transmissions should be possible there at SIU,
    http://www.ulio.com/timepr.html. Unfortunately, I think Ultralink
    has stopped offering the OEM time receiver that was most
    Stamp-friendly.

    Finally, both teachers and students will thank you if the bell rings
    a couple of seconds early. ..so long as you correct it before school
    starts each day so they won't be tardy!

    -- best regards
    Tracy Allen
    electronically monitored ecosystems
    http://www.emesystems.com
    mailto:tracy@e...
  • ArchiverArchiver Posts: 46,084
    edited 2002-01-04 10:37
    Hi Folks,

    With crystals there are two considerations: accuracy and stability.

    On accuracy:
    Remember the guiding principle that increased capacitance slows the xtal
    down. Reducing it speeds it up. In the trade this is called 'pulling'.

    I seem to remember the original posting was concerned with trying to slow it
    down. So we are in the business of adding capacitance to pull the xtal down.

    The trimmer capacitor concept is the most easily adjustable physical
    solution. 2-10pf trimmers are good. For a temp test, a wire twist is also
    good. If more pulling down is required then add a further fixed value across
    the xtal.

    Placing a capacitor across a xtal is also sometimes used to help temerature
    compensation. If the right capacitor type is used - eg one which increases
    capacitance at lower temperatures, then this helps mitigate the temperature
    effect on the xtal. This is usually done by means of a fixed capacitor plus
    a trimmer. This technique is a classic in radio systems where stability to
    5Hz per minute is sometimes required.

    On Stability:
    In the real world, unless you have a lemon, the stability of the xtal is
    probably sufficient for your needs and a trimmer will probably not detract
    from the overall long-term stability.

    However if the accuracy of the xtal is way out, a trimmer will probably make
    things worse as it may be pulling the xtal out of its band stability. If you
    can't subsitute another xtal for comparison, then the technique of applying
    a software fix described in another post will have to do.

    I hope this all makes sense!

    Regards,

    Tony Wells
Sign In or Register to comment.