-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Losing steps #4
Comments
I've noticed the same thing. Mine is much more dramatic at lower speeds though. In fact, I can actually see the motor shaft spin in the opposite direction for a brief second during the rotation. I'm using a Nema 17 stepper with a DRV8825 Stepper Driver. Using the regular stepper library i get perfect alignment back at the starting point no matter how many starts and stops I make. With this library, it never winds back up at the same place it started unless I crank the acceleration up to like 100x the Steps Per Second, which defeats the purpose of using the accel library. |
I had the same problem, it is because during a change of direction, the signal on the DIR pin changes too quickly compared to the signal on the STEP pin. The driver does not yet take into account the change of direction and the first pulse is incorrect. |
But I am not making a direction change when I see the problem. Why would a problem with he direction pin cause the motor to sin in te opposite direction in the middle of a movement in one direction? |
Hello, void moveTo_wait(long step){
long dist = stepper.distanceToGo();
if(dist > 0)
digitalWrite(pinDir, HIGH);
else
digitalWrite(pinDir, LOW);
delay(10); // added delay (10 ms)
stepper.moveTo(step);
} Based on my measurements, the change time is about 10us, which is not suitable for the driver. |
Looks like that would be here: AccelStepper/src/AccelStepper.cpp Line 414 in 1255ab5
A DRV8825 driver needs a 650ns setup time per https://www.ti.com/lit/ds/symlink/drv8825.pdf An A4988 needs 200ns per https://www.pololu.com/file/0J450/A4988.pdf If the existing delay isn't long enough, you could add another delay after it like:
|
test Stepper.txt
Hi, I'm using the library with a Stepper driver (only use Pulse pin and Dir pin).
I'm running an example (one revolution forward, one revolution reverse).
I notice that it's losing about 1 degree each iteration. If I let it run for a while the zero moves a lot.
I try it with different accelerations, low speeds, medium speeds.
The text was updated successfully, but these errors were encountered: