orderly shutdown of embedded server on power loss

Thread Starter

halley

Joined Dec 27, 2008
11
Thinking about putting an embedded server (Raspberry Pi based) into the trunk or dash of a car.

Regulating 12VDC down to 5V is not difficult, and the device will automatically go through its 10~30sec bootup sequence just fine. Most people would have no problem just killing the power and letting the device halt, but that's not a best practice. It takes up to 20sec for the system to shut down orderly, once commanded to do so. This ensures any files on the SD card have been closed properly.

I figure I can make some kind of power cache from a small inline battery or ultracapacitor, but I need to (1) avoid interruption of power to the main unit, while (2) giving a TTL signal to the GPIO pins that reflects whether there is power available or not. A software daemon or ISR can then watch the signal change and invoke the orderly shutdown.

What's the best kind of circuit to perform this?
 

kubeek

Joined Sep 20, 2005
5,795
This should work. You can use for example LM393 for the comparator.
Note the backup battery needs to have lower voltage than the main supply.
 

Attachments

Last edited:

Thread Starter

halley

Joined Dec 27, 2008
11
Thanks for your help, kubeek! Really appreciate it.

I dug through my tackle box and I found a couple DIP LM393s in there... don't think I've had occasion to use them yet.
 
Top