I have recently created a cool custom board that supports 8 stepper motors for a precise robot implementation I have been working on for quite a while. Today I wired it up correctly and it worked, but now I messed it up, and it has been jittering since.
I looked at all sorts of online documentation, and I just find the premise of these stepper motors confusing.
Now I believe the source of this issue is the pinout, as I got my motor to work with the custom board, messed it up, moved it to bread board, and still find issue with it.
Does anyone know a quick, convenient way to identify poles and maintain them? Any assistance much appreciated.
The code, though I made the motor work without it:
// Define pin connections & motor's steps per revolution
const int dirPin = 2;
const int stepPin = 3;
const int stepsPerRevolution = 200;
void setup()
{
// Declare pins as Outputs
pinMode(stepPin, OUTPUT);
pinMode(dirPin, OUTPUT);
}
void loop()
{
// Set motor direction clockwise
digitalWrite(dirPin, HIGH);
// Spin motor slowly
for(int x = 0; x < stepsPerRevolution; x++)
{
digitalWrite(stepPin, HIGH);
delayMicroseconds(2000);
digitalWrite(stepPin, LOW);
delayMicroseconds(2000);
}
delay(1000); // Wait a second
// Set motor direction counterclockwise
digitalWrite(dirPin, LOW);
// Spin motor quickly
for(int x = 0; x < stepsPerRevolution; x++)
{
digitalWrite(stepPin, HIGH);
delayMicroseconds(1000);
digitalWrite(stepPin, LOW);
delayMicroseconds(1000);
}
delay(1000); // Wait a second
}
Thank you,
Dawson