To do 1400 RPM you wil need 4666 steps per second (0.214 milliseconds between steps). I suspect the stepper library uses delay() to time the steps. If you make a version of the library that uses delayMicroseconds() instead you might be able to get close to the desired speed, assuming your stepper can handle stepping that quickly at the load you are putting on it.
No need to suspect the Stepper library of anything! Look at the source - it uses millis() as its time control.
This could easily be converted to use micros().
However the problem is deeper - to get to high speeds momentum efffects are important and you need to smoothly accelerate the steps which is something Stepper can't handle.
I believe theres an AccelStepper library or something of similar name - try this...
/*
Moves the motor steps_to_move steps. If the number is negative,
the motor moves in the reverse direction.
*/
void StepperHighSpeed::step(int steps_to_move)
{
int steps_left = abs(steps_to_move); // how many steps to take
// determine direction based on whether steps_to_mode is + or -:
if (steps_to_move > 0) {this->direction = 1;}
if (steps_to_move < 0) {this->direction = 0;}
// decrement the number of steps, moving one step each time:
while(steps_left > 0) {
// move only if the appropriate delay has passed:
if (millis() - this->last_step_time >= this->step_delay) {
// get the timeStamp of when you stepped:
this->last_step_time = millis();
// increment or decrement the step number,
// depending on direction:
if (this->direction == 1) {
this->step_number++;
if (this->step_number == this->number_of_steps) {
this->step_number = 0;
}
}
else {
if (this->step_number == 0) {
this->step_number = this->number_of_steps;
}
this->step_number--;
}
// decrement the steps left:
steps_left--;
// step the motor to step number 0, 1, 2, or 3:
stepMotor(this->step_number % 4);
}
}
}
I've found in the code a millis() option, but there is something that i don't understand, if i try to change for micros() the motor is hiss, so how can i change things to be able to read microsecond delay step ??
That calculates the number of microseconds between steps to get the RPM speed specified.
Try a super- slow speed like 30 RPM (1/2 revolution per second) for testing. Then slowly increase the speed until you reach 1400 or the limit of your stepper motor.
Hi Thanls for your answer,
I think that we have to look for others solutions....
I've try with your idea and when I arrived around 345 RPM the motor start to work in a strange way....
The chart that shows pps up to 4000 also says HALF STEP. Since the motor does 400 half-steps per revolution that's only 10 RPS (600 RPM). Maybe if you figure out how to do half-step driving you can get it up to that speed. It's still less than half your desired speed.
Perhaps if you said why you want a stepper to run that fast somebody could recommend a solution that will work. There are many kinds of motors that can turn at a controlled speed and/or stop in a specified position.
HI Johnwasser, thanks for your answer, i'm trying different option and nothing with this motor... I'm looking around of the ACEELSTEPPER LIBRARY...
Anyway, the project is to modify a 16mm projector and be able to control it trough a Laptop... is for that the stepper motor... Cinema running at 24 images per second...
Anyway, i don't understand the Rubenjohnson answer ???