Acceleration/Deceleration function for Stepper Motor.

Post here to discuss any new features, components, chips, etc, that you would like to see in Flowcode.
Post Reply
humax
Posts: 2
http://meble-kuchenne.info.pl
Joined: Wed Apr 24, 2024 5:33 pm

Acceleration/Deceleration function for Stepper Motor.

Post by humax »

Stepper Motor Acceleration/Deceleration function like AccelStepper library for Arduino.

I don't get why it's still not implemented yet and who needs stepper motor control with no acceleration/deceleration at all.

BenR
Matrix Staff
Posts: 1760
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 447 times
Been thanked: 607 times

Re: Acceleration/Deceleration function for Stepper Motor.

Post by BenR »

Hello,

It's all about how often you call the step macros. If you have it called as part of a loop or as part of a timer interrupt then you vary the delay in the loop or the speed of the interrupt to control the acceleration/deceleration of the motor. Doing this in a universal way as part of the component itself is tricky. Maybe we could make use of a timer in a general way, I'll have a think on it and see if there's a universal way that this could work.

humax
Posts: 2
Joined: Wed Apr 24, 2024 5:33 pm

Re: Acceleration/Deceleration function for Stepper Motor.

Post by humax »

Hi,
But with the method suggested my computer monitor isn't big enough to fit all that while is very simple in Arduino IDE with use of AccelSteper library. If it's implemented with Arduino why it's hard to implement the same function in Flowcode software? So what's the point of using this software vs Arduino then if Arduino has obvious advantage?

BenR
Matrix Staff
Posts: 1760
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 447 times
Been thanked: 607 times

Re: Acceleration/Deceleration function for Stepper Motor.

Post by BenR »

Hello,

Arduino is targetting a handful of specific microcontroller devices and the library is likely targetting only a subset of these. So if you're using one of those devices and you're not using the timer resource required by the library elsewhere in your program then it should work fine. The downside is when you're already using the timer elsewhere or you need a different MCU or want to do anything other then prescribed by the library (e.g. more then one instance of the library) you're suddenly on your own.

With Flowcode we try to make component libraries that work with everything and provide transprancy about what peripherals will be used and where possible allow users to configure the peripheral so they can correctly allocate resources and make full use of the MCU. The downside with this is that it's a bit more complex as you have more options.

Ideally you want to be able to ramp up and down multiple motors at once using the same timer, I'll have a think and see if I can come up with something that will make this easy and work universally. Probably a reworked version of the timed interval component that allows for a min and max timings and a configurable ramped profile.

Not sure what you mean about not having a big enough monitor.

Post Reply