I have created a circuit as a hobby project for my router. With this Project I want to power my two 9V routers in case of a Power Failure.

Two routers combine uses around 600mA.

I’m using two 18650 batteries in series as backup power and 2A 9V SMPS power supply to power two routers.

Also I’m using Atmega328P chip to monitor battery voltage and ACS712 Current Sensor to keep track battery capacity.

Problem I’m having with this circuit is that when power goes out MOSFET getting very hot and routers getting reboot. After few seconds routers get power and works normally.

Also if I pull the wall power supply from circuit to stage a power failure, circuit switches to battery instantly and MOSFET doesn’t get hot.

MOSFET I’m using in this circuit is IRF9530.

MOSFET getting hot and not switching to battery instantly because when a power failure happen power adapter doesn’t go to 0V instantly?

Any help to identify and solve this problem appreciated.

enter image description here

  • 1
    \$\begingroup\$ Why not have the ATMEGA328P perform the MOSFET switching and then additionally have another analog channel monitor the 9V adapter voltage. This way the FET can switch fully on/off and not stay in a half on mode creating a lot of heat. You would likely need to add an additional NPN transistor into the MOSFET gate circuit to translate the MCU GPIO pin signal swing to the higher range needed for the MOSFET. \$\endgroup\$ Sep 10, 2016 at 19:44
  • 1
    \$\begingroup\$ A couple of big capacitors, say 1000uF (one on the 9V output, the other at the input to the 5V buck would help to keep the power alive until the switchover kicks in. Also you need to sort out a positive action switching circuit for the 9V power failing \$\endgroup\$ Sep 10, 2016 at 19:44
  • \$\begingroup\$ Thanks guys for the input. I'm already monitoring voltages from battery, wall adapter and output. so I'm going to see how it works when switching MOSFET with MCU. originally i thought MCU will be slower to determine voltage drop and controll MOSFET on/off. \$\endgroup\$
    – lasita
    Sep 11, 2016 at 4:00

1 Answer 1


I think you've solved it yourself - your 9V supply falls to zero too slowly. In most DC sources, a large capacitor appears at its output, which may discharge too slowly as it falls through the critical region of +8 to +6v, where the MOSfet is partially on.
Most power supplies are designed to source current, and refuse to sink current. If your wall-powered 9v supply does so without complaint, then perhaps this simplification could work:


simulate this circuit – Schematic created using CircuitLab However, your current monitor cannot discriminate between wall_pwr and Vbackup power sources. And it is not a robust solution.
An alternative is to reduce your 10K to something like 200 ohms (1W) to see if discharge can be speeded up.

  • \$\begingroup\$ Wouldn't a Schottky diode, with its lower forward voltage drop, be a better choice than a 1N4001? \$\endgroup\$ Sep 10, 2016 at 20:39
  • \$\begingroup\$ @AndrewMorton - yes, Schottky would be better. Better still would be the PmosFET, positively switched by the microcontroller, as Michael Karas has suggested. Since voltage here is being monitored by that microcontroller, it should be able to see when Vwall_pwr falls from 9v to +8.4v \$\endgroup\$
    – glen_geek
    Sep 10, 2016 at 23:37
  • \$\begingroup\$ @glen_geek Thanks. I'm going to see how it works when switching is done by MCU. \$\endgroup\$
    – lasita
    Sep 11, 2016 at 4:02

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.