28BYJ-48 Stepper Motor Beeping Instead of Rotating

I would like to know whether I can fix my stepper motor as it continuously beeps instead of rotating when I run the simple stepper one revolution code. I have checked the wiring multiple time and everything seems to be alright. Is there a problem with the motor internally that I can't fix? Also, I set the speed to one revolution per minute and it still beeps. I would appreciate the help, thank you.

Edit: The motor no longer beeps because I realized that I had to connect ground from the Arduino to the breadboard despite using a power supply module. I also changed the pins to 8, 10, 9, 11.
However it still vibrates.

Finally, I got the stepper motor to work, I think the reason why it wasn't working is because I kept unplugging the power supply and reuploading code too many times, perhaps that's why it stopped working for a while.

#include <Stepper.h>

const int stepsPerRevolution = 2048;  // change this to fit the number of steps per revolution
// for your motor

// initialize the stepper library on pins 8 through 11:
Stepper myStepper(stepsPerRevolution, 8, 9, 10, 11);

void setup() {
  // set the speed at 1 rpm:
  myStepper.setSpeed(1);
  // initialize the serial port:
  Serial.begin(9600);
}

void loop() {
  // step one revolution  in one direction:
  Serial.println("clockwise");
  myStepper.step(stepsPerRevolution);
  delay(500);

  // step one revolution in the other direction:
  Serial.println("counterclockwise");
  myStepper.step(-stepsPerRevolution);
  delay(500);
}

s

The motor can't turn at 60 RPM. Try 1 RPM.

Hi, I tried setting it to 1 RPM and it still beeps. Does anyone know what else can possibly be fixed?

Some of those steppers have mislabeled wires. You may need to change the pin order.

Also try another example program, like this one. If the wires are mislabeled, you can try swapping pairs of pins, until it starts working correctly. This will not damage the motor or the Arduino.

// original!
// This Arduino example demonstrates bidirectional operation of a
// 28BYJ-48, using a ULN2003 interface board to drive the stepper.
// The 28BYJ-48 motor is a 4-phase, 8-beat motor, geared down by
// a factor of 68. One bipolar winding is on motor pins 1 & 3 and
// the other on motor pins 2 & 4. The step angle is 5.625/64 and the
// operating Frequency is 100pps. Current draw is 92mA.
////////////////////////////////////////////////

//declare variables for the motor pins
int motorPin1 = 2;    // Blue   - 28BYJ48 pin 1
int motorPin2 = 3;    // Pink   - 28BYJ48 pin 2
int motorPin3 = 4;    // Yellow - 28BYJ48 pin 3
int motorPin4 = 6;    // Orange - 28BYJ48 pin 4
                        // Red    - 28BYJ48 pin 5 (VCC)

int motorSpeed = 10;//variable to set stepper speed (delay milliseconds)
int count = 0;          // count of steps made
int countsperrev = 2048; // number of steps per full revolution
int lookup[8] = {B01000, B01100, B00100, B00110, B00010, B00011, B00001, B01001};

//////////////////////////////////////////////////////////////////////////////
void setup() {
  //declare the motor pins as outputs
  pinMode(motorPin1, OUTPUT);
  pinMode(motorPin2, OUTPUT);
  pinMode(motorPin3, OUTPUT);
  pinMode(motorPin4, OUTPUT);
  Serial.begin(9600);
  Serial.println("stepper");
}

//////////////////////////////////////////////////////////////////////////////
void loop(){
  while (count < countsperrev ) {
    clockwise();
    count++;
  }
}

//////////////////////////////////////////////////////////////////////////////
//set pins to ULN2003 high in sequence from 1 to 4
//delay "motorSpeed" between each pin setting (to determine speed)
void anticlockwise()
{
  for(int i = 0; i < 8; i++)
  {
    setOutput(i);
    delay(motorSpeed);
  }
}

void clockwise()
{
  for(int i = 7; i >= 0; i--)
  {
    setOutput(i);
    delay(motorSpeed);
  }
}

void setOutput(int out)
{
  digitalWrite(motorPin1, bitRead(lookup[out], 0));
  digitalWrite(motorPin2, bitRead(lookup[out], 1));
  digitalWrite(motorPin3, bitRead(lookup[out], 2));
  digitalWrite(motorPin4, bitRead(lookup[out], 3));
}

In your current program, I tweaked it a t little.
Not the pin order used, it is important to drive the coils in the correct pairings
And then some of the settings have maxes that can be used with the 29BYJ-48 motor

#include <Stepper.h>

const int stepsPerRevolution = 128;  // change this to fit the number of steps per revolution
// for your motor

// initialize the stepper library on pins 8 through 11:
Stepper myStepper (stepsPerRevolution,8,10,9,11); // to IN1, IN2, IN3, IN4, order is important to ULN2003 card
// 8 to in1, 9 to in2, 10 to in3, 11 to in4. But the stepper definition above must be 8,10,9,11.

void setup() {
  // set the speed at 1 rpm:
  myStepper.setSpeed(270);
  // initialize the serial port:
  Serial.begin(9600);
}

void loop() {
  // step one revolution  in one direction:
  Serial.println("clockwise");
  for (byte x = 0; x <16; x=x+1){
  myStepper.step(stepsPerRevolution);
  }
  delay(50);

  // step one revolution in the other direction:
  Serial.println("counterclockwise");
  for (byte x = 0; x <16; x=x+1){
  myStepper.step(-stepsPerRevolution);
  }
  delay(50);
}

Hi, This is a common problem... See:

CONNECTION NOTES: (Motor Just Vibrates??)
SmallSteppers - ArduinoInfo (mywikis.net)
and
SmallSteppers - ArduinoInfo (mywikis.net)

More overall Stepper Info here:
StepperMotors - ArduinoInfo (mywikis.net)

Try changing:

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

To:

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

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.