M2 vs. Marlin: Step/mm Calculations

After Dan Newman nudged me a bit in the comments to the Z axis calculations, I walked through the constants in Marlin’s Configuration.h file to see if they were all consistent. The earlier values sufficed to get going, but a bit of pondering suggested some tweaks.

The motor microstepping mode determines the number of (micro)steps per motor (single)step:

#define MICROSTEP16

That single constant implies all motors must run in the same microstepping mode. Typical stepper motors have 200 full step/rev = 1.8°/step, so 1/16 microstepping means 3200 step/rev.

However, each motor can have a different “gear” ratio that converts from motor rotation to linear distance, so you must measure or calculate the actual values.

For the X and Y axes, the motor pulleys have 18 teeth and the belt pitch is 2 mm/tooth, so one motor revolution drives the belt:

36 mm = 18 teeth * 2 mm/tooth
M2 - X axis motor pulley
M2 – X axis motor pulley

Each revolution requires 3200 steps, so the X and Y stages move at:

88.888 step/mm = 3200 step / 36 mm

Makergear uses 88.88 step/mm, rather than the rounded 88.89, but the difference across 250 mm amounts to 2.5 steps, so it doesn’t matter.

For the Z axis, the four-start leadscrew moves the stage 8 mm, so:

400 step/mm = 3200 step / 8 mm
M2 Z axis bearing - shimstock bushing
M2 Z axis bearing – shimstock bushing

The situation with the extruder drive isn’t quite so clear, because the actual filament movement depends on the effective diameter of the drive pulley’s teeth engaging the filament. Mechanically, the extruder motor runs a 5:1 gearbox, so each drive pulley rotation requires 16000 (micro)steps.

The filament drive pulley has 22 teeth and a 12.0 mm OD = 37.7 mm circumference:

424.4 step/mm = 16000 step / 37.7 mm
M2 - Filament Drive Gear
M2 – Filament Drive Gear

That’s measured at the tooth tip. If you think of the filament as being a belt, then you’d expect it to move precisely that distance… except that the teeth dig into the filament, so the effective diameter comes out a bit smaller and the step/mm value a bit higher.

Makergear’s default 471.5 step/mm is, indeed, larger, but the ratio of the two values seems both oddly familiar and eerily exact:

0.900 = 424.4 / 471.5

The “packing density” Fudge Factor (yclept extrusion multiplier by slic3r) that accounts for the difference between the drive gear OD and the actual filament motion runs around 0.9, with passionate arguments justifying more specific values. It looks like Makergear baked that number into the firmware, so the nominal slic3r extrusion multiplier should be pretty close to 1.0.

After a few quick measurements while getting the printer running, I settled on extrusion multiplier = 0.9, so the actual step/mm value in effect for the extruder works out to:

424.4 = (471.5 step/mm) * 0.9

Now, that would seem to imply that the filament skates along the top of teeth, but that’s not the case:

M2 extruder - filament embossing
M2 extruder – filament embossing

So, for whatever reason, the effective diameter of the drive pulley matches its actual OD. That will surely vary with a number of imponderables, including the setting for the clamp screw holding the bearing against the filament and drive pulley.

Being that type of guy, I favor baking the actual drive pulley OD into the firmware (because I can actually measure that value), then using the extrusion multiplier to account for the difference. I’ve heard cogent arguments to the contrary, but, for my purposes, the proper value for the extruder should 424.4 step/mm, with a corresponding extrusion multiplier change to 1.00 in slic3r’s configuration.

I wouldn’t be surprised in the least to discover:

  • I’m multiplying where I should be dividing (or the other way around)
  • There’s a squaring / rooting operation hidden somewhere in there (area vs length)
  • Another obvious blunder has tripped me up