Shop OBEX P1 Docs P2 Docs Learn Events
Ds1302 battery dead in just a few days — Parallax Forums

Ds1302 battery dead in just a few days

Sutton MurraySutton Murray Posts: 88
edited 2007-10-05 14:30 in BASIC Stamp
On projects of mine i have found that the battery ran down quickly in just a few days.
Confident with myself that my diagram is correct i turned to the data sheet. I Read about the trickle charge command, but don't know how to implement it. Is my problem with the quick dying batteries the reason to the trickle charge not being activated?
Am i correct in thinking that the command must be issued only ones at the initialization period. After this i don't have to run the command again? Will the command solve my problem?

Is the command below correct?

SHIFTOUT 2, 1, LSBFIRST, [noparse][[/noparse]$091 | (ADR<<1)\8] '$091 or %10010001

Comments

  • FORDFORD Posts: 221
    edited 2007-09-27 02:54
    Hi Murray,
    Try this,
    cheers,
    Chris, West Oz...



    ···· TIMER.LOWBYTE = %10100111
    ·····TIMER.HIGHBYTE = %01000·· 'enable trickle charger, 1 diode, 8K resistor
    ·····GOSUB writeRTC

    · WRITERTC:
    ····· HIGH Res1302
    ····· SHIFTOUT datapin, clock, LSBFIRST, [noparse][[/noparse]%0\1,TIMER.HIGHBYTE\5,%10\2,TIMER.LOWBYTE]
    ····· LOW Res1302
    ····· RETURN
  • allanlane5allanlane5 Posts: 3,815
    edited 2007-09-27 15:13
    Unfortunately, you didn't say what kind and size of battery you're using. Because you can't "trickle charge" a coin cell -- and a coin cell tends to work for like 5 years, so you don't NEED to trickle charge it.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2007-09-27 16:42
    Allanlane5 has a good point - battery chemistry is divided between Primary Cells [noparse][[/noparse]never intended for recharge] and Secondary Cells [noparse][[/noparse]rechargible].

    Are you sure you even want a battery?· The documents mention using a Super Capacitor.

    Even then, trickle charge rate is determined by different factor for different battery chemistry. It isn't the same for lead acid, lithium, and NiMH. Kind and Size are important.

    Personally I would use a NiMH or NiCad pack that is intended to replace the rechargible batteries in a cordless phone. You can get a 600ma 4.8 volt version and 1/25th to 1/30th of that is the trickle charge rate.· That fits to the 2.2ma maximum.

    Lithium is nicer because it is smaller, but need a more sophisticate system to monitor charge and discharge.

    Super Cap seems to be a good way to go.· But if you have long down times, it may not provide enough.

    And it always helps to fully charge the battery before you use it. NiMH and NiCad don't hold a charge very long - 3 to 6 months.· Directly from the store, they are usually in need of topping off.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "Everything in the world is purchased by labour; and our passions are the only causes of labor." -- David·Hume (1711-76)········
    ···················· Tropically,····· G. Herzog [noparse][[/noparse]·黃鶴 ]·in Taiwan

    Post Edited (Kramer) : 9/27/2007 5:07:28 PM GMT
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-09-28 14:01
    The DS1302 will work with Super Caps, NiCad or Coil Cell Lithium Batteries. The latter is not rechargeable. I use the CR2032 (commonly found inside computers) to backup my DS1302-based systems. The batteries have lasted several years with intermittent main power failures. Of course, if the main power is disconnected for a longer period of time then more demand would be made on the battery, reducing its lifetime. Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • Sutton MurraySutton Murray Posts: 88
    edited 2007-09-29 08:47
    The battery being used is the CR2032.

    Ford is my code incorrect? I will try yours thanks.

    From the statements given i conclude that my problem, the quickly dying battery should not occur. The CR2032 must not be active in a trickle charge state.

    Any other reasons for the battery to die quickly?

    Should the I/O lines be set as an output or input lines at the initialization stage. Will this have any prevention act for a quick dying battery?
  • AmaralAmaral Posts: 176
    edited 2007-09-29 11:36
    Have you managed to solve this Murray ?

    Test is by taking out the battery of cap, from the pin 1 (vcc2) of your DS1302, turn it on and measure the voltage between this pin and ground. if this is Zero or below 3.6V you have it set to zero.
    Dont complicate your program, turn it on by

    HIGH CE
    SHIFTOUT IO, CLK, LSBFIRST, [noparse][[/noparse]$90,$A5] ´this sets to 4,3V and 2,15 mA
    LOW CE

    hope to help.

    Amaral
  • Sutton MurraySutton Murray Posts: 88
    edited 2007-09-29 13:09
    Amaral

    I have the DS1302 connected with the voltage supply to pin1(vcc2) and the Battery to pin8(vcc1). This is the other way around as described by you. Is this a problem?

    With my battery removed from the pin8(vcc1) a get a reading of 4.62V. Should this be zero? Your code will this set it to zero?
  • AmaralAmaral Posts: 176
    edited 2007-09-29 20:56
    Sorry my mistake
    The pins are correct your way !

    with my code , you should have 4.6V! that´s correct too !

    have you tried to mesure before running the code ?

    because now everything seems right


    Amaral
  • Sutton MurraySutton Murray Posts: 88
    edited 2007-09-29 21:07
    I have the 4.6V reading before and after running the code.

    The 4.6V output from the DS1302, isn't this the reason for flattening the battery. Shouldn't their be a 0 Volt out put from the Ds1302?
  • AmaralAmaral Posts: 176
    edited 2007-09-30 19:36
    acctualy this means that you are CHARGING the battery ! with 4.6V and 2.15mA . What kind of batt are you using ?
  • Sutton MurraySutton Murray Posts: 88
    edited 2007-10-01 06:58
    I am using a coil cell CR2032. So how do i switch off the charging?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    For in much wisdom is much grief, and he who increases knowledge increases sorrow." ~Ecclesiastes 1:18
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2007-10-01 11:27
    The documentation states that the 1302 powers up with trickle-charge disabled, so I reckon the answer is to not enable it.·

    It's mentioned in the datasheet, but they only go on about using a super-cap/rechargeable and don't drop the other shoe,·with explicit info regarding a non-rechargeable battery situation,·in the AppKit Notes.
  • allanlane5allanlane5 Posts: 3,815
    edited 2007-10-01 14:01
    True, but having enabled it, you now need to disable it -- the 1302 is funny like that.

    Check out the chip docs to determine how to do that. It's POSSIBLE all you have to do is disconnect the backup battery, un-power the 1302, and on power up it'll reset itself back to the default. After that, DO NOT turn on trickle charging (edit your code to make sure you don't), apparently that will kill a 2032 coin cell.
  • Sutton MurraySutton Murray Posts: 88
    edited 2007-10-01 18:26
    Allen

    I have tried your advice. I have disconnected the battery, didn't work. Made sure nothing is in the code to trigger the charge. Then i changed the DS1302 with another DS1302. This worked the voltage on the battery pin 8 of the chip now had a 0 volts reading. Replacing the old DS1302 in the same circuit and code, still have the 4.6volt output reading on pin 8.

    Now how is this possible?
    I know that the chip has ram on it that will loose the data when the battery has been disconnected. My guess is that the chip must have a small portion of EEPROM for basic functions. Well does it? Has previous code of mine activated this to be stored on EEPROM of the DS1302, causing the continuous charge activity. I have been playing around a lot aiming getting the RAM of the DS1302 to function in my program.

    How will i go about in fixing this?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    For in much wisdom is much grief, and he who increases knowledge increases sorrow." ~Ecclesiastes 1:18
  • pwillardpwillard Posts: 321
    edited 2007-10-01 19:15
    To prevent accidental enabling, only a pattern of 1010 enables the trickle charger. All other
    patterns will disable the trickle charger. The DS1302 powers up with the trickle charger disabled.

    Of course, one of your 1302's may be a deceased DS1302...

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔

    There's nothing like a new idea and a warm soldering iron.

    Post Edited (pwillard) : 10/1/2007 7:20:19 PM GMT
  • AmaralAmaral Posts: 176
    edited 2007-10-05 14:12
    Ok Guys , PLEASE read the documentation ! the data sheet is·CLEAR !

    to disable that you have to:

    HIGH CE
    SHIFTOUT IO, CLK, LSBFIRST, [noparse][[/noparse]$90,$00] ´this sets to 0V, none resistors or diodes select
    LOW CE
    Yes It is stored in a ROM (EEPROM MEMORY) that keeps the information !


    Sorry about leaving this tread for a while ! my work does not let me play a lot !


    Hope to Help

    Amaral
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-10-05 14:23
    Amaral, I don't believe there is any EEPROM on the DS1302. In my years of use of it I have had to re-initialize it on startup from the host controller. The only time anything is saved is when the device has a battery backup. Nonetheless the micro should always initialize the charging circuit on startup if it is being used. Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • AmaralAmaral Posts: 176
    edited 2007-10-05 14:30
    You are absolutely wright ! I´m making a mess in my mind with the DS1620 !

    Sorry you all , I´ve to take longer time to post an answear !

    on the documentation it says: "The DS1302 powers up with the trickle charger disabled."

    it should be 0V ! otherwise it may be damaged !

    Amaral
Sign In or Register to comment.