Shop OBEX P1 Docs P2 Docs Learn Events
DS1302 - timekeeping chip runs slow... — Parallax Forums

DS1302 - timekeeping chip runs slow...

tommytommy Posts: 84
edited 2008-05-26 02:55 in General Discussion
... Hello.· I go away to see the world in my boss' advertising truck, and this trip had me in Denver for 32 days...·· and my SX-powered, remote-control, automatic vertical blinds (that open at 9:30 am and close at dusk) also have a cookoo clock-feature that beeps the time every hour.

... having set the time on the morning I left, I then noted when I came home, the clock was exactly three minutes slow (compared to a faithful clock-radio that I haven't reset in ten years)...··and now·I have an semi-accurate reading of five and a half seconds a day.

... Is there something wrong with the DS1302 ??? --- it was my first and only and is socketed --- might the 32768 hz crystal be different from the other twenty in the package I bought ???

·attachment.php?attachmentid=53700
... or should I just program an adjustment into the SX-28 (the easiest solution).· On my homemade circuit board, I did extend a ground-leg around the crystal as I had seen in articles and schematics.

thanks.· tommy

Post Edited (tommy) : 5/19/2008 6:48:01 PM GMT

Comments

  • tommytommy Posts: 84
    edited 2008-05-19 18:41
    ... it's still me here (tommy) -- I had this posted·in the·(gasp !) BASIC STAMP section (by misteak) for twenty-four hours and forty people looked, but no one offered a reply.·· I don't know who looks in the basic stamp section - when I discovered the preciseness of assembly language, I left there and never looked back...·· maybe someone here in the sandbox section has had experience with a DS1302...· if I had made this project for someone else to use, I would be sorely embarrassed at how often the clock must be reset.

    tommy
  • Twisted PairTwisted Pair Posts: 177
    edited 2008-05-19 22:30
    Tommy,

    I'm running the DS1302 in an IC socket and have been for quite a while now with extreme accuracy. The crystal is from Parallax, and is soldered very close to the pins of the socket with short leads on the crystal itself. Also make sure that you clean the solder flux from the solder joints of these pins as the flux will cause timing issues. There have been a few discussions on this forum about the crystal soldering·technique, but I can't remember where they were or who posted them. Another thing that I did on my board was to run the ground trace under the DS1302 rather than around the crystal. I dont know if this would make a difference or not.

    Twisted Pair....

    By the way Tommy, even though your schematics are not·showing any support hardware, I assume that you are using them ?

    Post Edited (Twisted Pair) : 5/19/2008 10:49:04 PM GMT
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2008-05-19 22:42
    Hello,

    There is also an AppNote from Dallas/Maxim regarding the importance of following the crystal placement and layout. There are also different capacitive load values for crystals and the DS1302 requires a specific one. If you got it from us it is the correct one, however I have seen where people have ordered the wrong one and had issues.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • tommytommy Posts: 84
    edited 2008-05-20 00:53
    okaaay...

    ... "different capacitive load values" is a new term for me.· I just went for the 32,768 khz value quite a while ago,·from DigiKey,·and assumed they were all the same...··· It says 12.5 pf on the package.· Now is the time to learn, as I'm building a new board to add a large 5V,·capacitor on the other DS1302 voltage pin (5) to accomodate the occasional power failure...

    ... "support hardware" ??? -- if you mean the capacitors on each side of the 7805 power supply, and the one right at the head of each IC ?? -- yes.· I copy the values from things I see and read.· And the power and the ground leads take the same general paths to get to each component...· If you mean something else, well I guess I could learn some more...

    ... I'll be ordering a couple of·crystals from Parallax if I see a different capacitive load value written there somewhere...·· in the meantime, I could program a 2:00am jump of five seconds per day, and every eight days an additional five seconds...

    ... thank you for now, I'll keep looking here...· tommy
  • sam_sam_samsam_sam_sam Posts: 2,286
    edited 2008-05-20 16:13
    Tommy

    Here is where the data sheet is at this link

    http://www.parallax.com/Portals/0/Downloads/docs/prod/datast/ds1302.pdf

    ·This·is·off of the data sheet for DS1302

    CRYSTAL SELECTION·

    A 32.768 kHz crystal can be directly connected to the
    DS1302 via pins 2 and 3 (X1, X2). The crystal selected
    for use should have a specified load capacitance (CL) of
    6 pF.
    For more information on crystal selection and
    crystal layout consideration, please consult Application
    Note 58, “Crystal Considerations with Dallas Real Time
    Clocks”.


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ··Thanks for any·idea.gif·that you may have and all of your time finding them

    ·
    ·
    ·
    ·
    Sam

    Post Edited (sam_sam_sam) : 5/20/2008 4:20:19 PM GMT
  • Mike GreenMike Green Posts: 23,101
    edited 2008-05-20 18:07
    Do remember that the crystal frequency does vary slightly with temperature and also "ages"(it slowly decreases over time to a plateau). 200 seconds' error in a month (30 * 24 * 60 * 60 = 2.6x10^6 or less than 0.01%) is quite small. Clock radios maintain accuracy thanks to the power company's adjustment of the 60 cycle rate to maintain the long term average accuracy, something not available to a stand-alone system.
  • tommytommy Posts: 84
    edited 2008-05-26 02:55
    ... thanks, fellas.· I have made a five-second a day software-fix (get_time· /· if time equals 02:02:02 then time equals 02:02:07· / save_time) and I'm going to let this one stay as is...·· I've now seen the note about the capacitance and will order correct crystals for any future clocks...·though I'm no longer expecting great accuracy.
    ·
    ... it was nice to have the clock on board solely for its non-volatile memory area, where I keep a copy of the adjustable opening time and a "darkness-value" for the RC-time circuit to determine 'dusk'.
    ... should I want an accurate timepiece I'll monitor the 60-cycle current somehow - say ! ! ! -·idea.gif -that could be a verry (sic)·interesting project to explore and use the SX's interrupt feature for the (my) first time...

    'bye for now.· tommy
Sign In or Register to comment.