detect loss of power quick ques

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?

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

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

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.

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. :wink:

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

So who gets to clean up the mess after the power down.

Oops, string typo :blush: modified message :wink:

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

winner10920:
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.

winner10920:
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.

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

winner10920:
the 10ma per pin is to saturate my transistors

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

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.

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.

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?

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

winner10920:
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.

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

winner10920:
Unfortunately that 12v is quickly killed by just about everything else

That's why you need a diode before the capacitor, so that when the 12v supply is removed, the capacitor only powers the Arduino, not the other stuff you are running from 12v.

winner10920:
That stuff is all 5v run, like the lcd backlight and bluetooth etc

Running the backlight from 5v is a waste of charge in the capacitor and heat in the regulator. I suggest you run it from 12v with an appropriate series resistor.

I cant run the backlight separate as it is broight off the 5v on the lcd board itself, only gives u a line to trigger it on,
And thx fir tge suggestion ill prob get a few if those

Would this be usable as an smd similiar that would not get hot @ 1A?
its the part number RSR025P03TL

winner10920:
its the part number RSR025P03TL

Check the data sheet.
The Rdson is 98 mOhms at 10V gate. You're probably going to drive it at 4.5V gate, and get a higher Rdson -- up to 160 mOhms.
So, at 1A, that's 0.16 Watts. Multiply by 125 C/W, and you get a rise of about 20 C (36 F) above ambient.
Btw: this is a P-channel MOSFET, not an N-channel -- is that what you want?

No, I realized that afterwards
all the mosfets I see say rds at 10v, why not give the one for 5v if its logic level?