pkerspe / ESP-FlexyStepper

This library is used to control one or more stepper motors from an ESP32 device. It is based on the FlexyStepper library by S.Reifel but provides some additional functionality
MIT License
149 stars 32 forks source link

Multi axis performance #2

Closed vanniaz closed 4 years ago

vanniaz commented 4 years ago

Hello, this is just a request for clarification, not a real issue.

I have to choose a library to control up to 6 stepper motors at the same time. I do not need interpolation, I only need to start the motors in parallel, possibly with different speeds and different target distances. The acceleration/deceleration ramps will be fixed and equal for all motors. Now I see that your library is based on the original FlexyStepper, which has a poor performance on the AVR (7 kHz max for a SINGLE motor, while grbl on AVR is capable of 30 kHz with interpolation!).

You do not give any performance figure for your library on the ESP32, do you expect it to be capable of handling 6 axes in parallel? At what maximum frequency?

Of course I could try it but this takes some time to write a test program, checking the output with an oscilloscope etc., so maybe that you already have the answer.

Thank you very much. Giovanni

pkerspe commented 4 years ago

I cannot provide any performance measurements, the step signal generation is exactely the same as the one in flexystepper. The processMovement function is called in a separate task that runs on the second core of the ESP32.

Performance is dependent on multiple factors:

Setting up the ESP Stepper Motor Server takes no longer than 5 minutes if you simply use the provided examples and use PlatformIO (if you have set it up before to have the required ESP32 libraries in place).

Oh, and regarding the requirement to start all 6 steppers at the exact same time: this is not possible, since it would require direct access to IO registers for parallel change of IO states which I could not figure out so far using the ESP32-Arduino-Linraries. The ESP StepperMotor Server iterates through all existing stepper configurations and sends the step signals one after another, so you will have some microseconds delay between the first step signal and the last step signal for sure.

If you seek for such high precision in timing with high step frequencies for multiple axis, you might want look into commercial solutions.

pkerspe commented 4 years ago

BTW the original FlexyStepper was never tuned to performance as in maximum frequency but rather in smooth acceleration and the possibility to change target positions during movement. You should probably check out the SpeedyStepper library instead as stated in the readme of FlexyStepper

vanniaz commented 4 years ago

Thank you for your reply. Yes, I already have PlatformIO and the ESP32 libraries on my PC, so I will give it a try (I have to choose between ESP-FlexyStepper and Grbl_Esp32). In my application a simultaneous start of all the axes is not required (i.e. a delay of even a few milliseconds would be tolerated).