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);
}