Controlling two steppers simultaneously for a high precision movement path. Ideas for which method to use?

Hi poenwnl,

What you appear to have is a set of XY co-ordinates that could be almost directly converted into Gcode commands with a simple script, I don't think you need any software to do it as such. Gcode does not have time as a parameter, but it does have feedrate (i.e. speed).

I'm going to assume units of mm and seconds for the following:
If I use your table as an example, you start at t = 0 with (x, y) = (0, 10). You then move to (x, y) = (10, 0) at time 1.2s. Using pythagoras, this gives a distance travelled of 14.14mm. Speed will therefore be 14.14 / 1.2 = 11.78mm/s. Gcode uses units of mm/minute for feedrate, so this will become 11.78 x 60 = 707mm/min. Your Gcode is now quite straightforward:

G0 X0 Y10 - this will 'fast travel' to your starting position
G1 X10 Y0 F707 - This will move to your next location at the speed (hence time) that you requested
... repeat!

The above text is what you should be streaming to your Grbl controller - it will then pulse the stepper motors to make the movements required.

Gcode takes XY positions - it is only the feed rates that you need to calculate, together with any unit conversions. If you have all your t, x and y variables calculated you have to create the above as a text file, something that should be straightforward in Matlab or maybe a simple script (Python?). You don't need to calculate the pulses at all - Grbl will pulse the steppers for you. Your only problem is calculating the feed rates for each movement.

A starting point for this might be putting Grbl on to an Arduino Uno, then connecting to the Uno using a terminal emulator (Putty?). You will then find it is as easy as typing "G1 X10 Y0 F707" to get the movement you want.

Hope this makes sense!

Steve

1 Like