Build a gear train. Its output shaft physically drives the linkages.
The first gear is the motor, the last is the output shaft, and idlers between them only flip direction. The output shaft drives the four-bar crank-rocker, the slider-crank and a gear-pair mesh below. The shaft angle is integrated from the true output speed, so editing the train (teeth, order, reverse) changes how fast & which way the mechanisms run but never makes them jump. Gear, rocker and piston speeds are all exact closed-form values per simulated second.
Bar fills to 100% = input value. Speed and torque always move in opposite directions as you change the gear ratio — power in equals power out.
GR = Ndriven/Ndriver ·θshaft(s) = ∫0s ψout(σ)dσ (continuous integral — never jumps) ·ω4 = ω2·a·sin(θ2−θ3) / (c·sin(θ4−θ3)) ·vpiston = ω2·[−r·sinθ − r²·sinθcosθ/√(l²−r²sin²θ)] ·ω1N1 = ω2N2 ·P = τ·ω
How it works ▼
- The chain of power. The driver (first gear) is the motor. Every gear meshes on its pitch circle with the next. The driven (last gear) is the output shaft. Its angle θshaft(s) is a true integral of the instantaneous output speed ωout(s) = (−1)meshes·ωin/GR over simulated time s — so when you edit the train, reverse the motor or switch trains, only the speed changes: the shaft (and therefore the four-bar crank, the slider-crank and the demo pair) keeps running from its current position without jumping.
- Simulated time. Speeds are per simulated second — identical numbers to the true physics. The sim time scale slider sets how many simulated seconds pass per real second: at ×1.00 the motion on screen matches the readouts second-for-second; lower scales are slow motion for clarity (the default 0.1× shows a 300 rpm motor at a crisp 1 rev/s of the driver).
- Speed & ratio. GR = Ndriven/Ndriver, ωout = ωin/GR, τout = τin·GR. A torque-multiplying (GR > 1) train makes the linkages turn slower; a speed-increaser makes them spin faster with less torque.
- Exact kinematics & velocities. The four-bar uses the closed-form Freudenstein solution (coupler b and rocker c stay exact at every crank angle; no integration drift). Rocker angular speed and piston velocity are closed-form derivatives of the same solution, so the mechanism speeds are consistent with the shaft speed to machine precision.
- Edit anything. Change teeth, add/remove gears or trains, reorder by dragging on the canvas or a card, reverse the motor — the shaft and every linkage recompute from the real equations and keep moving continuously.
- Demo gear pair. The third panel is an independent external-mesh pair driven by the same shaft, showing no-slip counter-rotation (ωr = constant at the contact point).
Educational simulation. Plain HTML, CSS & JavaScript — no libraries, works offline.
· one motor drives the whole mechanism