Welcome! Log In Create A New Profile

Advanced

Layer Height Calculator

Posted by L4nce0 
Layer Height Calculator
May 26, 2012 07:46PM
I've just made an applet to help people figure out optimal layer heights. You can pick out the level of resolution, and put in any nozzle sizes. The defaults are for my prusa. It also lists in order starting with best, the top 5 layer heights ( as it outputs a lot of information)

Check it out
[makermodder.com]

Sample output
Best Layer Heights: 0.301, 0.15, 0.254, 0.287, 0.278
Layer Height: 0.345
Raw Value: 6554.0991937516
Layer Height: 0.344
Raw Value: 6573.096582719
Layer Height: 0.313
Raw Value: 7222.0328695479
Layer Height: 0.301
Raw Value: 7509.0010630399
Layer Height: 0.299
Raw Value: 7559.0610701268
Layer Height: 0.287
Raw Value: 7874.0219480488
Layer Height: 0.285
Raw Value: 7929.0850385946
Layer Height: 0.278
Raw Value: 8128.0226560504
Layer Height: 0.254
Raw Value: 8893.0130236786
Layer Height: 0.253
Raw Value: 8928.0248859766
Layer Height: 0.247
Raw Value: 9144.0254880566
Layer Height: 0.246
Raw Value: 9181.0458341621
Layer Height: 0.204
Raw Value: 11062.0405904295
Layer Height: 0.202
Raw Value: 11171.0262120101
Layer Height: 0.191
Raw Value: 11811.0329220732
Layer Height: 0.185
Raw Value: 12192.0339840755
Layer Height: 0.156
Raw Value: 14444.0657390958
Layer Height: 0.15
Raw Value: 15018.0021260798
Layer Height: 0.143
Raw Value: 15748.0438960976
Layer Height: 0.126
Raw Value: 17856.0497719531
Layer Height: 0.123
Raw Value: 18288.0509761133
Layer Height: 0.095
Raw Value: 23622.0658441463
Layer Height: 0.092
Raw Value: 24384.0679681511
Layer Height: 0.084
Raw Value: 26679.0390710359
Layer Height: 0.071
Raw Value: 31496.0877921951
Layer Height: 0.063
Raw Value: 35433.0987662195
Layer Height: 0.05
Raw Value: 44465.0651183931
Layer Height: 0.043
Raw Value: 51539.0527508647
Layer Height: 0.005
Raw Value: 377953.0535063414
Re: Layer Height Calculator
May 27, 2012 04:03AM
L4nce0 Wrote:
-------------------------------------------------------
> I've just made an applet to help people figure out
> optimal layer heights. You can pick out the level
> of resolution, and put in any nozzle sizes. The
> defaults are for my prusa. It also lists in order
> starting with best, the top 5 layer heights ( as
> it outputs a lot of information)

Nice tool, thankyou. It took me a moment to realise what you were doing. A couple of questions...

What resolution of layer height does your average firmare (marlin/sprinter etc.) work to?

You say that it lists the layer heights "in order starting with the best" what do you mean? It seems to me that the results are not ordered by anything other than highest value to lowest. Best would then be somewhere in between as layer adhesion etc has to be taken into account.
Re: Layer Height Calculator
May 29, 2012 11:58PM
Yeah I'm good at programming, expressing it so everyone understands is another story.

I would say from the few weeks of research I've done that it has nothing to do with your firmware, as it does your stepper motors. As you know a step is the set amount of known movement for a motor, given a single bipolar pulse. Following, it makes no sense to tell your motor to do .0312312312312 or whatever of a step. It can do 1 step, not 1.2, 1.1, 1.9 steps. One will note the closer to a rounded number, the better. 300, 0.2s miss steps makes a difference.
So you can put any number in as you want, but as far as the OTHER software, i.e. Slic3r. I talked to Sound, lead designer of Slic3r, he says to keep it under 1, 2 decimal places.

The order is sorted from largest to smallest from the set of layer height in which the first answer is the closest to a rounded number. i.e. a ratio of layer height to step distance where the result is 0.00115 will appear before 0.00234


Or a more direct example

0.301, granted 3 d points so a poor choice, it's math is...

You will note that 0.3 is not an option. that's because it did not meet the min float requirement. Between the two, 0.15 is a better choice, being 2 d points. Though in this case of 0.001,I could be wrong.
Layer Height: 0.301
Raw Value: 7509.0010630399

Followed by .15

Layer Height: 0.15
Raw Value: 15018.0021260798

cutting out the ints from the numbers

0.00106... < 0.0021...

So you will find that the order is the smallest number of float, without its integer half. I'm welcome to better ways to word this in the read me. Again, remember the whole point is to do a layer height as close to a whole step as possible; we can never actually do a 0.3 step.
(using default data -- posted above)

For those who are worried about the float percision, as any programmer should be... I used
while(current > rate){
DecimalFormat fiveD = new DecimalFormat("#.#####");
test = zaxis / current;
test = Double.valueOf(fiveD.format(test));
current = current-rate;
current = Double.valueOf(fiveD.format(current));
int roundTest = (int) test;
test = test - roundTest;

if (test < .1){
double raw = zaxis/(current+rate);
lhs.add(new LayerHeight(current, raw));
}

Edited 5 time(s). Last edit at 05/30/2012 12:12AM by L4nce0.
Re: Layer Height Calculator
May 30, 2012 02:32AM
Thanks for the explanation.... I understand now.

The reason I asked about the resolution of the firmware was that if I set a layer height of say 0.319, will the firmware round that down to perhaps 0.3 say?

I have tried your calculator to decide what steps I should us in Sfact. My layers were already pretty decent, but looking at two prints side by side I can just about see an improvement in the calculated value. Most definitely things did not get worse, so the new setting stays! winking smiley
Re: Layer Height Calculator
June 01, 2012 06:10AM
L4nce0 Wrote:
-------------------------------------------------------
> I would say from the few weeks of research I've
> done that it has nothing to do with your firmware,
> as it does your stepper motors. As you know a step
> is the set amount of known movement for a motor,
> given a single bipolar pulse. Following, it makes
> no sense to tell your motor to do .0312312312312
> or whatever of a step. It can do 1 step, not 1.2,
> 1.1, 1.9 steps. One will note the closer to a
> rounded number, the better. 300, 0.2s miss steps
> makes a difference.

With the most common Z axis setup, a 8mm leadscrew and 1/16 microstepping, the printer does exactly 2560 steps per mm of Z height. This means that the actual Z value may be up to .00019 mm off due to rounding the height to the nearest step. (In practice it will be off a lot more due to the leadscrew and nut accuracy.) In any case there should be no missed steps no matter what layer height you use unless the printer is malfunctioning. I didn't get the idea behind your calculation, but ensuring that 2560 (or whatever the printer in question happens to use) is an integer multiple of the number of layers per mm will already ensure that every layer will end up exacly on a motor step. Is this what you're calculating?
Re: Layer Height Calculator
June 04, 2012 08:55PM
You have 2560 which is the no steps per mm.

Now lets look at the math for the calculation
2560 / 0.35 = 7 314.28571 No steps per mm, over the layer height. This gives us a ratio of steps for every millimeter, not the actual steps. Say you have 10 layers per mm, and with the math, you come out to a solid roundish number, awesome!

If you loose or gain a step, say 10 steps per mm.. what's going to happen after 20, 40mms?

Yes sure the hardware has an error factor, but why not try to reduce the margin of error as much as possible? I'm working with 0.15mm extrudes, layer heights of under 0.1, it matters more to me than most people. Though apparently Slic3r tries to optimize your layer heights, but that's just IRC talk.

Now looking at my output, you will get
Layer Height: 0.319
Raw Value: 8000
So no miss steps caused by a poor layer height ratio.


[richrap.blogspot.com]


Course you can always see for yourself!
Aug 13 01:29:47 josch: I fine-tune layer height while drawing skirt by sending G92 Zn where n is layer height +/- 0.02 or so

Edited 2 time(s). Last edit at 06/04/2012 09:01PM by L4nce0.
Re: Layer Height Calculator
June 05, 2012 03:42AM
I can't see what the significance of steps per mm divided by layer height is. The relevant thing is steps per layer, which is steps per mm times layer height.

With 0.35mm layers you get 2560 * 0.35 = 896 steps per layer, so no error.
With 0.319mm layers you get 816.64 steps per layer, so a very small error. It doesn't get worse for 10 layers though. It will always be within half the step size of the motor, which is about 0.2 um. I think mechanical errors will dominate.

This assumes the motors are micro stepping properly, which is often not the case with Pololus.

Edited 1 time(s). Last edit at 06/05/2012 04:36AM by nophead.


[www.hydraraptor.blogspot.com]
Re: Layer Height Calculator
June 05, 2012 04:15AM
Quote

I can't see what the significance of steps per mm divided by layer height is.

Possibly, they want to use only layer heights which are multiples of Z steps. So, instead of slicing at 0.319mm, they want to slice at (0.319 * 2560 - 0.319 * 2560 modulo 1.0) / 2560 = 0.31875 mm. ("modulo 1.0" = "remove all digits right of the decimal")

You're right, the maximum error one can compensate is half a microstep size, and the error doesn't accumulate.


Generation 7 Electronics Teacup Firmware RepRap DIY
     
Re: Layer Height Calculator
June 05, 2012 04:42AM
There is possibly some advantage to keeping it a multiple of whole motor steps to avoid microstepping errors.


[www.hydraraptor.blogspot.com]
Re: Layer Height Calculator
June 05, 2012 05:48PM
nophead Wrote:
-------------------------------------------------------
> I can't see what the significance of steps per mm
> divided by layer height is. The relevant thing is
> steps per layer, which is steps per mm times layer
> height.
>
> With 0.35mm layers you get 2560 * 0.35 = 896
> steps per layer, so no error.
> With 0.319mm layers you get 816.64 steps per
> layer, so a very small error. It doesn't get worse
> for 10 layers though. It will always be within
> half the step size of the motor, which is about
> 0.2 um. I think mechanical errors will dominate.
>
> This assumes the motors are micro stepping
> properly, which is often not the case with
> Pololus.

Hmm I was thinking that the other day. Even wrote that out. Guess you could say don't believe everything said in IRC =) Though why won't the error cascade?
Re: Layer Height Calculator
June 06, 2012 03:36AM
The error does not accumulate because the firmware will always convert the target position the nearest step position and then step the motor to that position.


[www.hydraraptor.blogspot.com]
Re: Layer Height Calculator
June 09, 2012 01:33PM
I am still in the heavy calibration/learning phase. Barely able to get decent prints so I should be a target user.

For me the applet simply does not give any results. I did not have java installed yet so now its the latest from java.com (Version 7 Update 4). I run windows 7 x64. browsers tested: ie9 all updated, chrome 19.0.1084.52 m.
Behaviour is as follows: either entering my numbers or using the predefined numers changes nothing. the lower box displays "Output Here"

As for my numbers, My nozzle is drilled with a .45mm drill and I use .47mm in slicer. My z steps are 2538.799479.


I hope it will work soon and hope it will help noobs like me in the future
Sorry, only registered users may post in this forum.

Click here to login