Try It Yourself: Stepper Speed vs. Torque Trade-Off

Try It Yourself: Stepper Speed vs. Torque Trade-Off

animation
actuators
stepper

Time: 30 minutes | Difficulty: Intermediate | Hardware: 28BYJ-48 + ULN2003, ESP32, 5V power supply

Objective: Measure how stepper torque decreases as speed increases, and discover the “don’t start too fast” rule through hands-on experimentation.

What You’ll Need:

Work through Try It Yourself: Stepper Speed vs. Torque Trade-Off as a connected sequence. Start with 28BYJ-48 stepper motor + ULN2003 driver board. Next, ESP32 or Arduino. Then, 5V 1A power supply. Finally, Small object to attach to motor shaft (paper disc with tape).

Procedure:

Work through Try It Yourself: Stepper Speed vs. Torque Trade-Off as a connected sequence. Start at 1 RPM, then test 3 and 5 RPM under the actual load; try 10 RPM only if the shaft follows the command. At each setting, compare commanded and measured shaft speed, note vibration or missed steps, and record the load. Then test starting without an acceleration ramp at the highest speed that worked. Restore a gentle ramp and compare. An acceleration ramp does not make 100–1,000 RPM feasible for this geared motor.

What to Observe:

Work through Try It Yourself: Stepper Speed vs. Torque Trade-Off as a connected sequence. Record whether the shaft follows the command at 1, 3, 5, and a tentative 10 RPM under load. Compare commanded and measured RPM, then note vibration, torque change, or missed steps. Results depend on the actual motor, driver, and load.

Hint: The geared 28BYJ-48 is a low-speed motor. Test the actual load from 1 RPM upward; use a different motor and suitable driver if the application needs higher shaft speed.

Solution Code:

#include <AccelStepper.h>

#define MOTOR_PIN1 19
#define MOTOR_PIN2 18
#define MOTOR_PIN3 5
#define MOTOR_PIN4 17

AccelStepper stepper(AccelStepper::HALF4WIRE,
                     MOTOR_PIN1, MOTOR_PIN3, MOTOR_PIN2, MOTOR_PIN4);

const int STEPS_PER_REV = 4096;

void setup() {
  Serial.begin(115200);

  int speed_rpm = 1; // Try 1, 3, 5, then 10 RPM under the actual load
  int steps_per_sec = (speed_rpm * STEPS_PER_REV) / 60;

  stepper.setMaxSpeed(steps_per_sec);
  stepper.setAcceleration(500); // Try commenting this out for instant-start test

  Serial.print("Speed: ");
  Serial.print(speed_rpm);
  Serial.println(" RPM");
}

void loop() {
  stepper.moveTo(STEPS_PER_REV * 10); // Rotate 10 full revolutions
  while (stepper.distanceToGo() != 0) {
    stepper.run();
  }
  delay(2000);
  stepper.moveTo(0); // Return to start
  while (stepper.distanceToGo() != 0) {
    stepper.run();
  }
  delay(2000);
}

Extension Challenge: Add a tachometer (hall effect sensor + magnet on shaft) to measure actual RPM and compare to commanded RPM – discover at what speed missed steps begin!

Back to the chapter