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.

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.

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.

r_{f} = 0.5 × Ø_{f} (filament diameter)

CSA_{f}(filament cross sectional area) = π × r_{f}²

vol_{f} (filament volume per revolution) = CSA_{f} × len_{f}

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)

len_{f} (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.

R_{M:PW} (ratio of motor rpm to pinch wheel rpm)

steps_{360} (motor steps per revolution)

```
```
step-vol_{f} (filament volume per step) =
vol_{f}
steps_{360} × R_{M: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.

Using filament with a nominal diameter of 3mm gives:

r_{f} = 0.5 × Ø_{f} = 1.5mm

CSA_{f} = π × r_{f}² = 7.07mm²

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

Ø_{PW} = 5.0 mm

len_{f} = π × Ø_{PW} = 15.7mm

vol_{f} = CSA_{f} × len_{f} = 111mm³

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

R_{M:PW} = 1

```
```
step-vol_{f} =
111mm³
400 × 1

`step-vol`

_{f} = 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

len_{f} = π × Ø_{PW} = 25.1mm

vol_{f} = CSA_{f} × len_{f} = 177mm³

R_{M:PW} = 5

```
```
step-vol_{f} =
177mm³
400 × 5

`step-vol`

_{f} = 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}

r_{e} (extrusion radius) = 0.5 × Ø_{e}

CSA_{e} (cross sectional area of extrusion) = π × r_{e}²

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.

len_{e} (length of extrusion)

vol_{e} (extrusion volume ) = len_{e} × CSA_{e}

```
```
len_{e} =
vol_{e}
CSA_{e}

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

vol_{e} = step-vol_{f}

```
```
len_{e} =
step-vol_{f}
CSA_{e}

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.

```
```
E_STEPS_PER_MM =
CSA_{e}
step-vol_{f}

#### 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-vol_{f} = 0.278mm³ (from earlier example above)

r_{e} = 0.5 × Ø_{e} = 0.25mm

CSA_{e} = π × r_{e}² = 0.196mm²

```
```
E_STEPS_PER_MM =
0.196mm²
0.278mm³

`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-vol_{f} = 0.0885mm³ (from earlier example above)

r_{e} = 0.5 × Ø_{e} = 0.25mm

CSA_{e} = π × r_{e}² = 0.196mm²

```
```
E_STEPS_PER_MM =
0.196mm²
0.0885mm³

`E_STEPS_PER_MM = 2.21`

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}² × steps_{360} × R_{M:PW}
Ø_{f}² × π × Ø_{PW}

Where:

```
```
Ø_{f} =
filament diameter
Ø_{PW} =
pinch wheel diameter
Ø_{NOZZLE} =
nozzle diameter
steps_{360} =
number of steps per revolution
R_{M: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.

Any thoughts, comments and ideas are always welcome.

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)

Absolutely true, but I do make the assumption that the die swell is negligible “Ø

_{e}(extrusion diameter) = Ø_{NOZZLE}“.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 examplesare 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 multiplierin 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.Aaaaaah, the Extruder Controller 2.2 does support half stepping with the firmware hack….That explains alot!

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.

Cheers, I will look at revising the formula and see how well that works.

Thanks for the info.

I wrote this python script to calculate e_steps_per_mm

#!/usr/bin/python

import math

def getValue(prompt,default):

try:

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.

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?

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)

Absolutely. Strange that I see no die swell at all on my extrusion. What plastic are you using? What temperature?

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.

[…] This blog will be unfinished until I try the calibration number that I calculated and measure the actual result. We’ll see how close I come to the right answer. I found that a similar procedure is described at this web site. […]