# How To Calculate An 'RPM' To Turn A Motor 'M' Steps In 'N' Seconds?

I'm trying to create a time-lapse slider that will pan/tilt/translate a certain number of steps given a number of seconds. Essentially, the problem I'm trying to solve is:

In 'n' seconds, turn the motor 'm' steps.

And so, the question I'm trying to get answered is would there be a formula that can be used to determine the correct RPM value (where the RPM value is the argument in the setSpeed(RPM) function) such that the motor would turn 'm' steps in 'n' seconds?

For example, given:
int motorSteps = 100 // arbitrary steps for a motor
int time = 5; // seconds
int steps = 500; // steps or micro-steps?

// what is the correct formula for the rpm?
int rpm = (some formula here?)

stepSpeed(rpm);

Something helpful that I found was for the steps() function at 'Stepper - Arduino Reference'. It states that setting a speed to '1 RPM' and calling 'step(100)' on a '100-step' motor would cause the motor to turn 100-steps in 60 seconds. I also came across a thread (http://forum.arduino.cc/index.php/topic,184563.0.html), but I'm not sure if it is 100% related to mine. I've been trying to find some sort of relationship between these variables with no luck, and I also keep on coming to dead-ends through Google. If any of you guys have any information, it'd be appreciated.

You need rpm to be a float to get a good result, otherwise you've quantized the speed.

This is basic algebra, I feel you should really try and work it out for yourself, since
presumably you have information like steps-per-second, steps-per-revolution and
seconds-per-minute to hand, you just have to relate those to revolutions-per-minute...

MarkT:
You need rpm to be a float to get a good result, otherwise you've quantized the speed.

This is basic algebra, I feel you should really try and work it out for yourself, since
presumably you have information like steps-per-second, steps-per-revolution and
seconds-per-minute to hand, you just have to relate those to revolutions-per-minute...

Thanks, using a 'float' is something I didn't think of. I think it's a step in the right direction just to know that the steps-per-second, steps-per-revolution, and seconds-per-minute are somehow related to the RPM. I'll give it a go and try to come up with something. Thanks again!

For instance steps-per-second = steps-per-revolution x revolutions-per-second

or more obviously:

``````   step           step      rev
--------   =   -----  x  -----
sec             rev       sec
``````

The rev is on top and bottom and thus cancels...