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.

The problem with just switching from 12V to 9V is that I still have no way of turning off the 9V supply. So after the microprocessor is ready to shut down it still gets 9V and the same does the GPS, compass, transducer etc..

You could put a normally open relay in line with the 9v battery. It can be trickle charged by the 12v battery with a diode and resistor. Under normal operation it is kept closed by an output pin and can be opened when the micro is ready.

How about a separate power regulator/supply connected straight from the 12V battery's plus, for "other modules" (not FEZ) ? You only need common ground. This way, the FEZ will be powered as in your schematic and you do not need the 9V battery if, as you stated, the 4700uF capacitor is enough for a clean shutdown. For the presence of the 12V battery a resistive divisor is enough and if you have a spare analog input you can also monitor the voltage.

My Panda is mounted on a baseboard (the Panda Tinkerer kit) and I have a lot of stuff going on there already and the Xbee is integrated so that can’t be removed anyway.

And the use of an analogue port to monitor the power is a bad idea in my system as one have to poll the stat instead of using a digital interrupt port.

You're working within the confines of the board. Cut the traces and that'll give you options to power component through other means...

The UPS system is not critical to my system as I can always add a ‘Go offline’ button or something. No I’m not going to cut traces.

I would try to isolate the FEZ's power line (cut the trace). If you want an interrupt when power is gone you could use a NPN as was suggested in the previous posts. 7805 is not a good ideea, it will consume power trying to provide +5V and it must have a load at the output to work good so more power loss.