Pages: [1] 2 3   Go Down
Author Topic: detect loss of power quick ques  (Read 1096 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Edison Member
*
Karma: 4
Posts: 1729
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Would it work to detect a loss of my external 5v power supply to simply have a diode going to a large capacitor, then read before the diode to see if the supply is there? I have these nice 5.5v 1F cap that fits nicely under my board, how much time would I have to do anything?  I have like 450ma load which id like to display a goodbye messgae on a tft lcd and log the off onto an sd card, would I have enough time to do this? Or is this idea shot because of the .7v drop of the diode?
Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 170
Posts: 12465
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Some people add a battery backup and read its voltage with a voltage divider (2x1M) with analogRead() and if the power drops to a certain limit they shit gracefully down.
shut gracefully down.

-- update --  smiley-red smiley-red smiley-red
« Last Edit: March 04, 2012, 04:54:35 pm by robtillaart » Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Offline Offline
Edison Member
*
Karma: 4
Posts: 1729
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

This is for a car and I don't want to have an extra battery, its powered when the car is running and when I turn the car off I want to be able to register that
id just check before my 5v supply but I don't feel like getting a more expensive capacitor
Logged

United Kingdom
Offline Offline
Tesla Member
***
Karma: 220
Posts: 6587
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

If it's for a car then presumably you are starting with around 12v and then using a 5v regulator. It's better to put the diode (with a small series resistor to limit the charging current) and capacitor before the regulator, rather than a capacitor after the regulator. Using a low dropout regulator, the capacitor can discharge to around 5.5v before the regulator output falls below 5v. To detect loss of power, you can use a voltage divider to monitor either the 12v input or the voltage across the capacitor.
Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 331
Posts: 16523
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
and if the power drops to a certain limit they shit gracefully down.

So who gets to clean up the mess after the power down.  smiley-wink
Logged

Offline Offline
God Member
*****
Karma: 3
Posts: 813
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I Farad means 1 Columb per volt, which means one Ampere-second per volt. Thus, you will get the 5->4 volt drop through 450 milliAmperes in 2 seconds -- should be plenty of time.
You can use a Schottky diode with about 0.35V drop, instead of the typical 1N4001 drop of 0.8V. The Arduino should still run fine on 4.7V.
Btw: how can you draw 450 mA through the Arduino? Do you use the 5V rail directly? Because there's not enough juice in the digital output pins to draw that much :-)
Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 170
Posts: 12465
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
So who gets to clean up the mess after the power down. 
Oops, string typo  smiley-red modified message smiley-wink
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Offline Offline
Edison Member
*
Karma: 4
Posts: 1729
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yeah mostly the 5v rails I mean, bluetooth, wireless nrf24l01, sd card, tft lcd, rtc, 8 outputs doing around 10ma ea,
450 is a peak number, usually around 350-400
I might try that other diode, being a 5v cap is alot cheaper than 16v
Logged

United Kingdom
Offline Offline
Tesla Member
***
Karma: 220
Posts: 6587
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Yeah mostly the 5v rails I mean, bluetooth, wireless nrf24l01, sd card, tft lcd, rtc, 8 outputs doing around 10ma ea,
450 is a peak number, usually around 350-400

You might consider whether you can reduce the current draw from +5v by driving some things that are switched by transistors from +12v instead.

I might try that other diode, being a 5v cap is alot cheaper than 16v

If you put the capacitor before the regulator, then although you need a capacitor with a higher voltage rating, it can be a much lower value, because the voltage across it can drop a lot more. For example, 0.1F on the +5v line at 400mA load will lose 0.4v in 0.1 second. A capacitor on the 12v input can afford to drop around 7V, so you only need a capacitor of about 6800uF to power the system for the same amount of time.
Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Offline Offline
Edison Member
*
Karma: 4
Posts: 1729
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Unfortunately that 12v is quickly killed by just about everything else
That stuff is all 5v run, like the lcd backlight and bluetooth etc, the nrf24l01 is 3.3v but that's no matter
everything I control is 12v and the 10ma per pin is to saturate my transistors
would running it at 4.7 16Mhz affect reliability
Logged

Offline Offline
God Member
*****
Karma: 3
Posts: 813
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

the 10ma per pin is to saturate my transistors

So the simplest thing to do is change to use MOSFET transistors!
Logged

Offline Offline
Edison Member
*
Karma: 22
Posts: 1164
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
This is for a car and I don't want to have an extra battery, its powered when the car is running and when I turn the car off I want to be able to register that...
In a car, you always have 12V available, and there is usually a clock running, remote door locks need constant power available etc.

Most car stereos have an always-on 12V signal as well as ignition-switched power.   The always-on power runs the clock, keeps the memory powered-up so you don't loose your favorite stations, and maybe to retain a security code.

Quote
I have these nice 5.5v 1F cap that fits nicely under my board, how much time would I have to do anything?  I have like 450ma load
I don't know, but I think there's something  "fishy" about those small 1F capacitors.... They are designed to maintain RAM memory and I have a feeling that those things can't put-out 450mA.
Logged

Offline Offline
Edison Member
*
Karma: 4
Posts: 1729
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I know,  I mean ignition 12v, which is what my arduino is running on
as for mosfets im terrible at picking them out, any good suggestions for around 1A that doesn't create noticeable heat?
Logged

Offline Offline
Edison Member
*
Karma: 4
Posts: 1729
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Well I haven't even attached my shield to my mega, and with only a single atmega328 and msqeq7, and 2 leds with 1k resistors and that 1F cap gives me about 2 minutes before the brownout detector shuts down the 328, however it drops below 4v fairly quick, maybe 15 seconds
it takes about 15 seconds to fully charge the cap and after that I level off at around 33ma load,
at this rate I doubt ill have more than a second or two with my full load on, which hopefully if I shutdown the screen, stop bluetooth, stop wireless,  kill my outputs, stop the slave 328, ill have enough time to write what I want on the sd card without corruption
Logged

Offline Offline
God Member
*****
Karma: 3
Posts: 813
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

as for mosfets im terrible at picking them out, any good suggestions for around 1A that doesn't create noticeable heat?

Parametric search on digikey.com is your friend!

Here's how I do it:
Keyword "mosfet"
Click "FETs - single"
Parametric select 60V and higher, current 2A and higher, Vgs 2.8V or lower, through-hole, and in stock.
Click sort by price - quantity 10.
The winner is NTD5867NL-1G at $5.60 for 10.
http://search.digikey.com/us/en/products/NTD5867NL-1G/NTD5867NL-1GOS-ND/2401422

0.05 Ohms at 4.5V, which is the control voltage out of an Arduino.
At one ampere, I-squared-R says 50 milliWatts, which you'll have a hard time even feeling with your fingers :-)
http://www.onsemi.com/pub_link/Collateral/NTD5867NL-D.PDF
Logged

Pages: [1] 2 3   Go Up
Jump to: