← 文章 LEARN / USE CASE / RACK AND PINION
ARTICLE · 9 MIN READ
本文章仅提供日语和英语的完整版本。

齿条与齿轮是将旋转运动转换为直线运动的基本齿轮机构。本指南讲解小齿轮(齿轮)与齿条的工作原理、小齿轮每转移动量(π×m×z)的计算、两者必须采用相同模数的原因、小齿轮齿数与齿条长度的确定方法、使用直齿轮生成器和齿条生成器生成STEP文件的步骤,以及3D打印时的注意事项。

Overhead view of a module-2, 20-tooth pinion meshing with a rack in a rack-and-pinion mechanism

齿条与齿轮指南:将旋转转换为直线运动

A rack and pinion is the most basic gear mechanism for converting rotary motion into linear motion. By meshing a rotating small gear (the pinion) with a flat, bar-shaped gear (the rack), the pinion's rotation becomes straight-line travel of the rack. It is used wherever rotation needs to become linear motion — feed drives on CNC machine tools, automotive steering, lift stages, and the axis drives of 3D printers. With meta-matic you generate the pinion with the Spur Gear generator and the rack with the Rack Gear generator, and simply combine the two to design this mechanism. This guide covers the principle of the rack and pinion, how to calculate travel, how to design the pinion and rack, and how to generate STEP files.

What is a rack and pinion?

A rack and pinion is made up of two parts: the pinion (a small spur gear) and the rack (a straight, linear gear). The rack can be thought of as a spur gear whose pitch circle (reference circle) radius has been made infinite. As the radius approaches infinity the involute curve approaches a straight line, so the rack's tooth faces become straight (a trapezoidal tooth profile), and these straight faces mesh correctly with the pinion's involute teeth. As the pinion rotates, the engaged teeth push the rack and the rack moves in a straight line. Conversely, moving the rack rotates the pinion, so the conversion works both ways between rotation and linear travel.

Fig. 1: The pinion's rotation is converted into linear motion of the rack (20-tooth pinion, module 2)

meta-matic's pinion (spur gear) and rack share the same fixed parameters — a 20° pressure angle, addendum 1.0m, dedendum 1.25m, and 0 backlash. Generated with the same module, they produce tooth profiles that mesh correctly by design.

正齿轮生成
正齿轮生成SPUR GEARhttps://meta-matic.com/zh-cn/3d/spur-gear/
齿条生成
齿条生成RACK GEARhttps://meta-matic.com/zh-cn/3d/rack-gear/
Design reference only
This tool generates geometry based on standard tooth proportions and should be regarded as a reference model. Because the pressure angle and backlash are fixed, for any mechanism that will actually move, always verify the meshing and the play (backlash) in CAD or with a prototype.

Advantages and disadvantages

Compared with other linear-motion mechanisms such as ball screws and belt drives, rack-and-pinion systems offer several advantages as well as some trade-offs to weigh when selecting a mechanism.

Main advantages

Main disadvantages

Relationship between rotation and linear motion

The key feature of a rack and pinion is that the pinion's rotation and the rack's travel are proportional. For one full turn of the pinion, the rack moves a distance equal to the circumference of the pinion's pitch circle. Writing the pitch circle diameter as d, the module as m, and the pinion tooth count as z, since d = m × z, the travel per pinion revolution is given by the following formula.

Travel per pinion revolution = π × d = π × m × z

For example, a module-2, 20-tooth pinion moves π × 2 × 20 ≈ 125.7 mm per revolution. The travel when the pinion turns by θ degrees is (θ ÷ 360) × π × m × z. Thanks to this proportional relationship, combining it with a stepper motor lets you precisely control travel distance from the rotation angle.

Pinion rotationTravel formulaExample (m=2, z=20)
One revolution (360°)π × m × z125.7 mm
Half revolution (180°)π × m × z ÷ 262.8 mm
One tooth (360/z°)π × m6.28 mm
Table 1: Relationship between pinion rotation and rack travel (module 2, 20 teeth)
Rack pitch
The spacing between rack teeth (the pitch) is p = π × m. When the pinion turns by one tooth, the rack advances by one tooth pitch (π×m) as well. As long as the pinion and rack share the same module, this pitch matches and they mesh correctly.

Designing the pinion and rack

When designing a rack and pinion, the fundamental premise is that the pinion and rack must use exactly the same module. If the modules differ, the tooth pitches do not match and they will not mesh at all. Once the module is matched, select the pinion's tooth count and the rack's length to suit your application.

Top view layout of a 20-tooth pinion meshing with a rack
Fig. 2: Position the parts so the pinion's pitch circle is tangent to the rack's pitch line
Choosing the pinion tooth count
Increasing the pinion tooth count increases the linear travel per revolution, resulting in higher travel speed. Meanwhile the force that pushes the rack (thrust) is F = T ÷ r (T: motor torque, r: pitch circle radius), so for the same motor torque a larger pitch circle radius gives less thrust. In other words, compared at the same motor torque, fewer teeth (a smaller pitch circle radius) means slower motion but greater thrust. Choose the tooth count by balancing speed against force.

Calculating key dimensions and travel

The key dimensions of a rack and pinion can be calculated from the module m and the pinion tooth count z. The dimensions you need for positioning during assembly are as follows.

NameSymbol / formulaExample (m=2, z=20)
Pinion pitch circle diameterd = m × z40.00 mm
Pinion tip circle diameterDa = m × (z + 2)44.00 mm
Travel per pinion revolutionπ × m × z125.7 mm
Rack pitchp = π × m6.28 mm
Table 2: Key dimensions of a rack and pinion (20° pressure angle, standard profile)

The most important thing in assembly is the distance between the pinion's axis center and the rack's pitch line. Position the pinion axis at a distance of pitch radius = m × z ÷ 2 (for example, 20 mm at m=2, z=20) so that the pinion's pitch circle is exactly tangent to the rack's pitch line (the line lying one addendum m below the tooth tips). If this distance is too small the teeth bind, and if too large the play grows and the mechanism will not work correctly.

Example: driving with a stepper motor

Because the rack and pinion's rotation angle and travel are proportional, combining it with a stepper motor lets you control travel precisely in steps. It is a common configuration in DIY CNC, gantry, and XY-stage builds. The travel per step (the resolution) is given by the following formula.

Travel per step = π × m × z ÷ (steps per revolution)

For example, fitting a module-1, 20-tooth pinion to a typical NEMA17 stepper motor (200 steps per revolution) gives a resolution of π × 1 × 20 ÷ 200 ≈ 0.314 mm/step. Using 1/16 microstepping refines this further to 0.314 ÷ 16 ≈ 0.02 mm. To work out the resolution from the motor's step count and the pinion dimensions, the steps/mm calculator is handy.

Trade-off between resolution and speed
Making the module or pinion tooth count smaller reduces the travel per step and raises the resolution, but at the same rotational speed the travel speed drops. Choose the module and tooth count by balancing the required accuracy against speed.

How to generate STEP files

With meta-matic you generate the pinion and the rack with their respective generators and combine them in CAD. For both, you simply enter parameters in your browser to download a STEP file.

  1. Decide the module

    Decide a common module for the pinion and rack. Choose it from the required thrust, accuracy, and compatibility with mating parts.
  2. Generate the pinion

    In the Spur Gear generator, enter the chosen module, pinion tooth count, bore diameter, and face width to generate the STEP file.
  3. Generate the rack

    In the Rack Gear generator, enter the same module, the required tooth count (length), height, and width to generate the STEP file.
  4. Assemble in CAD

    Open both files in Fusion 360 / SolidWorks / FreeCAD and position them so the distance from the pinion axis to the rack's pitch line equals the pitch radius (m×z÷2).
  5. Check the meshing

    Rotate the pinion and verify in the assembly that the rack moves smoothly in a straight line, with no binding teeth or excessive play.
正齿轮生成
正齿轮生成SPUR GEARhttps://meta-matic.com/zh-cn/3d/spur-gear/
齿条生成
齿条生成RACK GEARhttps://meta-matic.com/zh-cn/3d/rack-gear/

Notes on 3D printing and assembly

A rack and pinion can be made by 3D printing, but the smoothness of the linear motion depends on the tooth-face accuracy and the straightness of the rack. Keep the following points in mind to build a practical mechanism.

Tooth skipping and disengagement at the rack ends
When the pinion reaches the end of the rack, fewer teeth are engaged, making tooth skipping and disengagement more likely. Design the rack longer than the stroke you actually use, leaving spare teeth at both ends.

Frequently asked questions

QDo the pinion and rack need to have the same module?
Yes, they must always use the same module. The module determines tooth size and pitch, so if the modules differ, the rack's tooth pitch and the pinion's tooth pitch do not match and they will not mesh.
QHow long should the rack be?
Make it the required travel (stroke) plus a margin so the pinion still meshes at both ends. Decide the rack's tooth count roughly as "required length ÷ pitch (π×m)", and leaving a few spare teeth at the ends is safer.
QWhat is a rack and pinion used for?
It is widely used wherever rotation must be turned into precise linear motion — axis feeds on CNC machine tools and laser cutters, automotive steering, lift stages, and opening and closing gates.
QIs there a minimum number of teeth for the pinion?
Yes. With the standard profile at a 20° pressure angle, below 17 teeth undercut weakens the tooth root, so this generator sets the minimum to 17 teeth.
QWhat positioning accuracy can I achieve?
Accuracy is determined by the motor's step count, tooth-face accuracy, and backlash. Since the pinion moves π×m×z per revolution, dividing by the step count gives the theoretical resolution. In practice, backlash and tooth-face errors add up, so verify with a prototype.

Related resources

Here are generators useful for rack-and-pinion design, along with related guides and calculation tools. Use them as needed.