Trouble with DS1307 battery backup


Closed Thread
Results 1 to 14 of 14
  1. #1
    Join Date
    Apr 2011
    Location
    Welches, Oregon
    Posts
    198

    Default Trouble with DS1307 battery backup

    I am currently working with a DS1307 RTC ('877A and I2C). All is well reading, writing, and displaying result to a typical LCD. The difficulty comes when using a battery (2032 Lithium coin) to backup the clock. Insert the battery, the display flashes: 04:04:04; remove it, time returns to accurate display and advance. Re-insert battery, display reads: 04:04:04... Its quite a fun game, but not very efficient way to keep the time. I've checked the voltage of the battery, wiring, and everything else I can think of - as well as tried some basic filtering. I've searched Google for any known issues and found nothing... Anyone can advise?

  2. #2
    Join Date
    Feb 2011
    Posts
    60


    Did you find this post helpful? Yes | No

    Default Re: Trouble with DS1307 battery backup

    A schematic showing DS1307, never had trouble except once when a circuit mistake overheated the voltage supply and the clock with battery gave similar data.

    http://www.harbornet.com/sunflower/PCB.jpg

  3. #3
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default Re: Trouble with DS1307 battery backup

    Very likely a wiring problem. Did you place two diodes to isolate the battery from power?

    You can have more help if you post the schematic.

    Cheers

    Al.
    All progress began with an idea

  4. #4


    Did you find this post helpful? Yes | No

    Default Re: Trouble with DS1307 battery backup

    Quote Originally Posted by aratti View Post
    Very likely a wiring problem. Did you place two diodes to isolate the battery from power?


    Al.
    You do not need your suggested diodes - if you look at the data sheet the backup battery has its own pin, and the battery should be connected to that and ground.

  5. #5
    Join Date
    Apr 2011
    Location
    Welches, Oregon
    Posts
    198


    Did you find this post helpful? Yes | No

    Default Re: Trouble with DS1307 battery backup

    I was thinking more like stray capacitance issues, or I2C resisters of wrong value (3K3)- something of that nature; maybe battery back-up voltage (3.32V) issue. Wiring the battery could hardly be easier and I've looked, until my eyes crossed, at the holder to be sure there was nothing wrong with it. I think I'll try a different battery, but I've already tried a different 1307 and a different 12.5 pF crystal, verified wiring- exact same result. Circuit is rock solid, just goes "404" on me when the battery is inserted.

  6. #6
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default Re: Trouble with DS1307 battery backup

    What happens if you leave the battery inserted? Can you then reprogram the time?
    Dave
    Always wear safety glasses while programming.

  7. #7
    Join Date
    Apr 2011
    Location
    Welches, Oregon
    Posts
    198


    Did you find this post helpful? Yes | No

    Default Re: Trouble with DS1307 battery backup

    No... The LCD initializes, then displays "TEST" on startup or reset (both work fine, even with battery inserted), then clears the LCD and displays the time in a simple loop. Function is consistent regardless of battery, except the display remains fixed at 04:04:04 with the battery in place.

    Reprogramming sets the time registers to the startup value, but 04:04:04 continues to be displayed until the battery is removed.

    In exercising your suggestion, Dave, it appears that the clock continues to function correctly (and accurately) while the display is erroneous; rather it is some anomaly in the I2C that affects the output or display! What is the likelihood that different (lower? Higher?) I2C pull-ups would resolve this?

    EDIT: Appending or propending text before or after the time displays as expected as well.
    Last edited by Amoque; - 30th August 2014 at 16:15.

  8. #8
    Join Date
    Apr 2011
    Location
    Welches, Oregon
    Posts
    198


    Did you find this post helpful? Yes | No

    Default Re: Trouble with DS1307 battery backup

    Ok, mystery solved.

    It appears that noise, capacitance, or competing residual signal on the breadboard was causing issue. Running the voltage supply directly to the circuit board resolves all issues. Thanks all - and you particularly you Dave, for putting me on the right track.

  9. #9
    Join Date
    Apr 2011
    Location
    Welches, Oregon
    Posts
    198


    Did you find this post helpful? Yes | No

    Default Re: Trouble with DS1307 battery backup

    Ok, after further research, it appears related to battery voltage. The "new" battery I purchased reads over 4 volts. Just a head-up to others: something to look at if you're getting wonky readings from your DS RTC. I clipped a high draw LED to it for a bit - works flawlessly now. Sorry for the "Much ado about nothing."

  10. #10
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default Re: Trouble with DS1307 battery backup

    Quote Originally Posted by Amoque View Post
    Sorry for the "Much ado about nothing."
    NOTHING, Really?
    If it gave you pain, it was not NOTHING. Someone WILL encounter this situation again, AND see this thread, AND it will help them. Keep posting!
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  11. #11
    Join Date
    Feb 2011
    Posts
    60


    Did you find this post helpful? Yes | No

    Default Re: Trouble with DS1307 battery backup

    Very interesting. I did not know about DS1370 battery voltage sensitivity. I used long-life CR 1620 for 10 year clock service and never checked battery voltages with a meter. Something to consider in the future.

  12. #12
    Join Date
    Nov 2005
    Location
    Bombay, India
    Posts
    947


    Did you find this post helpful? Yes | No

    Default Re: Trouble with DS1307 battery backup

    I've seen this problem before. The resolution is in the data sheet section regarding Vbat. This is what it says
    From http://datasheets.maximintegrated.com/en/ds/DS1307.pdf page 6

    Backup Supply Input for Any Standard 3V Lithium Cell or Other Energy Source. Battery voltage must be held between the minimum and maximum limits for proper operation.
    Diodes in series between the battery and the VBAT pin may prevent proper operation. If a backup supply is not required, VBAT must be grounded. The nominal power-fail trip point (VPF) voltage at which access to the RTC and user RAM is denied is set by the internal circuitry as 1.25 x VBAT nominal. A lithium battery with 48mAh or greater will back up the DS1307 for more than 10 years in the absence of power at +25°C
    Hope that helps

  13. #13
    Join Date
    Apr 2011
    Location
    Welches, Oregon
    Posts
    198


    Did you find this post helpful? Yes | No

    Default Re: Trouble with DS1307 battery backup

    Yes, I read the warning and it eventually came back to me as a possibility - it just took too long for me to question that a brand new, off the shelf part would be the problem. FAR more often it is some errant wire or lack of understanding... in my case anyway.

    If I've learned anything it is that those weird intermittent problems that come and go are most often related to power supply. Wires don't move and semiconductors don't magically heal - only to fail again - in a random pattern. Well, here's to posterity and "Good Luck" to the next guy.


    Cheers,

  14. #14
    Join Date
    May 2012
    Location
    Merseyside, UK
    Posts
    237


    Did you find this post helpful? Yes | No

    Default Re: Trouble with DS1307 battery backup

    Quote Originally Posted by Archangel View Post
    NOTHING, Really?
    If it gave you pain, it was not NOTHING. Someone WILL encounter this situation again, AND see this thread, AND it will help them. Keep posting!
    If this was Facebook …. Deserves a like


    I have had a wealth of help and advice from here…. By asking Questions

    Thank you all of you !!!!

Similar Threads

  1. Replies: 13
    Last Post: - 22nd January 2012, 04:48
  2. Without resetting....Switching PIC over to Backup Battery
    By financecatalyst in forum Schematics
    Replies: 5
    Last Post: - 29th December 2010, 14:23
  3. Sampling A/C with battery backup.
    By Dwayne in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 15th April 2004, 20:39
  4. Battery backup with long delay
    By Dwayne in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 6th January 2004, 20:38
  5. Battery Backup with PIC controlling switch
    By Dwayne in forum Schematics
    Replies: 1
    Last Post: - 27th December 2003, 13:16

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts