Confused by stepper motor powering

Dear All,

I've got an Arduino Uno, a NEMA17 and a L298N bridge wired up as it is shown here:

I have a 12 V supply with max. 1A current. I'd like to use the example code from the Arduino software.

#include <Stepper.h>

const int stepsPerRevolution = 200;
Stepper myStepper(stepsPerRevolution, 8, 9, 10, 11);

void setup() {
  myStepper.setSpeed(60);
  Serial.begin(9600);
}

void loop() {
  Serial.println("clockwise");
  myStepper.step(stepsPerRevolution);
  delay(500);

  Serial.println("counterclockwise");
  myStepper.step(-stepsPerRevolution);
  delay(500);
}

After I upload the code to the Arduino, the motor turns a half round then it starts to make very small steps forward in a very clicky way. But if I don't power the Arduino on the way as it is shown on the link but I use the V_in and the 5 V output from the bridge then the motor rotates fine.

My problem is that I really need the USB plugged in because I plan to drive the motor through the USB.

Any help is appriated, I'm really stuck with this and I'm really a beginner with Arduino.

Thanks

I am assuming it is not wired correctly, the link shows it connected to a 12V power supply. Since you copied the software I am also assuming it is correct. Why not spend a few moments and draw a schematic as how you wired it, not a frizzy picture. Be sure to show all interconnections, power and grounds.

Dear All,

I figure out a kind of a solution: if I power the motor from the board then it works perfectly with the USB plugged in.

I only wonder if it is a good practice to do so?

Thanks in advance!

gilshultz:
I am assuming it is not wired correctly, the link shows it connected to a 12V power supply. Since you copied the software I am also assuming it is correct. Why not spend a few moments and draw a schematic as how you wired it, not a frizzy picture. Be sure to show all interconnections, power and grounds.

Hi, thanks for the answer. I double-checked the wiring. But in any case would a photo be good instead of the drawing? I don't have any good circuit drawing software yet.

On the picture: the light blue and the light brown free wires are coming from the 12 V power supply and the other freely hanging yellow jumper goes to the Arduino board. If I use the yellow wire everything's fine with the plugged USB. If I use the 12 V instead, there's the problem. If the I plug the yellow jumper to V_in and unplugged the USB, then everything's okay again.

Probably it's something really basic but I cannot figure it out.

Thanks

Sorry, the picture wasn't uploaded since it was too large.

An L298 is a poor brushed DC motor driver, and a worse stepper motor driver.

Only some steppers can be driven with an L298.

NEMA17 is the size of the mounting plate.
It tells us nothing about the electrical motor specifications.
Please post a link to the specifications of the stepper motor.
Leo..

Dear Leo,

Thanks for the answer. I cannot find a datasheet but for the long series of numbers and letter (probably the model number) I got this from Google:

This is the motor I have. I don't use the code from here as I mentioned above.

Thanks

That motor has 1.7 ohm coils, meaning it tries to draw 12/1.7= 7Amp per phase on a 12volt supply.
That eventually will burn out the supply or the L298 or the motor.

This stepper needs a special current (not voltage) controlled stepper driver, like the DRV8825, set to <=1.2Amp.
Leo..

I like these stepper drives, big and bulky but rugged, good for beginners.
Toshiba 6560

Dear Leo and JCA34F,

Thanks for the useful answers, really helped me out.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.