diff --git a/docs/Config_Reference.md b/docs/Config_Reference.md index 7d58c636..5d1b1b0d 100644 --- a/docs/Config_Reference.md +++ b/docs/Config_Reference.md @@ -116,6 +116,9 @@ the "kinematics" option in the [printer] config section) require different names for the stepper (eg, `stepper_x` vs `stepper_a`). Below are common stepper definitions. +See the [rotation distance document](Rotation_Distance.md) for +information on calculating the `rotation_distance` parameter. + ``` [stepper_x] step_pin: diff --git a/docs/FAQ.md b/docs/FAQ.md index 7ea22430..9190934b 100644 --- a/docs/FAQ.md +++ b/docs/FAQ.md @@ -2,7 +2,7 @@ Frequently asked questions ========================== 1. [How can I donate to the project?](#how-can-i-donate-to-the-project) -2. [How do I calculate the step_distance parameter in the printer config file?](#how-do-i-calculate-the-step_distance-parameter-in-the-printer-config-file) +2. [How do I calculate the rotation_distance config parameter?](#how-do-i-calculate-the-rotation_distance-config-parameter) 3. [Where's my serial port?](#wheres-my-serial-port) 4. [When the micro-controller restarts the device changes to /dev/ttyUSB1](#when-the-micro-controller-restarts-the-device-changes-to-devttyusb1) 5. [The "make flash" command doesn't work](#the-make-flash-command-doesnt-work) @@ -31,25 +31,9 @@ Frequently asked questions Thanks. Kevin has a Patreon page at: [https://www.patreon.com/koconnor](https://www.patreon.com/koconnor) -### How do I calculate the step_distance parameter in the printer config file? +### How do I calculate the rotation_distance config parameter? -If you know the steps per millimeter for the axis then use a -calculator to divide 1.0 by steps_per_mm. Then round this number to -six decimal places and place it in the config (six decimal places is -nano-meter precision). - -The step_distance defines the distance that the axis will travel on -each motor driver pulse. It can also be calculated from the axis -pitch, motor step angle, and driver microstepping. If unsure, do a web -search for "calculate steps per mm" to find an online calculator. - -Klipper uses step_distance instead of steps_per_mm in order to use -consistent units of measurement in the config file. (The config uses -millimeters for all distance measurements.) It is believed that -steps_per_mm originated as an optimization on old 8-bit -micro-controllers (the desire to use a multiply instead of a divide in -some low-level code). Continuing to configure this one distance in -units of "inverse millimeters" is felt to be quirky and unnecessary. +See the [rotation distance document](Rotation_Distance.md). ### Where's my serial port? diff --git a/docs/Overview.md b/docs/Overview.md index 5cd815b5..74ad1226 100644 --- a/docs/Overview.md +++ b/docs/Overview.md @@ -17,6 +17,8 @@ communication with the Klipper developers. - [Installation](Installation.md): Guide to installing Klipper. - [Config Reference](Config_Reference.md): Description of config parameters. + - [Rotation Distance](Rotation_Distance.md): Calculating the + rotation_distance stepper parameter. - [Config checks](Config_checks.md): Verify basic pin settings in the config file. - [Bed level](Bed_Level.md): Information on "bed leveling" in Klipper. diff --git a/docs/Rotation_Distance.md b/docs/Rotation_Distance.md new file mode 100644 index 00000000..8e5d44ea --- /dev/null +++ b/docs/Rotation_Distance.md @@ -0,0 +1,172 @@ +Stepper motor drivers on Klipper require a `rotation_distance` +parameter in each +[stepper config section](Config_Reference.md#stepper). The +`rotation_distance` is the amount of distance that the axis moves with +one full revolution of the stepper motor. This document describes how +one can configure this value. + +# Obtaining rotation_distance from steps_per_mm (or step_distance) + +The designers of your 3d printer originally calculated `steps_per_mm` +from a rotation distance. If you know the steps_per_mm then it is +possible to use this general formula to obtain that original rotation +distance: +``` +rotation_distance = * / +``` + +Or, if you have an older Klipper configuration and know the +`step_distance` parameter you can use this formula: +``` +rotation_distance = * * +``` + +The `` setting is determined from the type of +stepper motor. Most stepper motors are "1.8 degree steppers" and +therefore have 200 full steps per rotation (360 divided by 1.8 is +200). Some stepper motors are "0.9 degree steppers" and thus have 400 +full steps per rotation. Other stepper motors are rare. If unsure, do +not set full_steps_per_rotation in the config file and use 200 in the +formula above. + +The `` setting is determined by the stepper motor driver. +Most drivers use 16 microsteps. If unsure, set `microsteps: 16` in the +config and use 16 in the formula above. + +Almost all printers should have a whole number for `rotation_distance` +on x, y, and z type axes. If the above formula results in a +rotation_distance that is within .01 of a whole number then round the +final value to that whole_number. + +# Calibrating rotation_distance on extruders + +On an extruder, the `rotation_distance` is the amount of distance the +filament travels for one full rotation of the stepper motor. The best +way to get an accurate value for this setting is to use a "measure and +trim" procedure. + +First start with an initial guess for the rotation distance. This may +be obtained from +[steps_per_mm](#obtaining-rotation_distance-from-steps_per_mm-or-step_distance) +or by [inspecting the hardware](#extruder). + +Then use the following procedure to "measure and trim": +1. Make sure the extruder has filament in it, the hotend is heated to + an appropriate temperature, and the printer is ready to extrude. +2. Use a marker to place a mark on the filament around 70mm from the + intake of the extruder body. Then use a digital calipers to measure + the actual distance of that mark as precisely as one can. Note this + as ``. +3. Extrude 50mm of filament with the following command sequence: `G91` + followed by `G1 E50 F60`. Note 50mm as + ``. Wait for the extruder to finish the + move (it will take about 50 seconds). +4. Use the digital calipers to measure the new distance between the + extruder body and the mark on the filament. Note this as + ``. Then calculate + `actual_extrude_distance = - + `. +5. Calculate rotation_distance as `rotation_distance = + * / + `. Round the new rotation_distance to + three decimal places. + +If the actual_extrude_distance differs from requested_extrude_distance +by more than about 2mm then it is a good idea to perform the steps +above a second time. + +Note: Do *not* use a "measure and trim" type of method to calibrate x, +y, or z type axes. The "measure and trim" method is not accurate +enough for those axes and will likely lead to a worse configuration. +Instead, if needed, those axes can be determined by +[measuring the belts, pulleys, and lead screw hardware](#obtaining-rotation_distance-by-inspecting-the-hardware). + +# Obtaining rotation_distance by inspecting the hardware + +It's possible to calculate rotation_distance with knowledge of the +stepper motors and printer kinematics. This may be useful if the +steps_per_mm is not known or if designing a new printer. + +## Belt driven axes + +It is easy to calculate rotation_distance for a linear axis that uses +a belt and pulley. + +First determine the type of belt. Most printers use a 2mm belt pitch +(that is, each tooth on the belt is 2mm apart). Then count the number +of teeth on the stepper motor pulley. The rotation_distance is then +calculated as: +``` +rotation_distance = * +``` + +For example, if a printer has a 2mm belt and uses a pulley with 20 +teeth, then the rotation distance is 40. + +## Axes with a lead screw + +It is easy to calculate the rotation_distance for common lead screws +using the following formula: +``` +rotation_distance = * +``` + +For example, the common "T8 leadscrew" has a rotation distance of 8 +(it has a pitch of 2mm and has 4 separate threads). + +Older printers with "threaded rods" have only one "thread" on the lead +screw and thus the rotation distance is the pitch of the screw. (The +screw pitch is the distance between each groove on the screw.) So, for +example, an M6 metric rod has a rotation distance of 1 and an M8 rod +has a rotation distance of 1.25. + +## Extruder + +It's possible to obtain an initial rotation distance for extruders by +measuring the diameter of the "hobbed bolt" that pushes the filament +and using the following formula: `rotation_distance = + * 3.14` + +If the extruder uses gears then it will also be necessary to +[determine and set the gear_ratio](#using-a-gear_ratio) for the +extruder. + +The actual rotation distance on an extruder will vary from printer to +printer, because the grip of the "hobbed bolt" that engages the +filament can vary. It can even vary between filament spools. After +obtaining an initial rotation_distance, use the +[measure and trim procedure](#calibrating-rotation_distance-on-extruders) +to obtain a more accurate setting. + +# Using a gear_ratio + +Setting a `gear_ratio` can make it easier to configure the +`rotation_distance` on steppers that have a gear box (or similar) +attached to it. Most steppers do not have a gear box - if unsure then +do not set `gear_ratio` in the config. + +When `gear_ratio` is set, the `rotation_distance` represents the +distance the axis moves with one full rotation of the final gear on +the gear box. If, for example, one is using a gearbox with a "5:1" +ratio, then one could calculate the rotation_distance with +[knowledge of the hardware](#obtaining-rotation_distance-by-inspecting-the-hardware) +and then add `gear_ratio: 5:1` to the config. + +For gearing implemented with belts and pulleys, it is possible to +determine the gear_ratio by counting the teeth on the pulleys. For +example, if a stepper with a 16 toothed pulley drives the next pulley +with 80 teeth then one would use `gear_ratio: 80:16`. Indeed, one +could open a common off the shelf "gear box" and count the teeth in it +to confirm its gear ratio. Note that the common "5.18:1 planetary +gearbox" is more accurately configured with `gear_ratio: 57:11`. + +If several gears are used on an axis then it is possible to provide a +comma separated list to gear_ratio. For example, a "5:1" gear box +driving a 16 toothed to 80 toothed pulley could use `gear_ratio: 5:1, +80:16`. + +In most cases, gear_ratio should be defined with whole numbers as +common gears and pulleys have a whole number of teeth on them. +However, in cases where a belt drives a pulley using friction instead +of teeth, it may make sense to use a floating point number in the gear +ratio (eg, `gear_ratio: 107.237:16`).