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

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.

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.

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.

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?

 

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.