I have a battery, where the negative terminal is being switched by an NMOS circuit. I also have a solar charge controller, which is controlled by serial interface. The serial interface requires common ground. A microcontroller is connected directly to the battery.
Problem: Current flows to the battery via the serial interface ground loop (and causing lots of smoke, too).

simulate this circuit – Schematic created using CircuitLab
Question: How can I maintain the serial connection, without creating a ground loop? Can I make galvanic isolation with discrete components?