Welcome! Log In Create A New Profile

# Trying to make sense of the Z_STEPS_PER_MM

Posted by AlexRa
 Trying to make sense of the Z_STEPS_PER_MM March 25, 2011 07:16AM Registered: 10 years ago Posts: 4
Hi,

I'm trying to figure out how the values for X-Y-Z-steps-per-mm in the FiveD firmware were calculated.

Specifically, the section for Gen3 Mendel in "configuration.h" has it like this:

#define X_STEPS_PER_MM 10.047
#define Y_STEPS_PER_MM 10.047
#define Z_STEPS_PER_MM 833.398

If a Mendel has 8/20 gear ratio on the Z axis and 200 steps/turn motors with halfstepping (so 400 steps),
this is exactly 1000 steps per one rotation of the Z-screw. That gives us several possible Z-steps-per-mm
dependng on the studding:

#define Z_STEPS_PER_MM 1000 // for 1.0mm metric pitch OR
#define Z_STEPS_PER_MM 800 // for 1.25mm metric pitch OR
#define Z_STEPS_PER_MM 944.91 // for 24 threads/inch OR
#define Z_STEPS_PER_MM 787.40 // for 20 threads/inch

but nowhere near the 833.398 value from the header.

When calculating the X/Y steps, there is also some discrepancy, although a much smaller one,
that can be attributed to the not-quite-precise pulley diameter (see below).

But for the Z the difference is so big it just doesn't make sense. And yet people apparently produce correctly sized parts
with the current settings, so I must be wrong somewhere.

Can anybody please comment on this?

As to the X/Y stepping:

8 teeth pulley: X_STEPS_PER_MM = (200 * 2) / (5.08mm * 8 teeth) = 9.843 (vs 10.047 in FiveD)
9 teeth pulley: X_STEPS_PER_MM = (200 * 2) / (5.08mm * 9 teeth) = 8.749 (vs 8.9307 in FiveD)
(5.08mm = 0.200" - the standard pitch for the belts used in Mendels)

If the values in configuration.h are actually accurate exterimental measurements, it might means that
whoever first measured them and put into the firmware, actually used RPed pulleys slightly smaller
than necessary (to be in sync with the belt pitch). The error is about 4mm across the distance of 200mm,
which is still less than the belt pitch (may not cause any noticeable belt jumping over the teeth).

The bottom line here I think is that for X/Y stepping some calibration may be useful for each
individual pair of pulleys you have.
 Re: Trying to make sense of the Z_STEPS_PER_MM March 25, 2011 08:04AM Registered: 11 years ago Posts: 3,736
A standard Mendel has 8 teeth on the stepper motor and 21 teeth on the threaded bar.
1 rotation (360°) of the standard M8 threaded bar 1,25 mm vertical movement.

400 steps/rotation x (21/8) x (1 rotation) / (1,25 mm) = 840 steps/mm for the Z-axis!

X & Y use T5 timing belts, 1 tooth every 5mm.

8 teeth = 40 mm
By half stepping 400 steps = 40mm, e.g. 10 steps/mm for die X & Y achse.

Edited 1 time(s). Last edit at 03/25/2011 08:08AM by rhmorrison.

Bob Morrison
Wörth am Rhein, Germany
"Luke, use the source!"
BLOG - PHOTOS - Thingiverse
 Re: Trying to make sense of the Z_STEPS_PER_MM March 25, 2011 09:26AM Registered: 10 years ago Posts: 4
rhmorrison Wrote:
-------------------------------------------------------

> A standard Mendel has 8 teeth on the stepper motor and 21 teeth on the threaded bar.
> 1 rotation (360°) of the standard M8 threaded bar 1,25 mm vertical movement.

Well, look at the "official" picture of RP Mendel parts here:

[www.reprap.org]

I counted the teeth 3 times, and the Z gear still has 20 of them! May be it SHOULD have
had 21, but it doesn't. The ones I have in the Huxley also have 20 teeth.

If there are several versions out there, might be a good idea to put this into the wiki somewhere.

> X & Y use T5 timing belts, 1 tooth every 5mm.

Aha! That certainly makes sense, although my Huxley came (from TechZone) with 0.200" belts,
or 5.08mm pitch, NOT metric 5.0mm. I bet a lot of reprappers in the US have 0.2" belts rather than
metric one, maybe not even realizing there is a difference. The difference is tiny, but it does exist.

>
> 8 teeth = 40 mm
> By half stepping 400 steps = 40mm, e.g. 10
> steps/mm for die X & Y achse.
 Re: Trying to make sense of the Z_STEPS_PER_MM March 25, 2011 09:50AM Registered: 11 years ago Posts: 3,736
Quote
AlexRa
Well, look at the "official" picture of RP Mendel parts here...

I don't look at pictures, I look at the actual objects.
If you download the current RepRap repository "reprap-mendel-20110207" in the appropriate directory at

.\reprap-mendel-20110207\mendel\mechanics\solid-models\cartesian-robot-m4\printed-parts\z-driven-pulley_2off.stl

Then you SEE:

I count 21 teeth which is what my Z pulleys have.
Obviously TechZone is using some non standard parts.

Bob Morrison
Wörth am Rhein, Germany
"Luke, use the source!"
BLOG - PHOTOS - Thingiverse
 Re: Trying to make sense of the Z_STEPS_PER_MM March 25, 2011 10:25AM Admin Registered: 14 years ago Posts: 7,856
Quote

If the values in configuration.h are actually accurate exterimental measurements, it might means that
whoever first measured them and put into the firmware, actually used RPed pulleys slightly smaller
than necessary (to be in sync with the belt pitch).
The distance moved is the number of teeth times the belt pitch and does not depend on the diameter (assuming it is close enough that belt does not slip).

[www.hydraraptor.blogspot.com]
 Re: Trying to make sense of the Z_STEPS_PER_MM March 25, 2011 10:35AM Registered: 10 years ago Posts: 4
> I count 21 teeth which is what my Z pulleys have.
> Obviously TechZone is using some non standard parts.

That they certainly do! Thank you for clearing the confusion for me.
 Re: Trying to make sense of the Z_STEPS_PER_MM March 25, 2011 02:39PM Registered: 10 years ago Posts: 4
I agree with corrections by Nophead & Bob Morrison, but let me reprase the question and explain why I'm asking that.

I'm a new reprapper and it so happened that my first RepRap is a TechZone Huxley kit. Assembling the thing was somewhat less smooth than I expected, and I'm still having trouble trying to make the Bowden-cable based extruder to work reliably. Besides some interesting issues with the mechanical construction, the kit does contain some non-standard electronics (such as their thermocouple sensor/controller sub-board) and uses TZ's own firmware, based on some older version of the official FiveD, with numerous #ifdefs all over the code to adapt it to their electronics.

So I decided to take the official up-to-date FiveD sources and merge TechZone-specific stuff into it in such a way that it would be just yet-another-supported-motherboard, not something that requres a separate fork. But while doing so, I encountered a number of things that, as a programmer, I found awkwardly written or confusing. So it appears that I'll have my own fork anyway... most of the changes i'm making are in packaging / configuration / cleaning up / commenting the code, trying not to break any functionality on the way (and add some - see [www.reprap.org]). I expect to put the thing on github once it works on my Huxley, but of course I won't be able to test it on different machnes. Among other things, I'm going through the configuration files to make sure I fully understand the logic (of what's needed for which machines, etc).

And my original question was basically this: there are those X|Y|Z_STEPS_PER_MM constants, which could be calculated as above, but are instead assigned some literal values, not quite matching the "theoretical" ones. Even with Bob Morrison's corrections, is that 840 or 833.398 ? 10 or 10.047?

Does anybody know where the values come from? Is there any reason to trust them more then the formulas, or can they be safely replaced?
 Re: Trying to make sense of the Z_STEPS_PER_MM March 25, 2011 07:45PM Admin Registered: 14 years ago Posts: 7,856
I think it is because the wiki instructions advise people to measure a calibration cube and adjust the constants to get it exactly the right size. I think that is the wrong way to go about it because the size of anything you make equals how far the axis moves plus any size difference between the actual filament width and the width set in the slicer and then it contracts as it cools down. So you have three variables that affect the size but are trying to correct it with one adjustment.

This is what I do: I use the theoretical values and assume belt and threaded rod pitches are accurate. I also ensure the width of my filament is correct. Small objects then come accurate enough for me. I then make a large object and measure how much it shrinks. I store that as property of the plastic and scale the XY dimensions by that amount.

[www.hydraraptor.blogspot.com]
 Re: Trying to make sense of the Z_STEPS_PER_MM March 26, 2011 06:29AM Registered: 11 years ago Posts: 3,736
Quote
I store that as property of the plastic and scale the XY dimensions by that amount.

Do you scale this in Skeinforge or in your post processing code that turns gcode into the actual commands that you send to your printer?

Bob Morrison
Wörth am Rhein, Germany
"Luke, use the source!"
BLOG - PHOTOS - Thingiverse
 Re: Trying to make sense of the Z_STEPS_PER_MM March 26, 2011 02:48PM Admin Registered: 14 years ago Posts: 7,856
In my post processing code as it depends on the plastic.

[www.hydraraptor.blogspot.com]
Sorry, only registered users may post in this forum.