I'm interested in making a battery backup circuit that is operated by a microcontrollersuch that when the main battery gets below a certain voltage, the system switches to the backup battery.

Currently I am using relay to switch between the normal battery and the backup battery (battleswitch from dimension engineering and using servo pulses to turn it on and off) however this requires about a 1000uf tank capacitor on my vin for 5v regulator as the relay has a switching time and this doesn't strike me as the ideal way of doing things.

Is there a way I can accomplish this with transistors/fets/flip flops?

The switching time has to be almost instantaneous (<50ms?) as its powering a microcontroller so supply MUST NOT ever be interupted and a capacitor is used if required to ensure this. But the switching does not have to be done immediately when the power of the normal battery drops beyond a certain threshold as I have a margin (about 6v on the normal battery as my regulator requires a 1 volt difference between VIN and VOUT). Both batteries are 7.2 volt Nimh with a capacity of 2800mah.

Further, would latching be beneficial here?

enter image description here

  • 1
    \$\begingroup\$ You could make a "make before break" setup, so you wouldn't need a capacitor bank. Then diodes do prevent one battery to feeding the other while you switch the "used" one off. \$\endgroup\$
    – Wesley Lee
    Commented Nov 24, 2016 at 22:59
  • 1
    \$\begingroup\$ Is there a reason you want to make the Arduino responsible for this, instead of having a dedicated backup battery management circuit? \$\endgroup\$ Commented Nov 24, 2016 at 23:18
  • \$\begingroup\$ yes because my arduino is already sensing the voltage and doing other low level power related tasks and outputting the feedback to an lcd. so i'd like to keep it all in the rhelm of arduino. i'm also curious about the circuit that would pull this off as I learn more by examples \$\endgroup\$
    – Alex
    Commented Nov 24, 2016 at 23:27
  • 3
    \$\begingroup\$ Possible duplicate of What kind of power management circuit do I need to embedded a rechargeable battery in my electronics project? \$\endgroup\$ Commented Nov 25, 2016 at 0:55
  • \$\begingroup\$ Not a duplicate. Not interested in charging nor using ic's unless it's a flip flop or so. Read: jelly bean above \$\endgroup\$
    – Alex
    Commented Nov 25, 2016 at 1:44

1 Answer 1


Providing figures for voltages and currents involved would help answers.
You also need to define "jelly bean" or use somewhat more detailed terms of what is acceptable and why as eg I'd tend to consider a LM358/LM324 as ~~= jellybean. And a FET or bipolar switch may or may not be jellybean deep-ending on currents etc. And the complexity you are willing to use for switching needs commenting on - eg a servo driven switch seems a very dear and complex way of switching when simple I/O pin controlled relays or solid state devices seem liable to be cheaper and simpler. This may not be true because of what we do not know - so knowing more is liable to be helpful.

IF the backup supply can stand short term connection to normal supply you could use make before break switching.

Not knowing the currents involved or acceptable droop or switching times it is hard to be as specific as would be possible with good data, but a staged changeover may be acceptable. eg normal / normal + diode / normal + diode + backup / backup. ie adding the diode prior to changeover stops backup to main backfeed but allows continuity of supply.

I Vbat_backup is > Vbat_normal_dischargedstate (as seems likely) then the above could be achieved with an eg P channel FET with source to Battery_Normal_+ and source to load. When gate is low the FET is on and low resistance. When gate is taken high the SD body-diode adds a diode drop to tyhe normal battery feed. The backup battery is now switched in and there is no backfeed to the normal battery due to the FET body diode blocking reverse feed. If Vbat_backup is > V_bat_normal_dischargedstate then no more action is needed.

Assume that Vbat_normal is < Vbat_backup whenever the backup battery is used.
SW1 is whatever means you use to activate the backup battery. I'd probably use a MOSFET.
The diode "body-diode" is internal to M1 and is shown only to make the operation clearer. Usually SW1 is open and Vchangeover is low.
M1 is operated by gate low and the normal battery supplies the load.
To achieve changeover, Vchangeover is taken high. This turns off M1 BUT current flows via the body diode. This diode has a higher Vf than a regular silicon diode - about 0.8V say at rated current so actual value depends on FET used. The one shown is "example only".
As soon as Vchangeover is high SW1 is activated and backup battery is applied to load. The body diode is reverse biased as Vbackup > Vnormal_discharged (by design) so the backuyp battery supplies the load.


simulate this circuit – Schematic created using CircuitLab

If the mystery batteries are LiIon/LiPo then Vcharged = 8.4V and Vflattish ~= 6V. As Vload drops when the body diode is in circuit Vnormal needs to be high enough for this very short term state to allow proper operation.

If Vbat_backup < Vbat_normal_dischargedstate (which seems unlikely but is possible) then a variant of the above could be used.

Worst case it MAY be necessary to use two FETs in the bat_normal +ve feed but the cost can still be low. Switching of several FETs with a single I/O line can be chieved if desired by use of RC gate drive and also diodes if desired. This causes a small period when Vgate is at an intermediate value butv this can be arranged to be of minimal effect.
[Long long long ago I drove eg shift register data extenders from single processor pins using a simgle I/O pin for Dout, Clock and Load signals. For extra points you can manage bidirectional I/O on one pin. ]

  • \$\begingroup\$ I'm sort of a layman so visuals are a bit easier for me. This sounds a bit nebulous :( I've also edited my question adding more relevant info. \$\endgroup\$
    – Alex
    Commented Nov 25, 2016 at 11:16
  • \$\begingroup\$ @Alex -- this is going to sound rude and I'm sorry for that, but your question is quite nebulous, hence the broad answer. Russell(or anyone else) can't be more specific without knowing more details, which you are failing to provide. \$\endgroup\$
    – Wesley Lee
    Commented Nov 25, 2016 at 11:45
  • 1
    \$\begingroup\$ @Alex If you do not wish to remain a layman the 1. Drawing out circuits from text if needs be will help you grow. 2. Answering ALL questions and providing as much information so as to avoid death by 1000 QAs helps both sides. 3. See diagram above. \$\endgroup\$
    – Russell McMahon
    Commented Nov 25, 2016 at 11:55
  • \$\begingroup\$ Am I correct in assuming that SW1 being a MOSFET would also have to be activated by the Arduino? Therefore there would be two outputs from the Arduino (otherwise the voltage will very greatly as both batteries will be applied to the load). So SW1 would have to be HIGH and V_Changeover would have to be LOW to only activate the battery backup? \$\endgroup\$
    – Alex
    Commented Nov 25, 2016 at 18:16
  • \$\begingroup\$ Side note: I can probably use a logic inverter to make m2 (sw1) high while m1 is low \$\endgroup\$
    – Alex
    Commented Nov 25, 2016 at 19:45

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.