Using the diode method for switching from the higher voltage mains DC source to the batteries, you can detect when the hard connection has been disconnected because there will be a drop in power on your power source to the battery voltage.
I don't know what microcontroller you are using, but generally a uC can run on sleep mode just maintaining an xtal clock for a very long time. Some could do it for years on a couple AA's.
DS1307 is a 5V part only. Keep that in mind if you are running a 3.3V uC.

Reply With Quote