Let's Make Robots!

Microcontroller UPS

I have the following problem.
I’m rebuilding my SEA RENDERING http://letsmakerobots.com/node/21098 project from two Arduinos to one FEZ Panda running .NET
In my original setup I had one switch for the main power and one for stopping the logging. The reason for this is that if one shuts down power when the system is writing to the SD card, you might end up with a corrupt log file or in the worst case a completely ruined SD card. In an attempt to remedy this I made the following circuit that worked great on the breadboard.

The thought behind the circuit is that when the 12V is removed the voltage regulator goes down giving me an interrupt on pin 5. The system flushes all data to SD and unmount it. The charge in the 4700uF capacitor gave me enough time to do that.
According to Murphy’s law “If a prototype functions perfectly, subsequent production units will malfunction.“ and that kicks in here.
The problem (I think) is that the prototyping was done on a micro SD with nothing else attached. In my boat I have a normal size SD and GPS, digital compass etc. attached. So it drains the capacitor to fast.

So this I what I want to do.
When the main switch is turned off the volt regulator gives me a signal. Then I would like to pull a 9V battery online and keep it supplying power until I pull a digital pin low and turn everything off.
So, the great minds of LMR, -is this possible? I think resorting to a relay will drain the capacitor to fast so there must be some other way. 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

I’m sorry, but I still don’t see it. When I power off the battery will be removed from the circuit.
I have added the switch for clarity

But you said the capacitor supplied enough current to finish a write to the micro sd. But when you mounted it in the unit there was a higher power consumption due to the gps etc. The transistors will use less current from the capacitor to stay on compared to the consumption of the whole circuit. You are still feeding the circuit from the battery until the capacitor discharges through the transistor. This current is not feeding the whole circuit however only the base current to hold the transistor on.Seeing as you are switching the ground rail you could ditch the second transistor and switch the ground rail with the first transistor. Even less current required from the capacitor.

Am I misunderstanding you in that the 9 volt battery is required in the original design? It's just that you didn't mention it until you found out the capacitor had not enough current to supply the complete circuit in the prototype.

follow my thinking. Because I left out an important point. Your on/off switch must switch the base of the transistor/s. If you stick the switch between the positive side of your battery and the diode the capacitor will slowly discharge through the base. I tested it with a 3300uf capacitor just using a 5ma led load and the circuit was powered for at least a minute compared to barely a second if the cap supplied the led as well. You are still using the battery to power any load connected until the cap has discharged throught the base-emitter circuit.

This definately will work. If you still don't follow me I am happy to try to explain further.

If you just want to shut down properly, why do not try procedural way instead of engineering? I'm not sure about your limitations, but I'd suggest to use two extra pins: first for "shutdown" button which when pressed makes the program to unmount SD or whatever else you may need in future. After shutdown sequence complete, it would use other pin to light up "safe to power off" signal LED. Then you turn off main power switch.

How about shutting down through software? Use a push button on an input to tell the system to finish up it`s business. When ready an output triggers a N.C. relay to open thereby removing power to the system. This gives you complete control of how it shuts down and you can easily add functionality into the shut down sequence when ever you want without worrying about timing.

A 2nd relay to latch the power button and prevent the system from starting up again after shut down would also be needed though.

I'm sorry but I can't see your picture...

Odd, how about this?

Nope...

Does anyone else see the picture?

1 ) how about a voltage regulator with a shutdown function (like this http://ww1.microchip.com/downloads/en/DeviceDoc/22200b.pdf)  -- the shutdown current is .01-.1 uA so you can size a cap to time the delay between disconnecting power to shutdown.  (This is similiar to merser's suggestions)

2) Make a solid state switch with a built in time delay. small pic, push button, mosfet similar to this: http://www.pololu.com/catalog/product/750

3) Alternately can you put a diode between the cap and the gps so that the cap is not powering the GPS?

4) Super cap?

 

The problem or need is:

>So this I what I want to do.
>When the main switch is turned off the volt regulator gives me a signal. Then I would like to pull a 9V battery online and keep it >supplying power until I pull a digital pin low and turn everything off.
>So, the great minds of LMR, -is this possible? I think resorting to a relay will drain the capacitor to fast so there must be some >other way.

Possible solution:

You could use the main switch to switch between the 12v and 9v. I'd put some caps in to filter the spikes and dips in the power rail though.  I'm not really sure what all you are powering with the 12v and what code you are using to do shutdown, so I'm making the best possible guess.