# Problem setting stepper motor speed to 1rpm.

Hello,
I must first say I’m a total noob in this and am very green, so pardon me if I seem to be asking very silly questions.
The problem I’m having is with the arduino UNO Stepper motor (the classic one, the 28BYJ-48) and I would like to make it do 1 revolution per minute, and would also like it to achieve maximum torque while doing it.
I have found some code online but I can’t get it to do the 1rpm, instead it does it slower.

``````#include <Stepper.h>
const int stepsPerRevolution = 32;  // change this to fit the number of steps per revolution

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

void setup() {
// set the speed:
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);
}
``````

The main aim is for it to be a motorized barn door star tracker, that’s why it needs to be precisely 1rpm (according to the math hehe) and it also must achieve maximum torque in order to be able to move the DSLR.
Thank you very much in advance, and sorry if this question was posted before but I can’t seem to find it.

Arduino stepper library does only full-stepping (slightly less than 2048 steps per revolution for 28BYJ-48), which provides maximal torque compared to half-stepping or micro-strepping:

That guy made bipolar stepper from 28BYJ-48 and increased torque from 330gcm to 800gcm!

Now that I learned that bipolar has more torque than unipolar with same form factor, I understand that the microscope two-axis sliding-table stepper motors are bipolar:

When you allow for the gearbox a 28BYJ-48 stepper motor has 2048 steps per revolution.

...R

Robin2:
When you allow for the gearbox a 28BYJ-48 stepper motor has 2048 steps per revolution.

Slightly less, this guy counted 4075.8 steps with half-stepping, that translates to 2038 steps per revolution:

Robin2:
When you allow for the gearbox a 28BYJ-48 stepper motor has 2048 steps per revolution.

...R

Does this mean it's not possible to achieve 1rpm?
What I meant to ask is how would the code have to be to achieve 1rpm?
Thank you very much for your quick replies.

Actually I want to see if I got this right:
Given that the arduino has 2038 as Hermann said, I would have to divide that into 60 (seconds) to get the steps it has to do?
Also, is the delay just to prevent any errors or does it influence too in the "speed" of a stepper motor.

All you need to do is insert the correct number of steps per revolution and the speed (in RPM) that you want the motor to move.

In other words, change the code in your Original Post so it has 2038 or 2048 instead of 32. I suspect there are variations in the gearboxes attached to these motors. The important point is that both of those numbers are very different from 32.

...R

The pin sequence for 28BYJ-48, 5 wire unipolar, full step is: 0001, 0010, 0100, 1000, 1 pin HIGH at a time.
The stepper library for 4 wire bipolar, puts out: 1001, 0101, 0110, 1010, 2 pins HIGH at a time, switching polarity.
That's why it cannot drive the 28BYJ-48 properly.
Here's the 28BYJ-48 half step sequence ( 8 steps, 4096 steps per rev).

JCA34F:
The stepper library for 4 wire bipolar, puts out: 1001, 0101, 0110, 1010, 2 pins HIGH at a time, switching polarity.
That's why it cannot drive the 28BYJ-48 properly.

That is not correct. With 2 1s and 1 belonging to one coil all is fine.
All input pins on uln2003 driver get inverted.
So "10" for a single coil enbles left side and disables right side of coil, because left gets 0V and right gets 5V with common middle 5V. So on right side of coild nothing happens.

Robin2:
All you need to do is insert the correct number of steps per revolution and the speed (in RPM) that you want the motor to move.

In other words, change the code in your Original Post so it has 2038 or 2048 instead of 32. I suspect there are variations in the gearboxes attached to these motors. The important point is that both of those numbers are very different from 32.

...R

Thank you very much Robin and everyone who replied. Really appreciated.

@HermannSW: Are you forgetting the red wire that connects the 2 coil center taps together?

JCA34F:
@HermannSW: Are you forgetting the red wire that connects the 2 coil center taps together?

The red wire has 5V constant, see right diagram:

Interesting posting from Jangeox, increases torque of 28byj-48 from 330gcm (right side) to 800gcm (left side):
"Change unipolar 28BYJ-48 to bipolar stepper motor"

Hi,
I made the mount for the barn door tracker,but now I am wondering, can a normal arduino stepper motor lift a plank of wood and a DSLR? The plank weighs about half a kg and the camera about half a kg too. The distance from the rotating point (the hinge) is 230cm.

feverdreamer1:
but now I am wondering, can a normal arduino stepper motor lift a plank of wood and a DSLR? The plank weighs about half a kg and the camera about half a kg too. The distance from the rotating point (the hinge) is 230cm.

There is no such thing as a "normal Arduino stepper motor". There are hundreds of different motors and you need to choose one with enough torque for your project.

Please post a diagram that illustrates how the lifting mechanism will be built and how the motor will be connected to it.

It seems strange that you would be thinking of lifting that much weight with a stepper motor.

Hello,
First of all, sorry for not giving the right information. I figured a drawing is easier and more understandable. I will attach it. As to the stepper motor model, it’s the 28BYJ-48. The one that comes in Elegoo’s super starter pack. By the way,there was a typo in my earlier post, distance is 230mm (228 really but just to round up). The motor will be connected with the threaded rod via a M6 coupling nut

Image from Reply #14 so we don't have to download it. See this Simple Image Posting Guide

Please note that smaller image files (640 x 480 should be fine) are kinder to those of us with slow or expensive internet connections.

...R

The screwed rod will greatly enhance the force available - it is like a reduction gear. However there will be a lot of friction in your system so it would be best to measure the torque required. There is a simple method for roughly measuring torque in Stepper Motor Basics

...R

Hi,
I will thoroughly read the links you have given and I will take into consideration what you've said next time I add an attachment.
Thanks.

@HermannSW:
I stand corrected and humbled. :-[