Providing short term power to Arduino once main power source is turned off.

I am planning a project that will be standalone Arduino (just the bare bones atmega, crystal etc). I plan on powering it from the vehicle 12V. I will also be using a 7805/2940 to regulate the 12V down to 5 for the chip. What I would like to do is this:

12V vehicle to: - Regulated to 5V for arduino. - Arduino controls MOSFET (IRF 530’s) to power LEDs from vehicle 12V

What I also would like to do is possibly have a capacitor inline (in parallel) to provide some residual power to both the arduino and LEDs to allow for a graceful ramp down (as opposed to just turning off). The arduino would be used to simply control PWM values (0-255) to a MOSFET that would control the LED brightness. However, both the Arduino and LEDs would need some sort of residual ‘backup’ power for a few seconds after the car ignition is turned off.

Is it possible to do this by adding a capacitor inline (in parallel) to store some power? I could then do something to detect when the main 12 has dropped to 0 and then trigger a shutdown while the cap provides power to both the Arduino and the LEDs? I am thinking like 3 seconds of residual juice here. What sort of circuit would satisfy this?

Edit: current draw would be less than 300 mA

You keep saying in line, that implies a series connection, you want a parallel capacitor and diode to stop it discharging back through the turned off power circuit. You need to know the current draw before you can calculate the capacitor size.

First issue is your choice of a IRF530 mosfet. As this is not a LOGIC LEVEL mosfet the +5vdc output of a arduino digital output pin will not fully turn on the transistor. Find a suitable logic level mosfet such as this:

http://www.sparkfun.com/products/10213

Lefty

current draw would be less than 300 mA

Then I don't think it is on. At 300mA for 3 seconds you need 0.18F, and that is the whole charge in the capacitor. You want more than this because that is when the voltage is zero so double it and you get to 0.4F. I know you can get super caps but I don't think you can get the current density out of them to sustain 300mA. You would be much better off with a small rechargeable battery that you float charge and then turn off the whole thing in software / hardware after you detect the main power is gone.

Thx for the tips guys... I think I will forego this option and not worry about trying to maintain power as the effort does not justify the gain.

What if you power the LEDs from the raw 12v, that way they don't need to be powered by the cap. Then you just have to deal with the processor.

Rugged Circuits has an example circuit to do this. http://ruggedcircuits.com/html/circuit__13.html.


Rob

@Graynomad, thanks for the link. I'll check it out. My post may not have been clear. The LEDs will be powered from the 12 source direclty, but the Arduino will use a PWM pin to ramp the LED up from 0 to 255 via a MOSFET.

The LEDs will be powered from the 12 source direclty, but the Arduino will use a PWM pin to ramp the LED up from 0 to 255 via a MOSFET.

In that case the current drawn from the cap/battery is just that of the standalone Arduino, well under 10mA I think.


Rob

Graynomad:

The LEDs will be powered from the 12 source direclty, but the Arduino will use a PWM pin to ramp the LED up from 0 to 255 via a MOSFET.

In that case the current drawn from the cap/battery is just that of the standalone Arduino, well under 10mA I think.

Is the 12v power source still there though?

Not sure about your exact setup, but my vehicle has an "always on" circuit, and an "ignition switched" circuit.

Couldn't you power your board from the always-on circuit, but detect if the switched circuit goes off and then shut yourself down whenever you're done?

Sorry for the confusion folks... What I was originally hoping for was this:

12V car -->> |->>12V backup pwr (using some circuit [give 5 seconds pwr after car is powered off]) |->>> regulated to 5V for Arduino to power it (and keep it running for 5 secs) |->>> 12V to LEDs (ramp up controlled by arduino via MOSFET and also backed up for 5 secs)

However, based on some enlightenment from above, the gain is not worth the effort to keep the Ard + LEDs on for 5 seconds after power is off. The original goal was to allow time for the LEDs to 'ramp down' as opposed to just go off.

For example, here's the pinout from a Renault stereo connector. Specifics will of course vary, but principle should apply.

P1 is a +12V ignition wire (switched on and off with the ignition) P3 is a +12V battery wire (always on)

@Cylindric - good pts re ig and constant. This would solve my problem. However, I don't want to have the arduino being powered 24x7 - even though the current draw would be minimal. I also don't want to source / run a dedicated line for 12V constant all the way to the tails.

@deejayspinz The problem with your drawing is that you are taking the LED power from the "backup power", if you take it from the raw 12v you don't have the huge current draw on the backup.

12V battery |->> 12V ign | |->>12V backup pwr (using some circuit [give 5 seconds pwr after car is powered off]) | | |->>> regulated to 5V for Arduino to power it (and keep it running for 5 secs) |->>12V to LEDs (ramp up controlled by arduino via MOSFET and also backed up for 5 secs)

However, I don't want to have the arduino being powered 24x7 - even though the current draw would be minimal. I also don't want to source / run a dedicated line for 12V constant

That changes things then, the above does require a second 12v wire.

I think you're right, this is too much trouble for some fading LEDs :)


Rob

Graynomad: @deejayspinz The problem with your drawing is that you are taking the LED power from the "backup power", if you take it from the raw 12v you don't have the huge current draw on the backup.

Nope. It would have to be this way as when the car turns off there would be no 12V to the tails. For the original idea, both the Arduino and LED strip would require the backup power or it does not work. There would not be much use providing backup pwr to the Arduino only if the 12 source direct to the LEDs is not there. See what I mean?

Yes I get it, that's why you would need two 12v wires, one switched (for the Arduino) and one not switched (for the LEDs). But if you can't run the extra wire then all bets are off and you're back to supplying 300mA from the backup which is the original problem.


Rob