# How can I optimise control parameters for a stepper motor?

As an industrial roboticist I spent most of my time working with robots and machines which used brushless DC motors or linear motors, so I have lots of experience tuning PID parameters for those motors.

Now I'm moving to doing hobby robotics using stepper motors (I'm building my first RepRap), I wonder what I need to do differently.

Obviously without encoder feedback I need to be much more conservative in requests to the motor, making sure that I always keep within the envelope of what is possible, but how do I find out whether my tuning is optimal, sub optimal or (worst case) marginally unstable?

Obviously for a given load (in my case the extruder head) I need to generate step pulse trains which cause a demanded acceleration and speed that the motor can cope with, without missing steps.

My first thought is to do some test sequences, for instance:

• Home motor precisely on it's home sensor.
• Move $C$ steps away from home slowly.
• Move $M$ steps away from home with a conservative move profile.
• Move $N$ steps with the test acceleration/speed profile.
• Move $N$ steps back to the start of the test move with a conservative move profile.
• Move $M$ steps back to home with a conservative move profile.
• Move $C$ steps back to the home sensor slowly, verifying that the sensor is triggered at the correct position.
• Repeat for a variety of $N$, $M$, acceleration/speed & load profiles.

This should reliably detect missed steps in the test profile move, but it does seem like an awfully large space to test through however, so I wonder what techniques have been developed to optimise stepper motor control parameters.

• In the RepRap World the Diagnosis is that the print looks awful. That is the detection of missed steps, as far as I know. But I think the current used by the stepper could be used as a feedback if the stepper was able to do the move. But have not heard of somebody really doing that. – Lars Pötter Dec 11 '12 at 23:34
• (These topics are getting popular this week. Must be because of that gun article.) The best/easiest way is to do the test prints such as the Torture Test thingiverse.com/thing:33902 – user797 May 9 '13 at 18:54