I at the moment trying smoothly move a stepper motor. The problem with the stepper motor, is that it makes a high pitch noise while it moves, or sometime a crackling noise from the motor.

So i tried ramping up the frequency of the step signal, which seemed to help a bit but not perfect. Then I tried micro stepping rather than full stepping, which also helped a bit but still, the noise is very clear.

The motor I am using is a PK244-01A And the driver it is connected to is this one

I am not at all sure if the ramping I do is either too steep, or completely incorrect, but here is the code that controls the motor.

void stepper_motor::step_pwm()



    //LOW  - Move towards the sensor
    //HIGH -  Move away from the sensor

    int increment = 0;
    int step_count = 0;
    while(step_count <= max_step)

      if(step_count >= 1)
        step_count = 0;


Anything I could do to make the noise of the motor less significant?

  • If you want to figure out if the issue is with your ramping or your operation, decide if the problems are evident only during speedup or slowdown, or if they are also evident while the motor is running at the target speed. Sep 26, 2016 at 14:45
  • Well... The issue occurs during the ramping up, from the start and up... as you can see in my code, i don't end at a certain point, i just start at a frequency and increases it for each step it moves. It makes the sound at all time.. I am not sure what i should change? The rate? the start frequency? or something completly different? Sep 26, 2016 at 14:53
  • Your ramp isn't linear. Your step period is determined by the increment variable, yet how often you increment the increment variable depends on the step period. Shorter steps lead to more frequent increments. I'd use a hardware timer of the ATmega to generate the step signal, an interrupt of said timer to increment the step count on each step, and have the speed control logic running in parallel as the main task, at a fixed frequency. An easier option would be to have a library do all that for you, e.g. accelStepper.
    – jms
    Sep 26, 2016 at 15:45
  • 1
    When it comes to noise, that's what steppers excel at producing. You won't be able to eliminate it, but you can take measures to reduce it: Drive the coils with a sinusoidal current waveform (which is exactly what microstepping does), reduce the motor current, reduce the acceleration of the motors and mount the motors with a vibration damping material. The "crackling" is what happens with uneven timing due to bugs in your code.
    – jms
    Sep 26, 2016 at 15:50

2 Answers 2


I had a similar issue once before. It actually matters a lot to properly ramp up your stepper motor. Especially under load if you ramp up too steep you can loose steps.

Since you are already using the arduino environment I suggest you could use the AccelStepper library.

I lets you set the acceleration and max. speed parameters nicely and uses a properly calculated ramp.

  • How would i know the proper acceleration?.. is it stated in the datasheet? is there a general rule or something like that? Sep 26, 2016 at 15:11
  • Look for maximum 'slewing rate'
    – Chu
    Sep 26, 2016 at 16:24

You need to be using the adjusted delay for both the high and the low part of the signal. Also, what happens when the variable "increment" is larger than 2000? Nothing good, for certain. I'd personally like to be able to delay by a negative number and undo some things that are already done, but I don't think yoz can turn back time using an Arduino.

  • you are right about the above 2000. I don't run the code for that long, usually just check it for 3 seconds an turn it off. so i guess i would have reached a negative delay. How do i figure out these adjusted delays? Sep 26, 2016 at 15:32
  • The "adjusted delay" is just the value you've already calculated: 2000-increment
    – JRE
    Sep 26, 2016 at 16:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.