Program works great, motor works as predicted, then suddenly it deviates ???

Making good progress with the help of everyone on this forum, some troubleshooting examples, and etc. But this is where it gets weird. I have my Unipolar Nema 23 motor wired as the following:

Coil 1 : Black A+ Green A- With Center tap Yellow to GRND
Coil 2: RED B+ BLU B- with Center tap White to GRND

I am using the Arduino Uno + Arduino motor shield R3

I run the following script below and the motor performs the function as written. but then after completing the motor will start jittering and only rotating back and fourth by, say 20 degrees or so. with only the A- and B+ LED light flickering.

I thought that when you upload a program it over wrote the previous program, isn't that correct? Cause it was behaving as though it was running through some of my previous failed programs. Also noticed when it was running like it was suppose to that the motor didnt seem to run smooth but you could hear it stepping through. I tried to increase the speed to see if it would smooth out but it got to a point that it couldn't time it and started jittering with all four LED (A+ A- B+ B-) lights solid. Also notice the board warming up as it runs the motor, and cause I can't double check and verify that Wiring the center tap to GRND is ok, Im wondering if I should have a PC Fan blowing air on it as it runs.

I feel close but I have been grasping at what little information I could find spread over many many websites.

Once again your guys input is very much appreciated! So far its getting me past, if it will work, to where I can start thinking about what I will do with it when it does!

#include <Stepper.h>

const int stepsPerRevolution = 200; // change this to fit the number of steps per revolution
// for your motor

// initialize the stepper library on the motor shield
Stepper myStepper(stepsPerRevolution, 12,13);

// give the motor control pins names:
const int pwmA = 3;
const int pwmB = 11;
const int brakeA = 9;
const int brakeB = 8;
const int dirA = 12;
const int dirB = 13;

int x = 0;
void setup() {
Serial.begin(9600);
// set the PWM and brake pins so that the direction pins // can be used to control the motor:
pinMode(pwmA, OUTPUT);
pinMode(pwmB, OUTPUT);
pinMode(brakeA, OUTPUT);
pinMode(brakeB, OUTPUT);
digitalWrite(pwmA, HIGH);
digitalWrite(pwmB, HIGH);
digitalWrite(brakeA, LOW);
digitalWrite(brakeB, LOW);

// initialize the serial port:
Serial.begin(9600);
// set the motor speed (for multiple steps only):
myStepper.setSpeed(15);
}

void loop() {

myStepper.step(500);

delay(2000);

myStepper.step(-200);

delay(2000);

myStepper.step(800);

delay(2000);

myStepper.step(-2000);

delay(2000);

}

I run the following script below and the motor performs the function as written. but then after completing the motor will start jittering and only rotating back and fourth by, say 20 degrees or so. with only the A- and B+ LED light flickering.

After completing what?

What are you using for power and how much is your motor rated to draw?

To the first guy, it will run excellent to the end of the script but then after completing a couple loops will go eratic.

second question its rated at 12v 2 amps. Im using external DC power at 12v out put 1.5 amps, I just double checked a couple other websites as the model is 57byg and found most information on NEMA website. however I checked some others and the voltage seems to range all over as they have models : 57BYG001 -57BYG504 and the voltage and amps vary greatly.

You think that I may be over loading the motor?? Its a good question! The motor I have has no other identification except the label 57BYG and if there are all of these variation that could mean trouble

Whether the stepper motor draw the full 2 amps depends on the load and the speed. Unloaded, they don't draw anywhere near that much current.

Ok I was worried that perhaps it was a combination of not wiring the motor correctly combined with code make it error out or over load it perhaps. The whole thing got pretty warm so I am naturally a little paranoid. :slight_smile:

I attached a link to a video of what i am seeing it doing, and what i had done so far to get here. You can see it running normally for a while then it stops moving the motor smoothly:

Although the stepper isn't loaded, it looks as if it is slipping. At the start of the video when it seems to be working properly, does the stepper produce enough torque to keep turning if you apply some resistance to the shaft? When you say it's getting hot, do you mean the motor or the driver circuit?

Yeah I checked the torque and it is strong. and Hot I mean the drive circuit, particularly the chip thats right next to the DC jack on the arduino uno board , marked RTY 117S. Interestingly enough when I run the components under just USB power it seems to run ok, not too much torque but doesnt glitch out. I'm wondering if 12v 2 amps is too much

A 2A or 2000A power supply is a maximum rating. There is nothing that pushes current. Current is pulled, by the stepper motor. If it needs 2A, it will pull 2A. If it needs 0.5A, it will pull 0.5A, regardless of the rating on the power supply. Assuming, of course, that the rating is high enough to satisfy the demands of the motor.

The USB power supply can not supply 2A. It is limited to 0.5A at 5V. If that amount of voltage and current is sufficient (it does not sound like it might not be), then it would seem that the problem is one of over-voltage, rather than over-current.

The Nema 23 spec you are quoting defines the spacing of the mounting holes. It says nothing about the motor being mounted. You really need to figure out what voltage and current that motor needs, and probably get the appropriate stepper motor driver.

seandelgatto2001:
Yeah I checked the torque and it is strong. and Hot I mean the drive circuit, particularly the chip thats right next to the DC jack on the arduino uno board , marked RTY 117S. Interestingly enough when I run the components under just USB power it seems to run ok, not too much torque but doesnt glitch out. I'm wondering if 12v 2 amps is too much

If the stepper works OK at 5V then 12V may be way too much. How much current is it drawing at 12V? I think you need to review the voltage and current requirements of that stepper and then make sure the supply and driver circuit are suitably rated.

Sounds like good advice Ill give it a shot and see what happens. I notice that it doesnt have an issue when running off just usb power, the motor turns weakly but doesnt error out