I have a Raspberry Pi 4B controlling an L298N module. I also have 2 cell batteries powering both. The cell batteries power the Pi through the 40 pin connector. The motor driver is powered by the cell batteries, but it is powered through the 40 pin connector to the batteries.
It's like this:
+----------------------+ +------+
|Motor Driver +----|Motors|
+-++++++-----------+-+-+ +------+
6 control pins -->|||||| 5v -->| |<-- GND
(In - 14 and en)+-++++++-----------+-+-+
|Raspberry Pi4B 40 pins|
+------------------+-+-+
5v -->| |<-- GND
+------------------+-+-+
|Cell batteries |
+----------------------+
But, if I spin the wheels connected to the motor driver, the power generated from spinning the motors (They are geared motors) back-power the Pi with about 3-4v. I'm afraid that it might momentarily turn the Pi on and off, corrupting the file system. I do not want to make the file system read-only though, as I'm still developing software to control it.
I'm thinking of some diode so power can only go to the motor driver, not the other way around. Would that be the best solution?
The orange and brown wires are the motor driver's power and ground. EDIT 2: More pictures
There are no terminals. Just plugs.