I am a complete beginner in programming as well as in electronics. Therefore I hope to get your help.
I am trying to learn how to use a Nema 8 bipolar stepper motor. I am using a standard Arduino Stepper library, Arduino UNO board, H-bridge and external power supply. I am able to control the motor. But here is the problem: the motor works good at any rpms between 1 to 300 rpms, determined by the setSpeed function. As soon as the speed increases more than 300, say 301, 350, 600 etc the motor does not move. Can you give me some an idea why?
The motor has a step 1.8 degree.
Thank you.
This is the code that sets the delay from the speed:-
/*
Sets the speed in revs per minute
*/
void Stepper::setSpeed(long whatSpeed)
{
this->step_delay = 60L * 1000L / this->number_of_steps / whatSpeed;
}
I think at 300RPM the delay goes to zero so it won't go any faster. Any greater and the delay wraps round and becomes very large which is why you don't appear to see it moving. Just a guess though I haven't plugged the numbers into it.
Thanks, I will try. I just do not understand where should I put this code: into my code or this has to be added into Stepper source code? Do you now where can I find a source code for the stepper.h library. In this way I will probably be able to understand mode deeply what is going on inside the code.
I just do not understand where should I put this code:
No that IS the code that is in the library, it is my suggestion as to why it will not go over 300 RPM because the delay it calculates is too short.
If you stick to this library there is nothing you can do to increase the speed.