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

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.

  1. 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?

  1. 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?

  2. 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.

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

  2. 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.

Reply to
Kevin
Loading thread data ...

voltage)

VDD

to

like

leakage

the

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 :)

Reply to
David L. Jones

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/
Reply to
mike

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/
Reply to
mike

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.
Reply to
Robert Baer

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?).

Reply to
Kevin

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.

Reply to
Kevin

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

--
"it's the network..."                          "The Journey is the reward"
speff@interlog.com             Info for manufacturers: http://www.trexon.com
Embedded software/hardware/analog  Info for designers:  http://www.speff.com
Reply to
Spehro Pefhany

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.

Reply to
Kevin

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).

Reply to
Kevin

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

Reply to
Tam/WB2TT

On Mon, 17 Jan 2005 00:00:08 -0400, Kevin wroth:

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

Reply to
James Meyer

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.

Reply to
Kryten

reduce

circuitry

OK, we now know several things:

1) You PIC will draw almost nothing. If you were using batteries then they will last effectively the shelf life. 2) The rest of your circuit will most likely draw around 10mA or less given that you plan on powering it from the PIC output (Good idea to save power).

In this case there is no need for a rechargable battery solution. It adds cost, complexity, and potential additional unreliability.

Stick with either a completely battery powered solution (if your total circuit draw is in the order of microamps) or mains power with battery backup via series diodes as others have mentioned. In the absence of mains (not very often) the battery will take over. Even at 10mA or so very intermittent current draw, your batteries will last the shelf life.

have

Yep, no problem.

be

better).

Primary lithium batteries will give you 10 years life no problems. If you use a rechargable solution (which is not needed given the tiny current draw) there is the chance that the charger and/or battery will fail and you'll be left without a backup. I don't know too many rechargable solutions which are good for 10 years service life. Recharable is a poor solution for no upside benefit in this case. Primary lithium batteries will be much more reliable.

batteries

years.

Lithium

You'll get 5 years shelf life out of a good quality Alkaline but I'd still go for lithium just in case. You can get 3V primary lithium D size cells (with solder tabs) from specialised battery suppliers. Alternatively you could use the consumer grade 1.5 "lithiums", but they aren't as good as a proper 3V lithium primary cell.

Dave :)

Reply to
David L. Jones

I've been working on a PIC design that uses an AA-sized lithium-ion rechargable cell. From what I've gathered, the specs indicate a cycle life of 1000 and cell life at 2 years, regardless of use. The concensus is that storing Li-ion cells in a cool to cold location at

40% charge is best for longetivity.

-- "Pleasantries, aren't they those little apple-filled thingies?" MCJ

200310
Reply to
Mark Jones

Hmmm... 10mS is not a long time at all... and the EEPROM has a

1-million write cycle life... is that not good enough? If not, cycle through the EEPROM bytes as they are being written and it could last for hundreds of millions of cycles.

Probably for quite awhile, but don't forget about internal resistances. The cap would probably go dead on its own accord long before a 99.2% sleeping PIC would kill it. You can try some supercaps cheap from

formatting link
though.

Reply to
Mark Jones

will

tiny

will

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.

power

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 :)

Reply to
David L. Jones

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.

Reply to
Kevin

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.

Reply to
Kevin

Yep, that is what I did for a PalmVx power unit. The Palm has a 4.2V Li-Ion that I charged using an LM317L at 4.15V.

Behind this was an BS170. Source and drain were swapped compared to normal use of the mosfet to prevent a discharge current due to the internal diode. I did not measured the leakage though. There might be better small fets to choose from (pointers anyone?). From what I read in datasheets of bigger fets, this goes up with lower Vds...

All in all it worked fine with a minimal amount of components. Size

15*5mm, small enough to be build into the clip-on GPS unit it was used for.

One other thing is to limit the maximum charge current. I did that simply by putting a resistor in series with the 12V input of the LM317L.

Joop

Reply to
Joop

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.