Problem in Getting Stepper Motor to Rotate

Hi guys,

I am a beginner in using Arduino, and I have encountered a problem with the stepper motor.

(Motor: MOONS' NEMA17 Stepper Motor 0.63Nm 1A 2Phase 1.8degree Hybrid Bipolar DC Step Motor 48.3 mm (1.9in.) Smooth Quiet Stepping Motor (Model MS17HD6P4100): Amazon.com: Industrial & Scientific)

I downloaded a simple code online to test the motor, but I'm not sure why the motor is not turning at all. It only has some weird sound, but other than that is not working.

I believe the wiring and coding are correct, so I really confused.

Thank you for your help!

Below is the code I am using to run the motor:

#include <Stepper.h>

const int stepsPerRevolution = 200;

Stepper myStepper(stepsPerRevolution,8, 9, 10, 11);

void setup() {
myStepper.setSpeed(3000);
Serial.begin(9600);
}

void loop() {
Serial.println("clockwise");
myStepper.step(stepsPerRevolution);
delay(500);

Serial.println("counterclockwise");
myStepper.step(stepsPerRevolution);
delay(500);
}



It appears you are missing a GND connection to the Arduino.

1 Like

It works! Thank you very much LarryD :slight_smile:

@lai00041, your topic has been moved to a more suitable location on the forum.

Please read How to get the best out of this forum and in future post code using code tags.

The next step could be to get a more appropriate stepper motor driver like an A4988 or DRV8825. The L298 is really inefficient and does not control the coil current like the modern drivers do.

^^ Yes, because an L298 will eventually burn out the motor if you use a supply higher than 9volt (assuming the L298 itself will drop ~4volt@1A). This stepper has 1A/4.9volt coils.
A current controlled stepper driver, and a 12volt (minimum) supply is needed for this motor.
Or even a 24volt supply if you need torque at higher speed.
Leo..

Got it. Thank you for the information! I really appreciate that :slight_smile: