32. Automatic backup supply

An electronic device operates from a main supply MAIN_IN = 5 V or a backup battery BACKUP_IN = 4.2 V.

Using two diodes, design an automatic power-selection circuit for the provided R_LOAD = 1 kΩ.

  • The main supply must power the load when available.
  • The backup battery must automatically power the load when the main supply is unavailable.
  • Prevent reverse current into either supply.

Example test cases:

MAIN_INBACKUP_INExpected VOUT
5 V4.2 V4–5 V
0 V4.2 V3.2–4.2 V
0 V0 Vā‰ˆ0 V