Calculating E_STEPS_PER_MM for the Reprap Mendel

UPDATE: Nophead now covers this better in this post.

In the course of building my extruder I chose not to modify my stepper motor. Instead of having a splined shaft on the motor I decided to use a splined pinch wheel similar to the brass M4 insert used in the geared extruder driver. My pinch wheel is shown below in Figure 1. By making some simple assumptions and using basic geometry I was able to calculate the necessary firmware parameter to accommodate my changes from the original design.

Figure 1: Splined pinch wheel. It is designed to fit a shaft with a diameter of 5mm and is fixed in place using a M3x3 grub screw.

I wanted to keep the motor unmodified so that it would be interchangeable with any of the other motors I’ve used on the reprap. The upside of this is that I don’t need to keep a separate modified motor as a spare just for the extruder. The downside of this is that the default value for E_STEPS_PER_MM used in the reprap motherboard firmware would not be correct for my extruder.

What does E_STEPS_PER_MM do?

E_STEPS_PER_MM is defined in the firmware documentation as “the number of steps that the extruder stepper needs to take to produce one millimetre of filament.” The firmware then uses this value to calculate the number of steps needed to drive the extruder in relation the print head’s current horizontal movement. If this value is wrong then the reprap will push out too much or too little extrusion into the print.

In the absence of any commissioning information in the official wiki for the reprap, once construction of the reprap was complete, I was left to adjust the value empirically.

As I had no way of knowing just how different my untested design would be to whatever extruder was used to determine the values given in the code, I wanted another way to determine this value. These calculations are used as a check to avoid wasting plastic and the possibility of breaking the extruder first time.

To simplify things I chose to calculate the parameter by treating the filament and melted plastic as an incompressible fluid. This simplification should hold true once the system is in a steady state extruding plastic. If no material leaks out, is absorbed into the body of the extruder itself, or is vaporized, then logically the volume of material that goes into the system must also leave the system. This also assumes that there is no thermal expansion or any change in density of the material (which is what I really mean when I say “incompressible”). Figure 2 below shows a diagram of my greatly simplified model of the system.

Figure 2: Model of the simplified system shown with the extrusion chamber shown as a grey box.

Bear in mind that I’m not a mechanical or chemical engineer. I’m an electrical engineer, so my calculations and assumptions might be way off. If anyone knows a better way to model and or calculate this sort of thing, I’d love to hear from you.

What goes in, must come out

Calculating the volume of filament entering the extruder:

The volume that goes into the extruder is the cross sectional area of filament multiplied by the length fed in. This assumes the filament is a perfect cylinder.

rf = 0.5 × Øf (filament diameter)
CSAf(filament cross sectional area) = π × rf²
volf (filament volume per revolution) = CSAf × lenf

Assuming the filament is moving at the same speed as the outermost point on the teeth of the drive gear or surface of the pinch wheel then the length of filament fed in should be the same as the linear distance travelled by the outside of the pinch wheel. This is assuming that no slippage, no compression, and no deformation of the filament occur.

A point on the outside of the pinch wheel travels a linear distance of one circumference per revolution. This is calculated by π multiplied by the diameter.

ØPW (pinch wheel diameter)
lenf (filament length per revolution) = π × ØPW

The total volume entering the extruder per step is easily calculated by dividing the volume per revolution by the number of steps per revolution. If a gear reduction is used between the stepper and then the steps per revolution are multiplied by this ratio.

RM:PW (ratio of motor rpm to pinch wheel rpm)
steps360 (motor steps per revolution)

step-volf (filament volume per step) = volf
steps360 × RM:PW

Real world examples

In addition to the standard extruder I have also built a version of Adrian’s geared extruder. My version of this is shown in Figure 3 below. The ratio for this gear reduction is 5:1. I will compare this with the standard splined shaft extruder in the calculations below.

Figure 3: A geared extruder. The large gear has 55 teeth and the small gear has 11 giving a 5:1 reduction.

Using filament with a nominal diameter of 3mm gives:

rf = 0.5 × Øf = 1.5mm
CSAf = π × rf² = 7.07mm²

For a standard reprap using a 5mm diameter splined shaft:

ØPW = 5.0 mm
lenf = π × ØPW = 15.7mm
volf = CSAf × lenf = 111mm³

With a 200 steps per revolution stepper motor, driven using half steps and directly driving the pinch wheel:

RM:PW = 1

step-volf = 111mm³
400 × 1

step-volf = 0.278mm³

Alternatively, with the same motor driven using half steps but driving via a 5:1 gear reduction and a 8mm brass insert:

ØPW = 8.0 mm
lenf = π × ØPW = 25.1mm
volf = CSAf × lenf = 177mm³
RM:PW = 5

step-volf = 177mm³
400 × 5

step-volf = 0.0885mm³

This means that for each half step of the motor the original extruder draws in 0.278mm³ of plastic. If the geared extruder is used then the volume of plastic drawn in with each step of the motor is an order of magnitude lower at 0.0885mm³. This means that the geared extruder should have much finer control as well as increased torque.

Calculating the length of extrusion leaving the extruder:

The output of the system is via a smaller diameter nozzle. Working from our main assumption, what goes in must come out, the system must extrude all of the material entering the system but with a smaller cross sectional area.

Assuming the extrusion is the same as the nozzle diameter:

Øe (extrusion diameter) = ØNOZZLE
re (extrusion radius) = 0.5 × Øe
CSAe (cross sectional area of extrusion) = π × re²

Reworking our formulas from above gives us the length from a known volume. This assumes the extrusion, like the filament, is also a perfect cylinder.

lene (length of extrusion)
vole (extrusion volume ) = lene × CSAe

lene = vole

Substituting in the known volume drawn into the system per step:

vole = step-volf

lene = step-volf

This is the length of extrusion output per step. By inverting this we get the number of steps per mm of extrusion required by the software.


Real world examples (continued from above)

A nozzle with a 0.5mm hole and using a splined 5mm shaft direct drive system from above:

Øe = 0.5mm
step-volf = 0.278mm³ (from earlier example above)
re = 0.5 × Øe = 0.25mm
CSAe = π × re² = 0.196mm²

E_STEPS_PER_MM = 0.196mm²

E_STEPS_PER_MM = 0.705

A nozzle with a 0.5mm hole and using a 5:1 gear reduction and a 8mm brass insert from above:

Øe = 0.5mm
step-volf = 0.0885mm³ (from earlier example above)
re = 0.5 × Øe = 0.25mm
CSAe = π × re² = 0.196mm²

E_STEPS_PER_MM = 0.196mm²


These values match up well with the values for the standard extruders given in the firmware.

Tying it all together

After reading through the working above you can see the result is proportional to the ratio of the square of the diameters and some of the terms will cancel out.

Combining and simplifying gives a single formula:

E_STEPS_PER_MM = ØNOZZLE² × steps360 × RM:PW
Øf² × π × ØPW


Øf =  filament diameter
ØPW =  pinch wheel diameter
ØNOZZLE =  nozzle diameter
steps360 =  number of steps per revolution
RM:PW =  ratio of motor revolutions to pinch wheel revolutions

Below in Listing 1 are my changes to configuration.h to automatically calculate the steps per mm based on the characteristics of the extruder. This is calculated when the main firmware is compiled. I’ve also created a google spreadsheet here to help calculate the same value if you just want the number to throw straight into configuration.h. These values form a good starting point for the inevitable fine-tuning which is required later.

// calculated assuming non-compressible fluid and perfect 
// cylinder filament and extrusion etc so tweaks probably be
// needed. basically what volume goes in must come out.
#define FD 3.0   // = filament diameter (3mm)
#define ED 0.5   // = extruded diameter (0.5mm)
#define PWD 8.0  // = pinch wheel diameter, outer diameter 
                 //  of teeth on my custom brass knurled gear
                 //  (7mm)  or brass insert (8mm)
#define GEAR_RATIO 5 // = drive gear ratio (1 normally,
                     //   5 for 5:1 geared drive)
#define E_STEPS_PER_REV 400 // number of steps per revolution 
                            // (I'm using a half steps drive)

#define PI 3.14159265359                                //*RO
#define FL (PI * PWD) // filament length fed in one rev //*RO
#define R1 (FD/2)     // radius of filament going in    //*RO
#define R2 (ED/2)     // radius of extruded filament    //*RO
#define EL ( (FL*R1*R1)/(R2*R2) ) // length extruded    //*RO


Listing 1: Automated calculations added to configutaion.h

Any thoughts, comments and ideas are always welcome.

12 Replies to “Calculating E_STEPS_PER_MM for the Reprap Mendel”

  1. Cool, but in your formula you call it “nozzle diameter” whereas in the Configuration.h you call it “extruded diameter”. (The latter is more correct because then you should be considering die swell)

  2. Absolutely true, but I do make the assumption that the die swell is negligible “Øe (extrusion diameter) = ØNOZZLE“.

  3. Well I don’t think it is negligible really, if the nozzle is 0.5mm the extruded plastic will come out at ~0.7mm or maybe 0.8mm (depending on the type of plastic used) which seems to have quite a dramatic effect when plugged back into your equations.

    Another thing, your Real world examples are based on driving the stepper using half steps (400 steps / rev). Unless I am mistaken the empirical value of 0.706 in the default configuration.h is based on full steps (200 steps / rev) How do you explain that discrepancy?

    Anyway, I had much the same trouble as you coming up with the correct E_STEPS_PER_MM value and like you I also had a conrad electronics brass insert. In the end I set E_STEPS_PER_MM to 1.0 and adjust the extrusion amount using the extrusion multiplier in my host software (Which is Repsnapper) This saves me having to re-flash the firmware each time I decide to change it. Its also easier to switch from ABS to PLA that way, since PLA seems to need a larger value.

  4. I don’t think this is quite right. Speaking to Adrian I think the steps per mm is for the extruded filament run, so the area is rectangular rather than circular and you need to know the layer height and filament width.

    Your formula is the way I do it though, but I always use layer height = 0.8 * diameter and width = 1.2 * diameter. That gives a squashed ellipse with an area of about 0.82 times the rectangle.

  5. I wrote this python script to calculate e_steps_per_mm

    import math

    def getValue(prompt,default):
    print prompt + ” (” + str(default) + “): “,
    val = float(raw_input())
    return val
    except ValueError:
    return default

    fd = getValue(“Filament Diameter”,3.0)
    ed = getValue(“Extruded Diameter”,0.7)
    pwd = getValue(“Pinch Wheel Diameter”,7.0)
    sr = getValue(“Steps Per Revolution”,400)
    gr = getValue(“Gear Ratio”,1)

    fl = (math.pi * pwd)
    r1 = (fd/2)
    r2 = (ed/2)
    el = ( (fl*r1*r1)/(r2*r2) )
    e = (sr * gr / el)

    print “E_STEPS_PER_MM = ” + str(e)

    looking forward to seeing a “revised” formula, if you still intend on doing one.

  6. Nice work.
    Yeah I hope to get a new formula up. I’ve just got my extruder temperature sorted and found away around a bug in the host software to give really good prints.

    Now I have a consistent extruder I hope to revise my maths against what I actually produce.

    Have you managed to get good results from using your python script above?

  7. Thank you very useful I used your open office sheet to calibrate my new extruder. I was quite supprised at how close my original guestimate was to the final calculated figure I had set it to 54 steps a mm with a 0.6mm welding tip.

    I get actual 0.9mm extruded.
    So the calculated figure was 45.930300393787200
    When Calculated for a 0.6 extruder tip it would be 19.117710881909400

    So Giles is right Die Swell has to be included (it might be more noticeable with a worm drive extruder though as it makes a significant number of steps difference)

  8. 3mm ABS at 255 C

    Extruder has an insulator 16mm diameter 40mm long Peek 4.2mm hole through with 6mm long 6mm thread for 6mm diameter 25mm long 0.6mm Welding tip.
    The Welding tip is drilled out to 3.2mm for 24.2mm of its depth, leaving a 0.8mm long 0.6mm diameter hole to extrude thru.

    6.8 ohms of Nichrome is wound onto the 25mm welding tip with a thermcouple and Kapton tape.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.