Connect two batteries in parallel with transistors?
You are probably better off doing this with MOSFETs.  There are two back to back because otherwise the body diode would cause flow from one battery to the other.

When you apply some voltage to R1 from your MCU, Q1 will pull the gates of Q2 and Q3 low, turning them on, so current will be allowed to flow in either direction.  When Q1 is off, all transistors will turn off and the two batteries will be isolated.

The R2 pull-up assumes that V1 is the primary source.







simulate this circuit &ndash; Schematic created using CircuitLab

You could also try this.  It uses a singe PNP BJT instead so it's simpler but the transistor may dissipate more power than the MOSFETs.  You may also run into issues if the voltage differences are high, but I think it would work for you.







simulate this circuit