Stepper motor making beeping sounds

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

Check the stepper "Run in" parameter. To reach higher speed acceleration must be used.

1 Like

so how can I achieve speed above 150 rpm using acceleration quickly, I am trying to operate a robotic arm (now I am currently working with one motor only). and the motor shaft is attached to a set of gears to increase the torque.

Use a library that provides acceleration. Mobatools has been recommended. Then there is the old Accelstepper.

Got it I will try this way.

In one project I used Accelstapper and the maximum steps per second was 4000 steps per second. Trying more steps, no more speed.
I don't know Mobatools, if they can do more or not.