Shop OBEX P1 Docs P2 Docs Learn Events
- DS1302 Clock is losing time. — Parallax Forums

- DS1302 Clock is losing time.

MrdavidjenkinsMrdavidjenkins Posts: 49
edited 2005-08-03 02:22 in BASIC Stamp
I am using the DS1302 chip with a battery backup to keep time with a basic sx.· ·Just finished the project last night and ·unplugged the power to the basic stamp.· This morning, the time was off by 20 minutes - that is, the 1302 read 1:30 PM when the time was actually 1:50 pm.· I am using a CR2025 3 volt button type battery.· The backup is only a backup for when the unit needs servicing.

I will leave the basic stamp on AC power tonite to see if there is a problem only with the backup , but I have a couple of questions.

1)· Is there a way to tweak the 1302 to get better times?

2)··Has anyone else seen this kind of problem and how did they resolve it?·

Thanks

Dave

Comments

  • dandreaedandreae Posts: 1,375
    edited 2005-08-02 19:55
    You need to make sure that you are using the correct crystal and also make sure that the crystal is super close the pins on the DS1302.· Here is a link for the crystal that you should be using:· http://www.parallax.com/detail.asp?product_id=251-03230 .· We solder our crystals right to the pins of the DS1302.·


    Dave


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Dave Andreae

    Tech Support
    dandreae@parallax.com
    Http://www.parallax.com

    ·
  • MrdavidjenkinsMrdavidjenkins Posts: 49
    edited 2005-08-02 20:21
    Thanks for the tip. I have used the parallax crystals and, as you suggested, soldered the crystal directly onto the pins on this project. Using some silicon rubber to hold the crystal ontop of the 1302.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-08-02 21:06
    David,

    ·· I have several clocks using the DS1302 and each has been left overnight and sometimes a couple of days with just the battery backup on the DS1302.· None of them were ever off by more than a second.· Just curious, which pin are you connecting the battery to, and is it connected to anything else?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • MrdavidjenkinsMrdavidjenkins Posts: 49
    edited 2005-08-02 21:14
    Hi Chris,

    Here are the pins

    0 Data IO
    1 Clock
    2 Chip Select
    3 LCD for Seetron lcd

    Thanks.
    Dave
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-08-02 21:16
    David,

    ·· What I meant was, which pin is the backup battery connected to, and is it connected to anything else?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • MrdavidjenkinsMrdavidjenkins Posts: 49
    edited 2005-08-02 21:33
    CHris,

    Okay - I looked and verified

    Pin 1 5volt
    Pin 2 crystal 1
    Pin 3 crystal 2
    Pin 4 grnd
    Pin 5 basic pin2
    Pin 6 basic pin0
    Pin 7 basic pin1
    Pin 8 3 volt battery

    Do you think I might have the pins reversed. Here is a snipit of the code.


    DataIO PIN 0 ' DS1302.6
    Clock PIN 1 ' DS1302.7
    CS1302 PIN 2 ' DS1302.5


    Thanks again for your help. My guess is that the crystal might be off or damaged by my ham - handed soldering. Either that or the crystal sees heat from the clock. I will try another 1302 and crystal tomorrow if the time results warrent.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-08-02 21:49
    David,

    ·· Your connections are correct.· I don't know what's going on.· I've never had those problems.

    EDIT:· I checked on the crystal, and if you are using the crystal we sell, then it has to be something else...Is the battery at 3V?· What about your code?· Are you turning on the trickle charger or anything like that?· Are you using the write-protect when you're not updating the time?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com


    Post Edited (Chris Savage (Parallax)) : 8/2/2005 10:07:00 PM GMT
  • denodeno Posts: 242
    edited 2005-08-02 22:53
    Just to add alittle to the backup power supply for the ds1302...I use a 1 farad super cap (from Jameco) and set the trickle charge register for one resistor and one diode.· I have powered down the ds1302 (everything off including the stamp) and left it for over a week. Power up, and the time is right on the money.

    My 2 cents worth...

    Deno

    PS...the super cap does charge up close to 5 volts.
  • MrdavidjenkinsMrdavidjenkins Posts: 49
    edited 2005-08-03 00:13
    Neat technique. I will try it a little later. By the way, I have lost NO time after 3 hours on DC. I expected to lose about 5 minutes, so I am pretty happy with that. I will address the backup battery in a few days - I appreciate all of your help.

    Dave
  • ForrestForrest Posts: 1,341
    edited 2005-08-03 02:22
    Check out the notes on page 4 of the DS1302 datasheet. It looks like placing the crystal on top of the chip may cause some interference www.maxim-ic.com/quick_view2.cfm/qv_pk/2685
Sign In or Register to comment.