# How to calculate the proper layer height multiples?

We all know, that the best layer hight is, when you have multiples of full steps. If it is not, sometimes steps get skipped and end up bad layer-to-layer adhesion when one height step missed a tiny bit and then the next catches up, creating an extra-thick layer. For example, this was printed somewhat deliberately, and here, the extra spaced layers are perfect for delaminating the print with just a fingernail:

The Ender 3 I have uses the following Z-Rod:

• Diameter 8 mm
• 4 flutes
• ca 13 Threads per inch
• That is according to the table, a 2 mm pitch for one thread.
• As a result, it's an 8 mm pitch for each of the 4 threads.

The firmware (Marlin) I use claims in configuration.h that the NEMA17 motor would be using 400 Steps per mm in Z. configuration_adv.h tells that the microsteps on the Z-axis motor are 16.

In the printer's menu, Babystepping is in increments of 0.049 mm (though some rounding error seems to be there: 5 Babysteps are 0.250 mm).

• Note that this is only an issue on printers without high-quality microstepping drivers for the motors. – Mark Sep 8 '19 at 19:45
• Is the image in your question actually something you're having a problem with? It looks unrelated to layer height being a multiple of whole step, so aside from your question being valid and meaningful as stated, there may also be an XY problem here. – R.. GitHub STOP HELPING ICE Sep 8 '19 at 19:51
• @Mark: Indeed, I switched to using multiples of 0.04 on my Ender 3, but I don't think it actually helped anything. As tested here, the A4988 stepper drivers which are stock on Ender 3 don't seem to have a serious problem with microstepping accuracy, and I think that's especially true if you're moving by more than 1-2 microsteps (typical layer move is between 35 and 100 microsteps) at a time. If there's interest I might do some test prints and post an answer (or a new Q & A) with the results. – R.. GitHub STOP HELPING ICE Sep 8 '19 at 19:55
• @R.. the picture was created by purposefully setting the layer hight to accumulate an error that ticks over. – Trish Sep 9 '19 at 0:39
• @Trish: You mean something like 0.2-0.04/16? I'd like to try to reproduce it. Do you perhaps have a really early Ender 3 that had bad stepper drivers or had them in the wrong mode? I seem to recall that being an issue they fixed early on. The test print looks like it has more problems going on than just inconsistent layer height. – R.. GitHub STOP HELPING ICE Sep 9 '19 at 0:45

## 2 Answers

that the NEMA17 motor would be using 400 Steps per mm in Z. configuration_adv.h tells that the microsteps on the Z-axis motor are 16.

Easy. There are 400 microsteps in a millimeter, and 16 microsteps in a full step. So, there are 400/16=25 full steps in a millimeter. So a full step is 1/25th of a millimeter, or 0.04 mm. Your layer height should be a multiple of this.

As your leadscrew has a lead of 8 mm (i.e., a full rotation will move the Z-axis by 8 mm), a full step is either 8/200=0.04 mm (for a 1.8 degree stepper) or 8/400=0.02 mm (for a 0.9 degree stepper). So, apparently, you have a 1.8 degree stepper (and this is the most common type of stepper).

I see you've already accepted an answer, but based on your comments I think you have some misunderstandings of the topic which are worth clarifying as part of answering this question.

0.2125 layer height (+1/4 microstep) and doing all the movements in absolute movements instead of relative forced the result, as the target heights were as a result at 0.2125 mm (for the stepper that's effectively a 0.2 mm), 0.425 (0.4), 0.675 (for the stepper that's, depending on rounding or truncting, 0.6 or 0.7), 0.9 (here they are both 0.9) and so on.

It sounds like your understanding is that the stepper driver is "rounding"/"truncating" to Z positions that are multiples of 0.1 mm. Perhaps that's based on the LCD status display of the Ender 3's firmware, which is based on Marlin 1.0 or something around that version, and shows current coordinates rounded or truncated (I forget which) to one decimal place. This does not have anything to do with the positioning limitations of the actual machine; it's just bad user interface design.

The actual firmware position is translated from the floating point value in the gcode to the nearest step/microstep that the stepper driver can represent. With full steps being 0.04 mm, microsteps are 0.0025 mm (1/16 of a step). All of these positions are "exact" in a logical sense, but of course subject to physical limits of the mechanical parts and accuracy of microstepping. On the topic of microstepping accuracy, you should read How Accurate Is Microstepping Really? Most if not all models of the Ender 3 have A4988 stepper drivers, one of the chips reviewed in that article. But the important part is that there's no rounding/truncation to whole steps taking place. Rather, the stepper driver is trying to position the motor in between whole steps by balancing the magnetic fields pulling it in each direction, with the goal of producing a linear interpolation between the two adjacent full steps. How well it does this is a matter of the quality of the stepper drivers and the load on the motor.

Back to your test, your layer height of 0.2125 mm is not one step plus 1/4 microstep. It's 5 steps (5 * 0.04 mm) plus 0.0125 mm which is 5 microsteps. This is probably a decent test - 5 is 1 mod 16, so you'll end up with a period-16 cycle of microstep positions, at 5, 10, 15, 4, 9, 14, 3, 8, 13, 2, 7, 12, 1, 6, and 11 microsteps mod the whole step. This is pretty close to a period of 3, so you might expect to see some irregularity from poor microstepping accuracy that looks periodic every 3 layers, or you might see it repeating only every 16 layers (every 3.4 mm). But regardless I would not expect delamination problems from this. I think there's another serious extrusion problem behind the photo in your question, and you should probably open a new question about what it might be.

• well, after some tweaking with the printer, the effect I was aiming for was probably helped by the extruder lever being broken. As said, the print was deliberately made to fail. But oyu mention some very good points how I failed to properly fail (the iteration of the error-layer was btw quite consistently every 1.2 mm, about every 10 layers) – Trish Sep 11 '19 at 13:30