PDA

View Full Version : PIC power backup with "super capacitor"



flotulopex
- 24th January 2007, 11:40
Hello,

I need to make a power backup for a PIC.

As it is a mains's frequency driven clock and thus powered by the mains too. In case of power loss, I want to make the PIC go on by itself on a backup power source and keep on counting "time" until mains power comes back again.

The anything it will do during it's backup mode will be to keep the PIC essential function "alive" to count interrupts. Any other display or buzzer will be shut off.

I think I can use a 5,5V super capacitor (to keep it as small as possible).

Since I'm not an electronician, I don't really know what capacity I should use if I want to make sure my PIC will stay running for, lets say, 2 hours (never seen a son long power outage in my country... should be the worst case).

I have found a datasheet about one of these caps and I can choose between 6 capacities.

1) Witch one shall I take?

2) I've read my 16F88 ds about low power consumption. These are "physical" tips. What about software? What is the best way to program my PIC this way?

sayzer
- 24th January 2007, 12:18
1. Of course, the larger the capacity, the longer the duration is. But you come across with the physical size of the cap. I would pick DB-5R5D105 from your list.

2. Have a serial diode to your PIC power line and put the cap after diode. You may have an input pin to detect the power loss before the diode, and start your power saving mode immediately WHILE the cap is still powering your PIC.

This is my idea in theory.

flotulopex
- 24th January 2007, 13:25
Thanks Sayzer,

Am I right to calculate the capacitor's capacity like this (sorry but I don' t know the english technical names):

Assuming a very bad case where my PIC consumes 1mA and I would like my PIC to stay powered 2 hours, it would give this:
Q(cap load) = I(amps) x t(seconds)
this would give: 1mA x 7200seconds = 7,2C(Coulomb - capacity)

Then, to find out the cap's capacity, I would calculate the time like this:
C(Capacity) = Q(cap load) / U(Volt)
this would give: 7,2C / 5V = 1,44F

This is theory but please let me know if I'm wrong and if yes, where.

What about the low power programming?

sayzer
- 24th January 2007, 13:46
flotulopex,

I have no idea about that formula and the calculation.

I am sure someone will jump in and help you out.

But, why don't you try it in a real circuit?

So simple to test in a real application. With your own eyes, you can see how long it will last.

------------------------

keithdoxey
- 24th January 2007, 14:55
Working from memory here because it is a long time since I went to college!!!

Isnt the charge/discharge curve of a capacitor non linear an also as the cap discharges the voltage drops so you will hit brownout long before the cap is discharged. Might be better just with a lithium or rechargeable battery as the backup supply.

dhouston
- 24th January 2007, 15:04
Super caps are frequently used with RTC chips so you can find a lot of online data about how to select the right size. Maxim has an online calculator that you can probably use.http://www.maxim-ic.com/tools/calculators/index.cfm/calc_id/supercap

paul borgmeier
- 24th January 2007, 17:53
In simplified terms, the governing equation for a “perfect” capacitor is:
I = C dV/dt
which states that the current is equal to the capacitance times the change in voltage with respect to time. In layman's terms, you can get a first approximation like this:
I = C (Vinitial – Vfinal)/time
Example, If:
C = .47F
Vfinal = 5.0 Volts
Vfinal = 3.3 Volts
time = 7200 seconds
the capacitor would be able to supply
I = .47 (5.0-3.3)/7200 = .000111 amps = .11mA during that time frame (the voltage would change from 5.0 V to 3.3 V after 7200 seconds while supplying the shown current)

However, the equation works both ways – if your circuit draws more current, for example .001 amps, you can determine how long you can keep your capacitor voltage at 3.3 or above like this
I = 0.001 = (5.0-3.3)/time
solving for time gives time = 1700 seconds (about 28 minutes).

I picked a lower limit of 3.3 V – you need to determine this for your setup. Also, with the nanoWatt controllers, you should be able to get your current consumption much lower, like several uA or less, which means you could have a backup for days.

Last, no system is perfect – there are leaks and losses and other things going on that you need to be aware of – design your power backup to last longer than you really need it – and test it!

Luciano
- 24th January 2007, 18:13
Hi,

See this link:
http://www.qsl.net/zl1bpu/MICRO/CLOCK/index.htm

From the above link:
When the AC supply fails, D3 conducts, D4 is reverse biassed, and the
clock continues to operate from the battery with no loss of time.
However, since R2 is no longer able to keep micro input PD2 (pin 6) high,
the micro detects power failure and displays a "BATT" message. The battery
can be a small alkaline 9V type if power failures are rare, and will last
normal shelf life. If power failures are frequent or the clock is used as a
portable time source, a 6-cell 500mAH or better NiCd or NiMH battery pack is
recommended. R1 can be added to slowly charge the battery from the AC supply.

Schematic:
http://www.qsl.net/zl1bpu/MICRO/CLOCK/CLOCK2.GIF

* * * *

Best regards,

Luciano

sayzer
- 24th January 2007, 18:36
...

Schematic:
http://www.qsl.net/zl1bpu/MICRO/CLOCK/CLOCK2.GIF
...

Luciano,

9V battery in that schematic is indeed a good idea.

Thanks.

flotulopex
- 24th January 2007, 21:11
Well,

So many ideas..... :-)

I think, I'm going to make it the simple way first.

I found a super cap on an old PC motherboard so give me a few hours and I'll come back with some news.

Thanks to everybody for all your information. Really Great ;-)

skimask
- 24th January 2007, 23:51
Well,

So many ideas..... :-)

I think, I'm going to make it the simple way first.

I found a super cap on an old PC motherboard so give me a few hours and I'll come back with some news.

Thanks to everybody for all your information. Really Great ;-)

By the time you get done messing with a super-cap, you might find (as I did) that a diode-protected lithium coin cell might do exactly what you wanted the super-cap to do, easier and possibly cheaper (with an occassional replacement). I just wish I could find NiMH coin cells in similar size to the lithium coin cells...for cheap anyways...