pins 2,3,4,5 goto h bridge, 4 AA bateries alimentate the h bridge, and i put common ground betwen arduino and h bridge.
I controll all this, from serial monitor from arduino ide
MY PROBLEM: Robot works fine 3 seconds, and then serial communication gets lose, and motors move and move, and i have to restart arduino board to make them stop. This happends in every direction.
Could be interference from the motor circuitry being picked up by the Arduino, even
with separate supplies.
First with the L298 I believe you have to keep the motor voltage at least 5V or
else the Arduino power will be used to help drive the motor - in other words the L298 and
similar drivers have a diode between motor and logic supplies as part of their
construction. Normally the motor supply would be a lot more than 5V and this wouldn't
show up, but with 4 AA's for the motor supply its close to the limit.
Also realize that the L298 drops a couple of volts from the supply - so your 4.8 - 6 volt supply (not sure what kind of batteries you are using) could be as low as 2.8 - 4 volts by the time it gets to the motors...