M2 vs. Marlin: Speed Calculations

Knowing the number of motor steps required to move an axis by 1 mm, the next step is to figure out how fast each axis can possibly move, given the restrictions of the Marlin firmware driving the motors.

Dan Newman pointed out that Marlin runs with a maximum 10 kHz interrupt rate, with up to four steps issued per interrupt. The constant controlling (or at least defining) that is in Configuration_adv.h (with a comment that seems irrelevant to the M2’s setup):

#define MAX_STEP_FREQUENCY 40000       // Max step frequency for Ultimaker (5000 pps / half step)

Below the 10 kHz rate, the step interrupt occurs whenever the next step must happen, so it does not have a constant frequency. Above 10 kHz, the steps (seem to) emerge in bursts, so there’s likely a good bit of jitter that I should measure. In any event, there’s an obvious loss of resolution at high speeds, which is a problem common to all variable-frequency pulse generators that’s worse for relatively low-frequency software generators used in high-speed applications.

In any event, these numbers show the absolute maximum possible speed for each axis:

  • X and Y axes: 450 mm/s = (40 k step/s) / (88.89 step/mm)
  • Z axis: 100 mm/s = (40 k step/s) / (400 step/mm)
  • Extruder: 94.3 mm/s = (40 k step/s) / (424.4 step/mm)

Due to the low torque available from the Z axis motor, the actual maximum speed seems to be around 30 mm/s = 1800 mm/min. After I replace the motor, I’ll measure the actual performance and see what’s reasonable.

One could quibble about the extruder, as the extrusion multiplier affects the final speed. The extruded thread squirts out at a pretty good clip if the motor turns at full speed:

2350 mm/s = (1.75 mm)2 / (0.35 mm)2 * 94 mm/s

It’s not clear the hot end can melt plastic fast enough to keep up with that pace more than momentarily, but I haven’t measured that yet.

However, if the X and Y axes both move at 450 mm/s, then the nozzle moves at 640 mm/s = √2 * 450 mm/s relative to the platform, so the maximum extruder speed while printing will be roughly:

26 mm/s = (640 mm/s) * (0.35 mm)2 / (1.75 mm)2

That assumes the printed thread has the same cross-section area as the nozzle, which is roughly true for my choice of output:

  • Thread: 0.1 mm2 = 0.4 mm wide * 0.25 mm thick
  • Nozzle: 0.096 mm2 = pi * (0.35 mm)2 / 4

If you bake the extrusion multiplier into the step/mm value, then compute the maximum speed without applying the same multiplier in slic3r, the plastic should come out of the nozzle at the same speed.

So the speed setup looks like this:

#define DEFAULT_MAX_FEEDRATE          {450, 450, 30, 94}    // (mm/sec)

One thought on “M2 vs. Marlin: Speed Calculations

Comments are closed.