Shop OBEX P1 Docs P2 Docs Learn Events
battery backed up clock — Parallax Forums

battery backed up clock

bobroanbobroan Posts: 37
edited 2007-12-04 17:45 in BASIC Stamp
Does anyone know where I can get a battery backed up clock for the stamp?· When I turn on my application, I want it to get the accurate time.

thanks

bob

Comments

  • FranklinFranklin Posts: 4,747
    edited 2007-11-21 02:52
  • Mike GreenMike Green Posts: 23,101
    edited 2007-11-21 04:00
    If you're using a BS2p/pe/px, Spark Fun Electronics has an assembled DS1307 RTC with battery that requires I2C to access it. It's easy with the built-in statements for the BS2p series Stamps, but you can do the I2C protocol using subroutines in the other Stamp models. There's a Nuts and Volts column that shows how to do I2C with a BS2.
  • bobroanbobroan Posts: 37
    edited 2007-11-21 17:40
    thanks.

    I've used the DS1302, but there is no battery backup to it, so it's always necessary to set it.

    I'll check out the 1307.·



    bob
  • NewzedNewzed Posts: 2,503
    edited 2007-11-21 17:51
    Bob, the DS1302 has battery backup - I've used it for years.

    Sid

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Yesterday is history, tomorrow is a mystery, and today is a gift.

    That is why they call it the present.

    Don't have VGA?
    Newzed@aol.com
    ·
  • bobroanbobroan Posts: 37
    edited 2007-11-21 18:02
    sid,



    It's just an IC.· even the diagrams in the app kit just show wires to a battery backup/supercap.·



    bob
  • T&E EngineerT&E Engineer Posts: 1,396
    edited 2007-11-21 18:20
    Anyone notice that the Parallax link posted by Franklin is for a DS1302

    BUT

    the picture is of a DS1620 (which is a·digital thermometer·IC not a Real Time Clock).



    http://www.parallax.com/Store/Components/IntegratedCircuits/tabid/154/CategoryID/31/List/0/SortField/0/catpageindex/2/Level/a/ProductID/233/Default.aspx



    Also keep in mind that all of the Real Time Clock ICs require a 32KHz crystal for operation:

    http://www.parallax.com/Store/Components/ResonatorsCrystals/tabid/153/CategoryID/31/List/0/SortField/0/Level/a/ProductID/350/Default.aspx
    ·
  • ZootZoot Posts: 2,227
    edited 2007-11-21 19:07
    One thing to keep in mind when choosing between, say, DS1302 and DS1307, besides the fact that the former is SPI and the latter is I2C --

    The DS1302 allows for either a traditional button battery backup or a supercap that is charged from the same power that supplies the chip. The latter only allows for true battery backup.

    Both are available in DIP form if you don't want to buy a breakout board. All you need is the crystal and the chip and the battery backup.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When the going gets weird, the weird turn pro. -- HST
  • bobroanbobroan Posts: 37
    edited 2007-11-21 21:50
    My problem is that I don't know how to connect a battery backup to the ds1302.· When I tried to get help on it about a year ago, all the responses just told me how easy it was, but I could never get a picture of a circuit.· Does anyone have a picture of a circuit that shows how to connect the ds1302 with a battery backup?· how long does a battery last?· is it a rechargeable?



    thanks

    bob
  • NewzedNewzed Posts: 2,503
    edited 2007-11-21 22:05
    Bob, the positive side of the battery goes to Pin 8, the negative side to Pin 4 (common ground).
    The battery lasts about 7 years and is not rechargable.· Comes in three variations - vertical
    thru hole, horizontal thru hole and straight coin with a battery holder.

    Sid

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Yesterday is history, tomorrow is a mystery, and today is a gift.

    That is why they call it the present.

    Don't have VGA?
    Newzed@aol.com
    ·
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-11-21 22:08
    Bob,

    The following projects (from the Completed Projects Forum) is one of several clocks I have built around the DS1302 which all have battery backup. The schematic shows the connections needed. I hope this helps. Take care.

    http://forums.parallax.com/showthread.php?p=552892

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • ZootZoot Posts: 2,227
    edited 2007-11-21 22:08
    Somebody said...
    how long does a battery last? is it a rechargeable?

    A button battery backup should last 3-5 years minimum, I would think (same kind of clocks and batteries are used inside your computers for backup of similar info -- when was the last time you had change your computer's RTC backup battery? If you have, it's an old computer).

    If you want a "rechargeable" you use a super-cap on the DS1302 -- the capacitor is charged up from the chip's power supply and discharges slowly upon power-down to keep the chip alive.

    Schematics, hookups available in datasheets for the chip, e.g.

    pdfserv.maxim-ic.com/en/ds/DS1302.pdf

    Page 2 shows typical connections, with SPI lines to the micro, crystal, backup supply. In their connection diagram, the capacitor (supercap) on Vcc1 can either be a supercap (for charge/discharge backup) or a lithium button battery.

    Also, this Parallax how-to may be helpful:

    parallax.com/Portals/0/Downloads/docs/prod/appkit/ds1302rtc.pdf

    Page 2 shows connection diagram with battery backup. Plus there's code examples.

    I prefer the DS1307 myself, because I'm an I2C fiend, but that's just me smile.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When the going gets weird, the weird turn pro. -- HST
  • bobroanbobroan Posts: 37
    edited 2007-11-22 01:44
    Zoot,



    thanks for those references.· The page 2 you refer to says to use only nickel cadmium, but you suggest a lithium button battery if I want to go rechargeable.· How many volts?

    Do you know of anything I can solder to a board which holds a batttery backup?

    thanks

    bob
  • ZootZoot Posts: 2,227
    edited 2007-11-22 04:03
    The nicad is if you set the RTC for trickle charge, I think. I don't know that I've ever used that setup. See if Chris Savage's write-up discusses it.

    Digikey, Mouser, Jameco all carry button battery holders that fit .1" protoboard holes. The clip holders are around $1.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When the going gets weird, the weird turn pro. -- HST
  • bobroanbobroan Posts: 37
    edited 2007-11-22 14:51
    Chris,



    thanks for the reference to your schematic.· It's starting to help.· What kind of battery did you use? Lithium, NiCad, other?· The appkit says the battery should last a couple of days and people on this forum say 5 -7 years.· Which is more accurate?

    the appkit for the ds1302 says that when you use battery backup you need to set diodes and resistors and mentions available code is ds1302_3.· I couldn't find that code.



    thanks

    bob
  • sam_sam_samsam_sam_sam Posts: 2,286
    edited 2007-11-22 19:07
    ·Bob


    The Demo Code is Last Demo Code on the Last·Three·Pages

    If you can get it to work Please Post what you used to get it to work







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

    ·
    ·
    ·
    ·
    Sam

    Post Edited (sam_sam_sam) : 11/26/2007 6:21:45 PM GMT
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-11-29 18:12
    Bob,

    Sorry I didn’t get back to you…I was out for a couple of days. The battery life depends on a lot of things, actually, but the usage from the DS1302 will only be when the main power is off. Remember, the backup battery is just that. It is anticipated that the unit will be running from main power and only occasionally use the backup. If your unit is running off the backup most of the time then the battery capacity will have an impact on its lifetime. As for the charging circuit, I used it once. It just didn’t seem worth it at the time. Of course, super-caps have improved since then so maybe I will try it out sometime, but the settings are battery dependant, in as far as how much voltage and current you are sending to it. For a super-cap it doesn’t really matter. You can select max current and voltage and it will be fine. Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • Beau SchwabeBeau Schwabe Posts: 6,568
    edited 2007-11-29 21:40
    Bob,

    As Chris mentions, this feature is only designed to be used occasionally. In a data logger that I designed some years ago, I used this feature using a Cap as a backup battery allowing a moderate amount of time for the user to change the battery without needing to reset the time entirely. It was nice for this purpose, but even at the highest current setting... (1K resistor with 1 Diode) I would not want to rely on charging a battery this way.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.
  • sam_sam_samsam_sam_sam Posts: 2,286
    edited 2007-11-30 22:36
    Beau Schwabe

    Thank you for your reply

    So do you think it would be better to have a battery back up the Basic Stamp and the DS1302
    as one unit

    Instead of just putting a battery on the DS1302 chip for what i was wanting to do

    This might be easyer to do but will take more batterys to do it this way

    Would 6 volt battery pack be good enough or would a 7.2 volt battey pack be better

    Please let me know which one would be better


    Thank you for your help



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

    ·
    ·
    ·
    ·
    Sam
  • Beau SchwabeBeau Schwabe Posts: 6,568
    edited 2007-12-01 07:31
    sam_sam_sam,

    I'm not sure that I understand what you are wanting to do. There may be a terminology issue here that should be clarified.

    To me, the function of a Backup Battery is to keep vital circuits alive in suspended mode at a level that's just enough to prevent any information loss. ...In which case , why would you need to "battery Backup" the Stamp?

    A Backup Supply, (can be a battery), but it is designed with enough "oomph" to run a system in full function mode for X amount of time when the main supply fails. ... Usually to allow a proper shutdown sequence if/when necessary.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.
  • sam_sam_samsam_sam_sam Posts: 2,286
    edited 2007-12-03 16:41
    Beau Schwabe

    To me, the function of a Backup Battery is to keep vital circuits alive in suspended mode at a level that's just enough to prevent any information loss. ...In which case , why would you need to "battery Backup" the Stamp?

    The reason i want to use a battery back up is because·(I need to keep track of time as part of the program that i want to write) if the power is lost happen a lot where i live

    Please let me know which one would be better 6 volt battery pack or would a 7.2 volt battey pack be better
    For what you are talking about



    Thank you for your time and help in this matter

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

    ·
    ·
    ·
    ·
    Sam

    Post Edited (sam_sam_sam) : 12/3/2007 4:47:43 PM GMT
  • Beau SchwabeBeau Schwabe Posts: 6,568
    edited 2007-12-03 17:08
    sam_sam_sam,

    7.2V will provide more overhead voltage for your design than 6V would, but I think you want to focus more on the AH (Amp-Hour) rating of your supply vs. the demands of your circuit design rather than the supply voltage.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-12-03 17:10
    Sam,

    The 6V or 7.2V battery that you’re referring to would not be charged by the DS1302 charging circuit. I’m not sure if you know this. Your program could be written so that in the event of a power failure, on restart it can recover based on data stored in the DS1302 RAM. This is the most common method of recovery. Data that is constantly being updated but still needs to be saved can be written continuously to the DS1302 RAM as it is updated. On power up this data can be accessed and the program can pick up where it left off.

    Very few applications require backup power for the system. One such example is my Alarm System. It runs off the main power through a wall adapter. This main power also continuously recharges an SLA battery (12V). If main power should fail the alarm system still needs full power to run. The power failure is logged as an event. Now, should the backup power system get too low the entire system will shut down, however the DS1302 will retain its RAM and time via the 3V CR2032 battery it has.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • sam_sam_samsam_sam_sam Posts: 2,286
    edited 2007-12-04 17:28
    Beau Schwabe

    Thank you for your reply and help in this matter

    7.2V will provide more overhead voltage for your design than 6V would

    This is what·I want to know

    I think you want to focus more on the AH (Amp-Hour) rating of your supply vs. the demands of your circuit design rather than the supply voltage.

    I know that (Amp-Hour) rating is·what i· am going·to foucs on· but·I need to know if i need to also focus supply voltage·this is
    why i ask the question becase I have·read· this on the·Forum·before on this suject before

    Chris Savage

    ·The DS1302 will retain its RAM and time via the 3V CR2032 battery it has.

    The problem with this is that how will i know if the CR2032 battery has gone bad the only way i would this is if light would not come because the time is lost

    Now if there was a way to check this battery with te Basic Stamp this might work

    The problem is that where i live there are alot of BROWN OUT where the power gose out for five seconds or less
    at lest·two or three times a week or sometimes·more

    Also this happen alot in the summer when the A\C come on the power DIPS low enough that the light go out or very low
    when it come on

    The Power Co will not do any thing for you because i have so many times before

    I have these timers that you can get at the store that can time 2,4,6,8 hours·or from sunset sunrise i have to reset these
    two or three time a week



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

    ·
    ·
    ·
    ·
    Sam
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-12-04 17:45
    Sam,

    It’s fairly easy to detect if the DS1302 has lost power and even backup RAM. Generally on power-up there is a bit set on the DS1302 which is the clock halt bit. Checking for this bit is a start. As a note we did cover all the dynamics of this in another thread (I will search for it). In any event with so little usage of the battery there’s no reason not to expect years of usage from your CR2032. On the other hand, if you want to be sure just use a Supercap. That will eliminate the need to worry about voltage/current.

    http://forums.parallax.com/showthread.php?p=671537

    and

    http://forums.parallax.com/showthread.php?p=676035

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
Sign In or Register to comment.