I am making a tank rc car with the Raspberry Pi (model 2) and running the 2 DC motors with an L298N H-Bridge Motor Driver Board. I am using Putty (free SSH client) to SSH into my Pi (running raspbian) on from windows 10.
The problem is that when I turn my Pi on and off the motors start moving sporadically. They also go crazy when I turn the Pi off and leave the motor driver board powered on. This doesn't make sense to me, because the L298N board takes 5 Volts from the Pi to function (logic) and takes extra power from an external battery to drive the motors (which is the purpose of the chip). The motors act fine when I use the Pi via a monitor, it's when I SSH into it that they go crazy. This may be because I bought a very cheap Wi-Fi dongle.
My Pi also turns off without warning periodically. I'm thinking that could be because of my battery pack, but it is within the amperage range that the Pi requires.
update: I was told I should use pull up or pull down resistors. From my quick google research, I learned that these resistors should be connected (cut the wire and connect each end of the resistor) to the positive wire. Is this correct? What rating should the resistors be in Ohms?