CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

How to survive 500msec without power?

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
djpark



Joined: 02 Mar 2004
Posts: 49

View user's profile Send private message

How to survive 500msec without power?
PostPosted: Mon Aug 02, 2004 10:33 pm     Reply with quote

I have a 12F675 design (1 output and 2 digital input) with 47uF tantalum isolated from the main circuit by a diode. I need to maintain operating for at least 500 msec when the power is lost momentarily.

Code:
+3.7V o-------+---------------
              |
             ---
             \ /
             ---       +------
              |        |
              +--------+ Vdd
              |        |
        47uF ---       |
             ---       |
              |
              |
             ---
             ///


I measured the current draw of the PIC to be 800uA. Is 47uF sufficient to hold for half second? How can I calculate the discharge time before the voltage hit the required minimum? Since the space is premium, it is not an option to add a bigger capacitor.

TIA,

-- dj
bdavis



Joined: 31 May 2004
Posts: 86
Location: Colorado Springs, CO

View user's profile Send private message

PostPosted: Mon Aug 02, 2004 11:20 pm     Reply with quote

I don't remember the formula you are looking for, but this may be of some help. If your PIC is up and running for a very long time, then your capacitor should reach 3.7 volts (should still use a schottky type with lower voltage drop). I can only remember an RC time so, changing your current and voltage to an estimated resistance:

3.7V/800uA=4625 ohms

time = -R * C * ln(1 - (Vt - VMax))

If your Vt = 2 volts and VMax = 3.7 volts
time = 4625 * 47uF * -0.7777 = .169 (169 msec).

I think you need to lower your current on the current design (SLEEP on low voltage detect, and wake from interrupt?) or whatever you can do to lower your current. You are in the ballpark though. Can you use a higher cap with the same diameter? I don't think the above is totally accurate, since current would need to be reduced proportionately as the voltage dropped to keep R in the formula correct. But this is the best I have off the top of my head...

Please post if someone has the real formula Very Happy
newguy



Joined: 24 Jun 2004
Posts: 1907

View user's profile Send private message

PostPosted: Mon Aug 02, 2004 11:22 pm     Reply with quote

Let's see. You'll have 3V on the cap, so the charge (coulombs) stored by it is:

Q = CV = 47e-6F x 3V = 0.000141 C

Without getting into how the current draw by the pic will be affected by the dropping cap voltage as it discharges, if we assume that it continues to draw 800 uA regardless of the cap voltage, then the discharge time is:

t = Q/I = .000141C/800e-6A = 0.17625 seconds.

If you treat the pic as a "resistor" R = V/I = 3V/800e-6A = 3750 ohms. Then that resistance in parallel with the cap gives a time constant tau = 3750 x 47e-6 = 0.17625 seconds. Under this assumption, the cap will completely discharge in 5xtau = 0.88125 seconds.

My gut feeling is that the actual discharge time will likely fall somewhere between these two values, but perhaps closer to the smaller time.

Sorry, but it looks like your 47uF cap is too small. You'd need a cap at least 3x bigger to last 0.5 sec. If you want to try and minimize the voltage droop while power is interrupted, then you'd need something about 10x larger, if not more.

Is there any way you can monitor the supply voltage using the adc, and go into a low power mode if it drops? I know that not too long ago someome posted their method for doing this, but I can't remember offhand what the trick to doing it was. Anyone know the post I'm thinking of?
bdavis



Joined: 31 May 2004
Posts: 86
Location: Colorado Springs, CO

View user's profile Send private message

PostPosted: Mon Aug 02, 2004 11:30 pm     Reply with quote

Oops - I stated I thought your cap should reach 3.7V - sorry, only true if you don't connect the PIC Very Happy With a Schottky diode and the PIC connected, you may end up with 3.3 or 3.4V on the cap. Anyway - you have the basic formulas Very Happy
arunb



Joined: 08 Sep 2003
Posts: 492
Location: India

View user's profile Send private message Send e-mail

RE:
PostPosted: Mon Aug 02, 2004 11:52 pm     Reply with quote

Hi,

You might use a small rechargeable battery instead , like the one found in computers...

thanks
arun
Ttelmah
Guest







Re: RE:
PostPosted: Tue Aug 03, 2004 2:52 am     Reply with quote

arunb wrote:
Hi,

You might use a small rechargeable battery instead , like the one found in computers...

thanks
arun

Realistically, consider the memory backup capacitors, like the Panasonic NF series.
On the capacitor values given, you must remember that to keep the PIC running, it must have it's minimum supply voltage for the required clock speed. You cannot let the supply drop to zero. The speed, and processor have not been given, but assuming it is a typical PIC, the minimum supply will be perhaps 3v. The capacitor, will be charged to perhaps 3.3v (assuming a carefully selected diode), or consider using a FET in place of the diode, whch can give a drop of only about 0.2v. Then the voltage that can be dropped is only 0.3 or 0.5v.
The capacitor needed, is then (assuming the 800uA remains constant);
C = (800E-6*.5)/0.3 = 0.0014F
1400uF...
So something like a 2200uF, at 6.3v, would be the smallest capacitor that can be used. The Panasonic 0.1F NF capacitor, would give perhaps 30 seconds of backup in the same circuit, but is little larger.
If the PIC is a 'low power' version that can operate down to a couple of volts, the capacitor size can fall to perhaps a 500uF. However the 47uF will not be enough.

Best Wishes
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Tue Aug 03, 2004 5:32 am     Reply with quote

Quote:
I need to maintain operating for at least 500 msec when the power is lost momentarily.
Please define 'operating'.Is it allowed for your application to go temporarily in power-down mode during these 500ms? If yes, than your current would drop dramatically and you can use a small capacitor.

Quote:
the space is premium
This is diameter, height or both? The super-capacitors are really great, diameter a bit larger than a 470uF cap but only 25% the height.
djpark



Joined: 02 Mar 2004
Posts: 49

View user's profile Send private message

PostPosted: Tue Aug 03, 2004 9:18 am     Reply with quote

Thanks to everyone for good advice and ideas. I now have quite clear idea how long my app can last without power.

To share with you a little more about the project, I attach 12F675 in the head of a flashlight to control the brightness. Due to the lack of the user interface (no button or anything) other than the power switch, the only way to tell something to PIC is a momentary switch off and on back.

Here is one of the picture. The LED diameter is 8mm and the board is 9mm dia. I have no more than 5mm height available.



I tried to put PIC to sleep using RA change or COMPARATOR and wake up by the same int or wdt, it seems working with 47uF if switched off and on back fast, but not 500 msec even with sleep mode. And also the result is not very correct (sometimes it misses, or may be I need to debounce).

Of course I blame for my lack of PIC programming knowledge handling this type of job first time. So I thought of just keep alive and going through the debouncing the power status.

Is there any such example source available somewhere?

-- dj
smrowell



Joined: 16 Feb 2004
Posts: 3

View user's profile Send private message

Gel Cap
PostPosted: Wed Aug 04, 2004 5:31 pm     Reply with quote

Do a digikey search for 'Gel Cap'. They can be as larger than 1F!
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Thu Aug 05, 2004 6:07 am     Reply with quote

Here is an idea.

I believe what you what to do is put this in a flashlight. The user turns on the flashlight and the light is bright. He turns off and then back on the flashlight to dim it.

Here's my idea if the above it true.

On powerup, check a location in the internal eeprom for a brightness value and set the level based on that. Now to get the brightness level, on powerup read the current level and save it to the eeprom. If the user turns off the light and then back on, it will dim down one more level. Setup a timeout value for say a second or so after powerup. If the timer expires then save the full brightness value back to the eeprom.
djpark



Joined: 02 Mar 2004
Posts: 49

View user's profile Send private message

PostPosted: Thu Aug 05, 2004 7:55 am     Reply with quote

Mark wrote:
Here is an idea.

I believe what you what to do is put this in a flashlight. The user turns on the flashlight and the light is bright. He turns off and then back on the flashlight to dim it.


Yes, indeed it is. Here is the photo of it and you can find more information here http://www.candlepowerforums.com/ubbthreads/showflat.php?Number=623717.



Quote:
Here's my idea if the above it true.

On powerup, check a location in the internal eeprom for a brightness value and set the level based on that. Now to get the brightness level, on powerup read the current level and save it to the eeprom. If the user turns off the light and then back on, it will dim down one more level. Setup a timeout value for say a second or so after powerup. If the timer expires then save the full brightness value back to the eeprom.


You look like having an idea. Will you explain a little more detail?

Currently, the unit you see in the photo in my previous post does not have schottkey and cap. When I see the space left, it looks like only the size of 47uF tantalum can go in.

Due to the lack of the capacitor, I am currently switching the brightness level by reading the last level from eeprom and shift and save new level upon power up. Actually I use only 2 levels now after finding that having too many levels in a small light is not practical.

So it is always starting at the alternate brightness level, but I am trying to make it start at a fixed level as default upon power up and change upon request by switch off and on momentarily.

If it is a bigger light with luxury of some extra space, there is no issue as I can add a button. But there isn't much space left and I can hardly put anything else.

I don't get exactly what you have in mind and can I learn a trick from you? As much as possible, I'd hope to do without adding a cap and diode.

-- dj
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Thu Aug 05, 2004 8:04 am     Reply with quote

Your idea is basically what I am talking about with one big exception. How to make the light start on a particular level each time. My idea is to do exactly what you are doing by changing the startup brightness each time the light is turn on. The big difference is that if the light is on for a given amount of time, then save the "startup" brightness level back to the eeprom. If the user keeps the light on for "this period of time" and then turns the light off, when the light is turn back on it will be say at its full brightness. To dim the light, the user must turn off the light before "this period of time" has expired. When the light is turned on, it will be dimmed.
djpark



Joined: 02 Mar 2004
Posts: 49

View user's profile Send private message

PostPosted: Thu Aug 05, 2004 8:53 am     Reply with quote

The post is removed due to copyright issue. Sorry!

Last edited by djpark on Thu Jun 30, 2005 8:38 am; edited 2 times in total
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Thu Aug 05, 2004 11:16 am     Reply with quote

Okay, here is another idea. Lets say you attach a spring to the bottom of the board. This spring is always in contact with the battery which powers the PIC. When the top of the flashlight is screwed down, it connects the drive voltage for the LED and this signal goes to the PIC to wake it up out of low power mode. Seem doable? Just attach a tapered spring like you find in battery holders (they usually compress flatter since the coil fit inside each other) over the contact that you have now and supply the power to the PIC from the spring.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group