laurb9 / StepperDriver

Arduino library for A4988, DRV8825, DRV8834, DRV8880 and generic two-pin (DIR/STEP) stepper motor drivers
MIT License
557 stars 228 forks source link

Not smooth movement #110

Closed guestisp closed 1 year ago

guestisp commented 2 years ago

I'm the only one seeing a not smooth movement ? There is a little jerk in the rotation , something a small delay... The same happens on TMC2208 and TMC2209 (in legacy mode, so they are drop-in replacement for A4988 and similiar)

This is the simple code I use:

    this->Stepper.enable();
    this->Stepper.stop();
    this->Stepper.setRPM(50);
    this->Stepper.rotate(3650);
    this->Stepper.disable();
laurb9 commented 2 years ago

What processor are you using ? wifi or bluetooth processing may preempt the main program on chips supporting those, especially single core with the stack implemented on the same cpu.

guestisp commented 2 years ago

esp32. the stepper code is running in a separated task on a different CPU core. seems that adding priority to the stepper task fix the issue but kills everything else (ie the webserver). now i'm testing with the non blocking code (i did a simple while loop on nextAction) and works a little bit better but still slow down when the webserver is sending the webpage

slowing down is not an issue, as long the exact amount of steps asked is done (maybe in a little bit more time). could you comfirm this?

any raccomandations for tmc2209?

laurb9 commented 2 years ago

The movement is based on step counter, so it will send the exact number of pulses requested, which translates most of the time to the same number of motor steps. Reversing direction, moving too fast, too much load etc may cause missed steps.

Some ESP32 versions are single core and some are dual core. Can you check which one is yours ?

There is a dedicated library for TMC, worth a try.

guestisp commented 2 years ago

it's dual

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.