I want to make a circuit where the power to mcu switches from mains transformer to dc battery when when mains power is not available.

The basic concept is to use a transistor to stay open circuit to keep the battery from supplying the mcu while the mains transformer is active.

Once mains power goes out it should make the transistor conductive and close the circuit with battery.

In a nutshell when mains power is on transistor is off and vice versa

A complimentary congiguration with pnp would have been ideal but I'm limited to using bc548 atm

Please guide me to the right direction


1 Answer 1



simulate this circuit – Schematic created using CircuitLab

Figure 1. (a) The diode version. (b) The BC548 version, if that's all you've got.

Either of these solutions should work if if \$ DC_{MAINS+} > V_{BAT} \$.

  • \$\begingroup\$ what the hell! why didn't (a) cross my mind -_- yes DC mains + is almost double of VBat so (a) should work fine I suppose, what is the technical term for design (a) ? \$\endgroup\$
    – Allahjane
    Jul 12, 2016 at 18:51
  • \$\begingroup\$ No proper name as far as I know. It's similar to a diode OR gate for simple digital logic. "Dual power input with anti-backfeed protection"? \$\endgroup\$
    – Transistor
    Jul 12, 2016 at 18:56

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.