Connect with us

Rechargeable 3v battery details for microcontroller (Can't lose data!)

Discussion in 'Electronic Design' started by Kevin, Jan 17, 2005.

Scroll to continue with content
  1. Kevin

    Kevin Guest

    Hi Group,

    Let me pick your collective brains to see if I'm on the right track
    here:

    The situation:
    I'm designing a microcontroller-based data logger (don't yawn...yet)
    that will interface to a piece of equipment and keep track of when
    certain events occur. These details are kept in microcontroller ram
    and must be maintained even through power loss / daily shutdown
    without corruption or loss of data.

    Microcontroller is the ever popular PIC16LF628A (Nanowatt/low voltage)
    using the 4 MHz Internal RC oscillator. I also plan to use a 32.768
    KHz watch crystal to drive Timer1 so that the PIC can periodically
    wake and check if power has returned and resume normal operation. I
    need to preserve data in the PIC's ram during a power failure but due
    to reliability concerns I think powering the PIC from battery during
    loss of power is the safest solution versus using EEPROM etc.

    I plan to power the PIC16LF628A using power from both the machine
    (tapping into 12VDC power and regulating that to 3.3V for
    power/charging) as well as a rechargeable lithium 3V battery (see
    crude ASCII schematic below):

    1N5817
    IN4001 3.3V Reg Schottky Diode
    12V *--->|---+----[LM2950-3.3]--->|-----------+------+----- To PIC VDD
    from | | | |
    equipment | | | |
    | | \ | +
    | | 390 / |
    ==== 220uF | Ohms \ ==== 33uF
    16V | / 6V
    ==== | | ==== Electrolytic
    | | Panasonic ----- |
    | | ML1220 battery --- |
    | | 17 mAH 3V | |
    | | | |
    GND *--------+---------+----------------------+------+
    from
    equipment

    1. Any recommendation for the Schottky diode? (through hole package -
    no SMD parts). I'm thinking of something with a low Vf (so far the
    best I've come up with is a 1N5817 - approx 0.4V) but are there any
    other concerns I should be aware of?
    The battery spec sheet mentions the charging voltage range should be
    2.8V to 3.2V to achieve the rated mAH capacity. (I am pretty close to
    the low side of this range as 3.3 - 0.4 = 2.8V). If I could use a
    diode with a lower Vf it would help raise the charging voltage.

    2. Although it's not on the schematic above I plan to detect whether
    12V is present via an 4n25 optoisolator & zener diode ("power fail
    signal") to determine whether power is failing/failed (and if so go to
    sleep). As stated above the PIC will periodically wake from sleep and
    check if power has returned (so it can continue monitoring). This
    sounds reasonable, right?

    3. Should I be concerned about leakage from the 1N5817 diode when 12V
    is absent and the PIC is on battery power? If this leakage is a
    problem then what other charging circuit design should I use? I'd like
    to keep things simple and use only fairly common inexpensive parts
    (nothing that you couldn't get from Digikey). Similarly, would leakage
    from the 33uF cap pose a problem?

    4. Another thing I'm concerned about is battery life regarding
    charge/discharge cycles. The battery specs list these as 1000 cycles.
    Now the application shouldn't even remotely come close to draining the
    battery in daily usage but I'm just wondering about this. (I
    understand that the datasheet is probably on the conservative side).
    An alternative might be one of those large close-to-a-farad supercaps
    but again I don't know how long the PIC will run off of one of these.

    5. Because the PIC Vdd voltage is 3.3v input PIC pins will no longer
    be to TTL specs in terms of voltage levels, correct?

    6. Finally, is there anything I might have missed with regards to low
    power design? (Already checked PIClist.com & read Microchip's "Power
    Managed Tips N Tricks" app note (41200B).

    Thanks for your assistance.

    Kevin.
     
  2. Robert Baer

    Robert Baer Guest

    1) There are no decent diodes with a lower Vf. Germanium diodes are a
    bit lower, but the leakage is a killer. And a tunnel rectifier has
    almost zero volts Vf, but the reverse is nasty: like a forward biased
    diode.
    Put a diode in the ground leg of the regulator, to raise the output
    voltage about 600mV. Granted the regulation is worse and temperature
    sensitive, but those may be acceptable tradeoffs.
    3) Select that diode for low leakage at the highest temperature "of
    interest"; that may or may not force you to use a standard silicon diode
    - hence the suggestion in #1 above.
    The capacitor leakage needs to be tested; get various brands and
    series in each brand. Try 16V or 25V capacitors once a lowest leakage
    one is found - it may or may not help.
    It has been too long since i have done this; the better ones 20 years
    ago may not qualify now as manufacturing methods have changed so much.
    5) Obviously, the signal outputs of any logic device cannot be higher
    than its supply (if TTL like output). However, some are designed to
    allow up to 5V in with a 3.3V supply, and "open collector" outputs can
    go higher - depending on the process brekdown specs.
     
  3. What is your total circuit current draw? (is it just the PIC?)
    How often does your PIC wake up?
    Can you run your PIC slower from 32.768KHz instead of 4MHZ?
    How long does your data logger need to be installed for?
    Can you tolerate changing the battery say once every year or two?

    If you are talking only a mA or two total current then a set of
    Alkaline D cells may last for several years. In that case you might be
    able to forget about a rechargable solution.
    If your PIC spends most of it's time in sleep mode then you might be
    talking tens of microamps of total current, in which case the batteries
    will work for near their shelf life. Lithiums may get you 5-10 years.

    The simplist and most robust solution is just some Alkaline or Lithium
    non-rechargable batteries. If you can get away with it, this is your
    best option.

    Dave :)
     
  4. mike

    mike Guest

    I'm too lazy to look up the spec. Don't all recent PICs have flash memory?
    Does the thing have to log while the power is off? If not, might think
    about using a super-cap.


    Can you use a fet in place of the diode and run the gate off 12V?
    mike

    --
    Return address is VALID.
    Wanted, PCMCIA SCSI Card for HP m820 CDRW.
    FS 500MHz Tek DSOscilloscope TDS540 Make Offer
    http://nm7u.tripod.com/homepage/te.html
    Wanted, 12.1" LCD for Gateway Solo 5300. Samsung LT121SU-121
    Bunch of stuff For Sale and Wanted at the link below.
    http://www.geocities.com/SiliconValley/Monitor/4710/
     
  5. James Meyer

    James Meyer Guest

    Add RA and RB so that you can adjust the Vcc up to compensate for the
    diode drop in an ordinary, low leakage, silicon diode. I think that might
    address all your concerns.

    Jim
     
  6. Kevin

    Kevin Guest

    Don't have a circuit draw yet... still doing preliminary design on
    paper (plus waiting for parts to come in). I know this is not ideal
    for calculating battery life ;-)
    Estimate once every 2 seconds via 32.768 KHz Timer1 wake-from-sleep
    interuppt. Probably execute code for about 8 or 12 (say 16mS worst
    case) milliseconds when awake on battery power. By my calculation the
    PIC will be asleep for 99.2% of the sleep time. I plan to power
    external circuitry from one of the PIC's output pins to further reduce
    external current draw to a minimum by switching off external circuitry
    when asleep.
    Thought of this, but due to some signals that I have to monitor I have
    to run at 4 MHz. I am running at less than 5V (3v on battery), so
    power consumption should hopefully be OK.
    Well, was aiming for at least 5 years, maybe more (10 is even better).
    That's why I was thinking of rechargeable batteries as opposed to
    nonrechargeable ones.
    I thought (for low discharge rates) Alkalines weren't preferably
    because of their self-discharge rates? Not sure Alkalines will last 5
    years (what about leaking?).
     
  7. Kevin

    Kevin Guest

    I forgot about this trick, thanks!

    If I use this trick will a schottky work for the ground lead diode?
    The battery charging voltage range must be 2.8 to 3.2v (any higher and
    it'll cause battery deterioration).

    So I'm thinking about using a 3v regulator (instead of a 3.3v one)
    with a schottky diode in the ground path (which will raise voltage
    about 0.4v) then another schottky diode for the regulator output
    (drops about 0.4v) so the charging voltage should be close to 3v.

    Assuming both schottky diodes shift approx the same with temperature
    changes the reg output voltage should still be the same (yeah, that's
    probably a big if). Still, once the output voltage doesn't cross 3.2v
    things should be OK.
     
  8. Kryten

    Kryten Guest

    I looked at rechargeable lithiums for LED torches.

    The manufacturer's web site was very useful

    For example I found that deep discharge serious limits life.

    If you have a few % discharge then they recharge many times.

    This would match usage where a gadget trickle-charges it while on and it
    maintains an RTC while off.

    However if you have a full discharge, then it plummets to just around 10
    recharge cycles! :)

    I found this out after mistakenly assuming that an LM3909 would draw
    negligible current when I removed the LED from the circuit.


    Also check you have some way of detecting that the battery has not drooped
    below allowed minimum for valid data retention, or disappeared completely.
    People seldom think of that. One chip I saw (from Dallas?) blocked the first
    one or two write ops after power up if this had happened. The CPU would use
    this to feature to trust the data or not.
     
  9. Kevin

    Kevin Guest

    The problem is ensuring reliability - saving to internal EEPROM takes
    time (I think 10mS *per byte*) so if a power failure occurs I am not
    sure that I will have that much time to store data to EEPROM and shut
    down gracefully. In any case I'd wear out the on-chip EEPROM
    eventually by exceeding recommended write cycles - when that happens
    I'd have to replace the entire microcontroller. (The PIC16F628A can't
    write to its own flash, but even if it could the EEPROM has better
    reliability specs than the flash).

    If power is off there's nothing worth logging ;-) so I'm just
    concerned about preserving logged data.

    Regarding the supercap, how do you know exactly how long you can run
    off one? (there is no mAH rating on most of them that I've seen).
    Possibly... I'd have to look into this. Been googling with various
    combinations of keywords but haven't seen examples of how others have
    used rechargeable lithum batteries for data loggers.
     
  10. Kevin

    Kevin Guest

    Good - this matches what I was thinking. That's why I selected a 17
    mAH lithium battery - I shouldn't need 17 mAH for backup power, so
    it's oversized - discharge/recharge should be minimal, maximising
    battery life.
    Thought of this - plan to checksum data in ram to ensure integrity.
    Also the PIC has bits that are set on power-on reset so I plan to use
    them as well (if everything works then the PIC should never experience
    a power-on reset (aside from 1st poweron), since the battery is
    supposed to keep it going when power is lost). The ram retention
    voltage for the PIC is characterised as ~1.5V so that even if the
    battery discharges to 2V it should still be sufficient to keep data
    preserved (although this parameter is characterised and not tested, so
    it may not be 1.5v for every PIC).
     
  11. Another possibility the OP should look at is to tack an external
    serial (I^2C or SPI) FRAM memory onto the micro. Fast write,
    nonvolatility without batteries or long write cycles, and a lot more
    storage capacity than the very limited PIC RAM.


    Best regards,
    Spehro Pefhany
     
  12. mike

    mike Guest

    It's a capacitor. I=C*dv/dt
    I don't have any long term reliability data. I have used 'em to replace
    dead nicads in laptop computers.
    You might even be able to put the fet in the negative lead of the
    regulator and leave the diode out. Or maybe the ouput of the regulator
    is "disconnected" when the input volts goes away...maybe...worth a look.

    Been googling with various


    --
    Return address is VALID.
    Wanted, PCMCIA SCSI Card for HP m820 CDRW.
    FS 500MHz Tek DSOscilloscope TDS540 Make Offer
    http://nm7u.tripod.com/homepage/te.html
    Wanted, 12.1" LCD for Gateway Solo 5300. Samsung LT121SU-121
    Bunch of stuff For Sale and Wanted at the link below.
    http://www.geocities.com/SiliconValley/Monitor/4710/
     
  13. Tam/WB2TT

    Tam/WB2TT Guest

    I am doing this with a stack of AA alkaline batteries. Haven't measured the
    standby current, but I know it is very low because the voltage drop across
    the series 1N914 diode is about 0.28V. Still going after 3 years.

    Basically what he needs is to power the RAM from VCC through a series diode
    for normal operation. A second diode is connected to the RAM from the
    standby battery. The potential of the battery MUST be lower than VCC.

    For a rechargeable battery, he could use a resistive voltage divider off the
    12V, such that the open circuit voltage and resistance are correct for
    charging the battery through a third diode.

    Need to check the standby voltage requirement for the particular RAM, it
    might be as low as 2V. Some of these things will automatically go into
    standby mode when the voltage is below a certain value. You will want the
    RAM to disable its IO.

    Tam
     
  14. Kevin

    Kevin Guest

    Okay, maybe I'll have to rethink the rechargeable approach then.
    Actually what I'll probably end up doing is trying both rechargeable
    and non rechargeable versions, but since the circuit is (hopefully)
    low power I dunno if I'll see a difference. Thanks for the advice.

    Maybe I'll use a standard CR2032 coin cell so when it does come time
    to replace it (years down the road) I'll still be able to obtain the
    battery ;-) Won't want to run into trouble not being able to buy the
    "right" battery and have to kludge something. Hopefully a CR2032 (3V,
    220 mAH) should last a long time - I guess I'll just have to test,
    optimise, and test again if it doesn't ;-) CR2032 is pretty cheap
    (compared to other lithium batteries), so it'll actually reduce costs
    if it'll work in this application.

    Here's a somewhat related question for anyone: How low power are the
    newer "NanoWatt" PIC parts (like the PIC16LF628A) versus something
    like TI's MSP430? Doesn't TI claim that the MSP430 is the lowest power
    microcontroller (ideal for battery apps)? Just wondering if the
    16LF628A is good enough in terms of low power consumption or if I
    should investigate other possibilities (Not really willing to jump
    ship at this point unless there's a major advantage to be gained, but
    I'm curious nonetheless).

    Kevin.
     
  15. Kevin

    Kevin Guest

    Well, I was thinking of the possibility of a power glitch or sag in
    which the Vcc to the PIC fails while it is writing EEPROM. If this
    happens, then the byte currently being written is now corrupt. Also
    I'm guessing it probably isn't good for the EEPROM to have the power
    fail while writing (I was thinking that the high voltage needed to
    generate the erase voltage is generated by the on-chip charge pump
    using Vcc. What happens if Vcc fluctuates or droops while writing?
    Does this affect EEPROM reliability in some way or does it just
    corrupt the EEPROM byte being written to?)
    Will add some supercaps to the next parts order - I always wanted to
    play around with them anyway ;-)

    Kevin.
     
  16. Kevin

    Kevin Guest

    Just had a quick look at Ramtron's FM25040 - 4Kbit FRAM Serial Memory
    (SPI interface) - looks real nice!

    It appears to be fast, SPI interface, low power, and most important of
    all, virtually unlimited writes.

    Which means that it's probably expensive and not available in DIP ;-)

    What's the cost of these things in small quantities? (Digikey isn't a
    ramtron distributor ;-(

    For what I'm tracking I don't really need a lot of ram storage space
    (internal PIC ram is fine). So maybe this FM25040 is an option.

    Kevin.
     
  17. Mac

    Mac Guest

    I went to the Duracell website to see if I could find numbers on D cells.
    Duracell batteries will last for at least 5 years on the shelf. I'm sure
    Energizers will, too, but I happened to go to Duracell's website.

    If you discharge a Duracell D battery down to 1.1V, with a constant 0.25W
    power draw, it is more than a 10 amp-hour cell. So two D's, discharged
    down to a combined series Voltage of 2.2 V at a power rate of 0.5W would
    be more than 10 Amp-hours also. At very low discharge rates, such as you
    are contemplating, the cell will last much longer. And if you allow it to
    go down to 1V, you will get even more life out of it.

    1000 discharges on your 17 mAh battery would be sort of like 17000 mAH, or
    17 amp-hours. In reality, of course, this model of 1000 full charge
    discharge cycles is totally bogus. The device probably can't support
    anywhere near that many full discharges, and you won't be discharging it
    very deeply anyway. Or so you say. But I don't know how to assess the life
    of the battery at the shallow discharge rates you are talking about.

    Do keep in mind that if you discharge it very deeply even once, it will
    basically be toast.

    It would help if you had some idea of total backup time you expect to need
    over the 5 or more years you want this thing to work. Can you estimate a
    percentage availability over the 5 years?

    Anyway, it seems quite possible that two non-rechargeable D cells will
    last just as long or longer than your 17 mAh cell, and will probably be
    simpler to use. I don't know whether your design can tolerate the
    weight/size of them, though.
    Oh, yes. Duracell batteries will last 5 years on the shelf. I'm not sure
    how storage temperature affects shelf life, but at room temperature, you
    should get 5 years from your Duracell batteries. (and probably Energizers,
    as well).

    Incidentally, high temperatures greatly accelerate the aging of Lithium
    primary cells. I wouldn't be surprised if it does the same thing to
    rechargeable cells, too.

    --Mac
     
  18. You won't see the difference, both solutions will work in the short
    term.
    Yes, good idea of your current requirements are small enough. Although
    you'll want to watch out for contact corrosion. If you are truly after
    a 10 year maintenace free solution I would go for soldered connections
    and not contact connections.
    PICs, but you might be talking say 5uW vs 10uW. It might be half the
    power, but you are still talking the shelf life of the battry in the
    majory of applications. You'd want to have a specialised application to
    warrant the change.

    Dave :)
     
  19. Robert Baer

    Robert Baer Guest

    That sounds like a good solution.
    If you can find a dual schottky in one package, then they will be
    thermally closer together than most mechanical methods if seperate
    packages.
    Possible exception: if both are TO-220 then a thin insulator and
    mounted back-to-back may give better thermal coupling between them.
    Either way, if they track, then the thermal variations will roughly
    cancel out in practice.
     
  20. Future has them for 1.05 in 100's and 80.5 cents in 1K (-S version).

    The -P DIP is ~10% more expensive and not in stock. ;-)

    Best regards,
    Spehro Pefhany
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-