Hello,
I am controlling a high-torque stepper motor (23Y204S from Anaheim Automation with 8 lead-wire) using a microstepping driver (MBC15081) and Arduino. The winding wiring is connected as bipolar series connection. The Arduino was programmed and the motor works fine in one direction, however, it stalls when trying to rotate in the opposite direction (it is possible to feel the pulsing/jerking) and it does not rotate. I am currently using the driver in the sinking mode and it says that to control the direction of the rotation, it is necessary to change the signal from Logic '1' to Logic '0' and vice-versa. As you can see in the code below, in the forward motion (when directionPin is HIGH) the motor rotates, but in the reverse direction (when directionPin is LOW - in the code below it is highlighted with "stars" ****) the motor stalls. Please share your feedback about this. Thank you.
Arduino Code:
P.S: The Serial.Read is receiving data from Visual Studios. Does not affect the problem here.
int clk = 27;
int directionPin = 34;
int MS2 = 42; //dip switches for step setting
int MS1 = 43;
int power = 35; // ON/OFF
const int revSteps[] = {3200, 800, 400, 200};
const int MS2switch[] = {LOW, LOW, HIGH, HIGH};
const int MS1switch[] = {LOW, HIGH, LOW, HIGH};
void setup()
{
Serial.begin(9600);
pinMode(clk, OUTPUT);
pinMode(directionPin, OUTPUT);
pinMode(MS2, OUTPUT);
pinMode(MS1, OUTPUT);
pinMode(power, OUTPUT);
}
void loop()
{
while(Serial.available() > 0)
{
char cat;
cat = Serial.read();
if(cat == '1') //Forward
{
digitalWrite(power, HIGH); //Turn motor ON
digitalWrite(directionPin, HIGH); //counter clockwise
digitalWrite(MS2, MS2switch[0]); //full/half/quarter/eighth of step
digitalWrite(MS1, MS1switch[0]); // ""
for(int x=0; x < revSteps[3]; x++)
{
digitalWrite(clk, HIGH);
delayMicroseconds(3000);
digitalWrite(clk, LOW);
delayMicroseconds(3000);
}
digitalWrite(power, LOW); //turn off motor
}
else if(cat == '2') //Backward
{
digitalWrite(power, HIGH); //Turn motor ON
digitalWrite(directionPin, LOW); //clockwise - DOES NOT WORK *************************************************
digitalWrite(MS2, MS2switch[0]); //controlling speed of motor
digitalWrite(MS1, MS1switch[0]); // ""
for(int x=0; x < revSteps[3]; x++)
{
digitalWrite(clk, LOW);
delayMicroseconds(3000);
digitalWrite(clk, HIGH);
delayMicroseconds(3000);
}
digitalWrite(power, LOW); //turn off motor
}
}
}