gin66 / FastAccelStepper

A high speed stepper library for Atmega 168/328p (nano), Atmega32u4, Atmega 2560, ESP32, ESP32S2, ESP32S3, ESP32C3 and Atmel SAM Due
MIT License
286 stars 67 forks source link

Hardware for high speeds and accelerations in multi-axis configuration #121

Closed DSMaryam closed 2 years ago

DSMaryam commented 2 years ago

Hi ! First, thank you for the great work you have produced here.

I would like to use a compact hardware configuration for multi axis control (2 motors or 3). Currently, the best I have is an Arduino Portenta equiped with STM32H747, but I understand STM is not covered by the library ; is there a way it could be render compatible ?

Or, rather than Portenta, what would be my best options to get multi axis high speeds and accelerations in a compact arduino, or other hardware, using FastAccelStepper ? For comparison, the performances I get with one motor on atMega32U4 are right just sufficient for my application.

Thank you in advance !

gin66 commented 2 years ago
  1. The STM32 is not supported by FastAccelStepper. I had a short glance at ST's website (haven't looked into the details/terms of use/features), but I have seen ST offers stepper motor drivers. Can you make use of those ? If not, I would like to hear your feedback about your reasoning. Otherwise, reinventing the wheel does not make sense.
  2. The STM32 is a powerful device, perhaps AccelStepper can be of help ? This works without HW-support, but if an AVR is sufficient, then the STM32 would be only idling around with your app+running stepper motors.

A port to STM32 is for sure a possibility and - from what I have seen - FreeRTOS is used, which is the same like esp32. So basically only the low level driver would be necessary to be implemented. Implementation could be done within approx. 2 days. But as I have no STM32-dev-system available and no weekend to spare in the coming weeks, STM32 support is not on the horizon. Any pull request will be appreciated.

What is not clear, what you mean with high speed ? The AVR family is not such powerful and with step rates of 40 kHz in dual stepper operation, somehow 50% (or even more) will be consumed by the stepper. If this is not an issue, then that would be a good solution. Runs very reliable. Remaining issue with ATmega32U4: you may run into memory footprint issues. For the example/StepperDemo, just for that device I had to spent a couple of hours to reduce code size.

So you're best option is an ESP32, which is quite affordable and can provide nifty features with BT and WiFi. Just BT/WiFi would be bit of risk for stability....

DSMaryam commented 2 years ago

Many thanks for this detailed response !

The big problem with ST stepper motor drivers is that, for some reasons, it has become difficult to order them (distributors' stocks are low) and I would be very annoyed to start working with a technology and not be able to order it anymore in the future. Plus, adding my compact constraint reduces the choice on drivers. Same goes for Trinamic drivers that can also be very powerful. I thought I would never have this problem with Arduinos.

I will definitely try using my Portenta with AccelStepper.

To be more precise, high speeds and accelerations for me are at the order of 100k microsteps/s and 1M microsteps/s^2. I will probably go on and try ESP32, for the fun of being impressed, although there may also be the ordering issue ;)

gin66 commented 2 years ago

100kSteps/s will be difficult for AccelStepper. FastAccelStepper supports 100kSteps/s only with esp32. Best to get this.

DSMaryam commented 2 years ago

Alright, thanks again !