Smooth switching between 12 V batteries, with a toggle switch

You could add two Schottky diodes to the switch, allowing either battery to power the load via a diode. During switchover the voltage will drop 0.35 V (1N5817 @200 mA) below the voltage of the battery with the most charge, and it avoids the current surge caused by adding a capacitor. You could even remove the switch if a 3% power loss is acceptable.

Schematic

simulate this circuit – Schematic created using CircuitLab


A little simple maths:

In a capacitor charge, Q, and voltage, V, are related by \$ Q = CV \$.

Current is the rate of charge flow so, differentiation gives us \$ I = \frac {dQ}{dt} = C \frac {dV}{dt} \$

You want to calculate your voltage drop for the duration of the switch transfer so we'll rearrange as

$$ C = \frac {I}{\frac {dv}{dt}} = I \frac {dt}{dv}$$

So, throwing in some rough figures, we'll say you are drawing 250 mA, you can tolerate a 0.8 V drop and your switch takes 50 ms to throw then

$$ C = I \frac {dt}{dv} = 0.25 \frac {0.05}{0.8} = 0.015 \ \text F = 15,000 \ \mu \text F $$

schematic

simulate this circuit – Schematic created using CircuitLab

Figure 1. The circuit.

@Jasen makes the point that "a large-enough capacitor may damage your switch". The point here is that a capacitor acts as a short-circuit when first connected to a power supply because it is completely discharged. As a result there will be an initial current surge through the already closed switch. You can use a beefy switch or add a current limiting resistor in series with C1.

Once initially charged the switching current will be close to the load current during each switch transision.


This might seem overly simplistic, but I have worked around this in the past with a simple momentary switch across the main toggle switch. Holding it in connects the two 12 V sources together while you flip the main. So at no point is the power interrupted. And with this the two sources are completely isolated during normal operation and cannot be accidentally left connected.