# Find out the maximum rpm for 28BYJ-48

Hi I want to find the maximum rpm for the stepper motor include in the starter box but I don't really know to do it this is what I have so far for my fullstep drive. What is the relationship between rpm and delta t?

``````int IN1 = 11;
int IN2 = 10;
int IN3 = 9;
int IN4 = 8;
int stepPerRev_fullstep = 32 * 64;
double rev
int dly_btw_step = 50;
void setup()
{
Serial.begin(9600);
pinMode(IN1, OUTPUT);
pinMode(IN2, OUTPUT);
pinMode(IN3, OUTPUT);
pinMode(IN4, OUTPUT);
}
void stepMotor(int pin1, int pin2, int pin3, int pin4, int thisStep)
{
switch (thisStep)//fullstep drive
{
case 0:
digitalWrite(pin1, HIGH);
digitalWrite(pin2, HIGH);
digitalWrite(pin3, LOW);
digitalWrite(pin4, LOW);
break;
case 1:
digitalWrite(pin1, LOW);
digitalWrite(pin2, HIGH);
digitalWrite(pin3, HIGH);
digitalWrite(pin4, LOW);
break;
case 2:
digitalWrite(pin1, LOW);
digitalWrite(pin2, LOW);
digitalWrite(pin3, HIGH);
digitalWrite(pin4, HIGH);
break;
case 3:
digitalWrite(pin1, HIGH);
digitalWrite(pin2, LOW);
digitalWrite(pin3, LOW);
digitalWrite(pin4, HIGH);
break;
}
}
void clockwise (double rev, int dly)
{
for (int i = 0; i <= (rev* stepPerRev_fullstep); i++)
{
stepMotor(IN1, IN2, IN3, IN4, i % 4);
delay(dly);
}
}
void ccw (double rev, int dly)
{
for (int i = (rev* stepPerRev_fullstep); i >= 0; i--)
{
stepMotor(IN1, IN2, IN3, IN4, i % 4);
delay(dly);
}
}

void loop() {
// put your main code here, to run repeatedly:
clockwise(rev, dly_btw_step);
delay(1000);
ccw(rev, dly_btw_step);
delay(1000);
}
``````

Easiest way is to check past posts using the SEARCH at the upper right.

which delta t ?
Your program has no variable named delta t.

best regards Stefan

I want to do trial and error for the stepper motor to find the maximum rpm; however, in the void clockwise and counterclockwise I can't not use rpm value to change the speed of it at alI. Because of it want to change the delay (delta t) based from the rpm I enter, but I don't know how to convert from rpm to delay time

I tried but I couldn't find the forum post about 28BYJ-48 stepper motor and how to adjust the rpm to maximum to move 1 rev in both clockwise and counter clockwise

If your stepper motor is like this

and if not loaded the pulse frequency is at least 600Hz, which corresponds to 1/600 = 1667 micro seconds. Change the 'delay' to 'delayMicroseconds' and set the time to 1680 for example. If it is still moving and does not miss steps, you can try more aggressive settings.

The delay() functions are setting the minimum time between steps. Multiply that delay by the number of steps per revolution (2048?) and divide that into 60000 (milliseconds per minute) to get maximum RPM. For example, with a delay of 1 there will be 2048 milliseconds of delay per revolution. That would get you about 29 RPM if the rest of the code took no time at all.

Try a delay value of 10. That should get you 2.92968 revolutions per minute. Measure the time for 10 revolutions (somewhere around 205 seconds) and calculate RPM from that. Then calculate seconds per step from that. You should get a number a little over 0.010 (10 milliseconds). Subtract 0.010 to see how much time the rest of the code takes per step.

If you use "delayMicroseconds()" instead of "delay()" you will get finer control over speed. Note: delayMicroseconds() works in 4-microsecond intervals.

Changing the delay value will only get you to the maximum achievable start up RPM. It's possible the motor can go faster if properly accelerated, especially if it's under any kind of load.

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