Welcome! Log In Create A New Profile

Advanced

Independent motor speeds for all axis

Posted by v1talogy 
Independent motor speeds for all axis
July 30, 2018 12:08PM
Hello,

TL;DR: Is it possible (that is, within reason and not having to rewrite half the code) to make each motor turn at an independent speed from the others?
I am aware that the objective of the Marlin FW is for CNC type applications (and thus the speed of each axis should be related to the others), but would it
be a reasonable approach to change the Firmware for independent motor speed control?

The Marlin FW has great stepper motor control implementations and I would like to make use of it, if possible.

I am using an Arduino MEGA2560 with a RAMPS1.4 board and would like independent speed control for each of the axis, these would be the X, Y, Z, E and 'F' axis.
I have looked into this myself extensively and keep on getting lost in all the code (specifically stepper.cpp and planner.cpp).

At the moment I am setting a new destination for each axis and then resetting the "current position" once the motor has turned the requested amount.
I do this repeatedly in the main loop function and it is working ok. My problem is, once I change the speed of one motor the others also change speed
relative to the change made to the current axis (in real time). Basically I am doing this, for example:

destination[X_AXIS] = 0.05; // Example value
planner.buffer_line(X_AXIS, _more arguments here_); // I keep the feedrate constant
current_position[X_AXIS] = destination[X_AXIS]; // Reset the axis position

I also tried to load the buffer (I would 'simulate' reading a file) to use the FW as it is supposed to be used (as much as possible).

Something like:
char some_message[16];
sprintf_P(some_message, PSTR("G0 X%i Y%i, Z%i"), X_Speed, Y_Speed, Z_Speed); // Example
enqueue_and_echo_command(some_message);

The above approach has the same effect, each change in a single axis motor speed affects the others (as it should).

So to repeat my TL;DR question... is it feasible to use the Marlin FW for independent motor speed control, and if so, how can I go about doing this?
Please note that I do not ask for a detailed answer, just a 'yes' with a hint/suggestion or 'no' with a reason why would be very helpful.

Thank you.

Edited 1 time(s). Last edit at 07/30/2018 12:13PM by v1talogy.
Sorry, only registered users may post in this forum.

Click here to login