Hi, I am working on a project where I am using Arduino UNO to control a Nema 23 stepper motor, and while I was working on developing code to run it, I tried to run the motor in a set direction (Clockwise) and I need the motor to run at different speeds. while the motor runs fine at 100 to 150 RPM but above 150, the motor starts to beep (Small beep per sec) like a beeping alarm (may be moving a single step per sec IDK). I tried different ways but didn't work. How can I solve this?
For reference:
- I am using an MSD542 Stepper motor driver, (at 1600 pul/rev, input 26 Volts, 2 ams, SW4 = Half current)
-This is how I converted the Step angle into RPM :
float rpm2PulseSpeed(float rpm)
{
float pulseSpeed = (6*rpm)/stepAngle; //
return pulseSpeed;
}
}
void step(int numStep)
{
digitalWrite(this->dirPin, this->direction);
float pulseSpeed = rpm2PulseSpeed(this->motorSpeed);
float secPerStep = (1/pulseSpeed);
float msPerStep = secPerStep* 1000;
for (int x = 0; x < numStep; x++)
{
digitalWrite(this->pulsePin,this->direction);
delay(msPerStep/2);
digitalWrite(this->pulsePin,!this->direction);
delay(msPerStep/2);
}
}
}