0
\$\begingroup\$

This mainly applies to design of a clock but can be applied to many other circuits. The idea is that a device with PIC microcontroller is usually powered via external DC power supply which obviously passes through a voltage regulator; if this power source is lost, the device should switch to run from a battery power source but suspend most of its operations and enter a "minimum operations mode" having detected loss of main power. Are there any application notes on how to do this for PIC or any other microcontroller?

\$\endgroup\$
1
  • \$\begingroup\$ Any other device on the power supply rail is to be kept unpowered, only the microcontroller must be powered up from battery \$\endgroup\$
    – quantum231
    Nov 4, 2015 at 21:56

1 Answer 1

1
\$\begingroup\$

The standard way to do this is with a 'diode OR' circuit. Connect a diode from the power supply and from the battery, with the cathodes connected together and to your target circuit. As long as the battery voltage is lower than the power supply voltage, the battery will only power the circuit when power is off.

If you need to sense whether power is on, put a resistor divider on the power net, before the diode, and sense the divided voltage with your microcontroller.

If your battery voltage is higher than your supply voltage, or may be, there are more complicated alternatives available; look for "Power switch", "Ideal diode" or "Power OR controller" ICs.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.