Stepper Motor Steps & RPM Question.

Stepper Motor Steps & RPM Question.

Arduino UNO board.

I need help understanding the relationship between steps per revolution and RPM.

Overview:

  • UNO board for development Arduino product)
  • Two motor control boards Dual H Bridge DC Stepper Motor Controller Board Shield L298N
  • Two power supplies, +5v for UNO and +12-24V for the motor boards.
  • 5V relay to contol external devices driven by UNO pin 7
  • Two stepper motors 24v 48 steps per Rev.
  • Start button UNO pin 12, Stop Button UNO pin reset

My problem is understanding why when I increase the number of steps I have to reduce the RPM value to ensure the motor turns smoothly.

  • Choose 96 steps (2 revolutions) and RPM 60 and the stepper runs smoothly
  • Choose 960 steps (20 revolutions) and RPM 60 and the stepper stutters, the LEDs on the motor controllers flash very fast.
  • Choose 960 steps (20 revolutions) and RPM 10 and the stepper runs smoothly, the LEDs on the motor controllers flash in modestly.
  • Choose 9600 steps (200 revolutions) and RPM 1 and the stepper viabrates with no movement, the LEDs on the motor controllers flash very very fast.

It would be appreciated if you could review my sketch “sketch_may11_2_Step_Motors” to ensure I have not missed any items.

Kind Regards
Bob Winchester
wbob@optusnet.com.au

#include <Stepper.h>

const int stepsPerRevolution = 480;// 48 number of steps per/rev (10 Revs)
const int stepsPerRevolution2 = 9600;// 48 number of steps per/rev (200 Revs)
const int buttonPin1 = 12; // Push Button Start High on pin 12 when pushed.
const int ledPin1 = 7; // Output to AC switching relay

// variables will change:
int buttonState = 0; // variable for reading the buttons status.

// initialize the stepper library on pins 2-5 n 8-11
Stepper myStepper1(stepsPerRevolution , 2, 3, 4, 5);
Stepper myStepper2(stepsPerRevolution2, 8, 9, 10, 11);

void setup()
{
pinMode(buttonPin1, INPUT);
// set the speed at 10 rpm:`
myStepper1.setSpeed(30);//left
myStepper2.setSpeed(1);//right
pinMode(ledPin1, OUTPUT);
// initialize the serial port:
Serial.begin(9600);
}
void loop() {
if (buttonState == 1) // button has never been pressed
{
}
// detect button press
// read the stateof the pushbutton value:
buttonState = digitalRead(buttonPin1);
if (buttonState == LOW) {
buttonState = 0;

} else {
digitalWrite(ledPin1, HIGH); // Operate AC relay
delay (2000); // wait for a 2 seconds
// step one revolution in one direction:
Serial.println(“clockwise”);
myStepper1.step(stepsPerRevolution);
delay(1500);
myStepper2.step(stepsPerRevolution2);
delay(1500);

// step one revolution in opposite direction:
Serial.println(“counterclockwise”);
myStepper1.step(-stepsPerRevolution);
delay(1500);
myStepper2.step(-stepsPerRevolution2);
delay(1000); // AC relay slow off:
// Turn AC relay off:
digitalWrite(ledPin1, LOW); // Motor time 1 minute.
}
}

Arduino expert for questions

If your motor has 48 physical steps for a single revolution then these

const int stepsPerRevolution  = 480;// 48 number of steps per/rev (10 Revs)
const int stepsPerRevolution2  = 9600;// 48 number of steps per/rev (200 Revs)

should both be 48, not 480 and 9600.

If you want it to move ten revolutions then you use

myStepper.step(480);

or, more generally

myStepper.step(numberOfStepsToMove);

...R
Stepper Motor Basics
Simple Stepper Code

Hi Robin2
Thank you very much, there were too many trees in the forest, a simple fix, Thank you.
Just changing "mystepper.step (480) & “stepsPerRevolution=48” was easy…Great
Regards Bob