I am using a L298N Controller Board to control a stepper motor via a Ardunino Uno (also tried a Duemilanove) The L298N board takes 12volts(or more) and steps it down to 5vs which can be used to power the arduino (and this works fine) The problem comes when the Arduino is plugged into USB, at which point the motor starts spinning erratically and stuttering. As soon as I unplug the usb it goes back to working fine again.
I have the ground shared between the 12v supply and the arduino, and the 5v from the l298 plugged into the VIn on the arduino.
I want the ardunino plugged into the computer because I want to be able to use the serial to control the stepper.
Has anyone seen this before? I'm assuming the 5v usb power is interfering with something, i'm just not sure how to stop it without also killing the serial link to the computer.
analog:
Also, running the wire from the 5volts on the L298 to the 5v on the arduino also causes the same issue.
Does that mean that you get erratic behaviour when the L298 is connected to the 5v pin on the Arduino AND the Arduino is disconnected from the USB cable?
The Arduino Vin pin is the same as the barrel jack and requires a voltage in excess of 6v, 7v is the recommended minimum so if you have a regulated 5v supply it should always be connected to the 5v pin.
Better still post your complete code and circuit like is expected in this forum and explained in the "how
to post" sticky threads. Here means at least two versions of the circuit, since they are behaving
different. You should also post the datasheet or similar for both the motor and the power supply.
The USB thing may be a red-herring, its best to check everything, so we need to see everything.