What this calculator computes
A slider-crank turns the rotation of a crank of radius r into the reciprocating motion of a slider. The two are connected by a rod of length L, and the slider runs along a line offset by e from the crank pivot. It is the mechanism inside piston engines, compressors, pumps and countless pick-and-place machines.
For a crank turning at constant speed ω, the preview above evaluates one full revolution and reports:
| Quantity | Meaning |
|---|---|
| Stroke | Distance between the two dead-centre positions of the slider |
| Max slider speed | Peak of |v(θ)| over one revolution |
| Max rod angle | Largest angle between the rod and the slider axis |
| Time ratio | Crank angle of the slow stroke divided by that of the fast stroke |
| Loop-closure residual | How exactly the drawn geometry satisfies the rod-length constraint |
Position
With the crank pivot at the origin and the crank angle θ measured from the slider axis, the crank pin sits at (r cos θ, r sin θ). The rod length fixes the slider position:
The square root must stay real for every θ, so a full revolution requires L ≥ r + |e|. The calculator flags any geometry that violates this.
Velocity
Differentiating with respect to time, using θ̇ = ω:
For an in-line slider-crank (e = 0) the classic engine approximation for acceleration follows from a series expansion in r/L:
The second harmonic term is why short rods (small L/r) produce rough, asymmetric motion. Engines typically use L/r between about 3 and 4.5.
Stroke, dead centres and quick return
For an in-line mechanism the stroke is simply 2r and the two dead centres sit exactly half a revolution apart. With an offset the stroke grows slightly and the dead centres shift:
Because the dead centres are no longer 180° apart, one stroke takes longer than the other. That is the quick-return effect used in shapers and packaging machines:
The maximum rod angle, which drives the side load on the slider guide, is asin( (r + |e|) / L ).
How the preview checks itself
The animation is closed-form: each frame is computed directly from the equations above, and the residual shown is the error in the rod-length and slider-line constraints for the drawn geometry. For a closed-form model it sits at floating-point round-off (around 10⁻¹⁶ m). Real tools rarely give you that number. We show it because a model you cannot check is a model you cannot defend.
The full solver goes further. It builds the same mechanism from bodies, pins and a prismatic joint, solves the constraint equations numerically with a Newton-Raphson iteration and reports the residual of that solution, typically 10⁻¹⁰ m. It also adds dynamics, joint reactions and JSON/CSV export.
The same model in Python
This is the slider-crank above written with the open-source MBSD Core framework. It runs as-is with MBSD 0.7:
import numpy as np
from mbsd import Mechanism
r, L = 0.35, 1.15 # crank radius, rod length [m]
m = Mechanism.planar(gravity=(0.0, 0.0))
ground = m.ground()
crank = m.body("crank", mass=0.5, inertia=0.01)
rod = m.body("rod", mass=1.0, inertia=0.03)
slider = m.body("slider", mass=1.5, inertia=0.02)
m.pin(ground, crank, point_a=(0, 0), point_b=(0, 0))
m.pin(crank, rod, point_a=(r, 0), point_b=(0, 0))
m.pin(rod, slider, point_a=(L, 0), point_b=(0, 0))
m.slider(ground, slider, axis=(1, 0))
m.motor(crank, omega=2 * np.pi) # 1 rev/s
q0 = np.zeros(m.ncoord)
q0[6:9] = [r, 0, 0]
q0[9:12] = [r + L, 0, 0]
result = m.solve_kinematics(np.linspace(0, 1, 361), q0=q0)
m.assert_constraints_satisfied(result)
The numerical solution reproduces the closed-form stroke of 0.700 m and a peak slider speed of about 2.30 m/s at 60 rpm.