Acceleration Decceleration of a Stepper Motor

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 6.

Moderator: Benj

Post Reply
George_B
Posts: 128
Joined: Wed Jul 04, 2012 11:21 pm
Location: Greece
Has thanked: 51 times
Been thanked: 19 times
Contact:

Acceleration Decceleration of a Stepper Motor

Post by George_B »

Hi, merry christmas and all the best to you and your families!

As the title says, i am looking a way to implement an acceleration and deceleration of a stepper motor.

I guess it can be done somehow using interrupts for accurate timings for the ramps but i haven't try it yet.

Is there any example in flowcode for this task?

Thanks in advance
George

George_B
Posts: 128
Joined: Wed Jul 04, 2012 11:21 pm
Location: Greece
Has thanked: 51 times
Been thanked: 19 times
Contact:

Re: Acceleration Decceleration of a Stepper Motor

Post by George_B »

I would be grateful if someone could suggest any article or flowcode example with acceleration - Deceleration of a stepper motor.


Thanks
George

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Acceleration Decceleration of a Stepper Motor

Post by Benj »

Hello George,

Here is a basic example that uses timer interrupt to set the speed of the motor. The interrupt is currently set very slow so you can see what's going on. In practise you should be able to configure it to run much faster. You may also want to count the number of steps and ramp up the speed based on how many steps are left in that movement.
StepperAccelerateDecelerate.fcfx
(9.41 KiB) Downloaded 615 times

George_B
Posts: 128
Joined: Wed Jul 04, 2012 11:21 pm
Location: Greece
Has thanked: 51 times
Been thanked: 19 times
Contact:

Re: Acceleration Decceleration of a Stepper Motor

Post by George_B »

Hi Benj, i really thank you for your reply.

At the moment i use flowcode 5, would it be possible to have this example in that previous version of FC5?

Best Regards
George

organetic
Posts: 7
Joined: Tue Jul 29, 2014 6:45 pm
Has thanked: 1 time
Contact:

Re: Acceleration Decceleration of a Stepper Motor

Post by organetic »

I'm trying to implement a real time ramp on this project, but sadly, I don't have the matnh skills needed for this calculation.

The attached code has all the needed variables and already calculates the constant velocity delay for stepper motors,

The only missing part is the ramp, although the code already calculates how many pulses should be sent, during a predefined ammount of time for acceleration/decceleration.

There's also example C code for the arduino IDE that could be converted, but I would be extremelly happy to have some help.

I have seen many aproaches, with equations, for generating acceleration/decceleration in real-time with low impact on the processor at the following website:

http://www.embedded.com/design/mcus-pro ... -real-time

There's also a project, using one arduino, where it's possible to achieve a maximum of 25kHz of pulse output, with interrupts.

https://github.com/JJulio/AHRobot/blob/ ... eppers.ino

This one also has calculations for generating one kind of S-Curve.

Can someone open the attached file, take a look at it, and share some thoughts?

Thanks!
Attachments
StepperAccelerateDecelerateRamp.fcfx
(12.48 KiB) Downloaded 375 times

Post Reply