·  one motor drives the whole mechanism

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.

Train 1 drive train → output shaft → four-bar, slider-crank & gear pair
20 → 40 teeth
Drive train meshing gears · click to select · drag sideways to reorder · the last gear feeds the shaft below
Output shaft → linkage mechanisms shaft angle is integrated from ωin/GR · exact closed-form kinematics
Output shaft θrev 0 · sim t 0 s
Shaft ω (rad/s) signed, per simulated s
Rocker θ₄ deg from ground line
Rocker ω₄ (rad/s) closed-form derivative
Piston x world units
Piston velocity world units / s
driver · motor idler · direction only driven · output shaft four-bar links: crank amber / coupler blue / rocker green
Speed (ω) 
Torque (τ) 

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.

Gear ratio GR2 
Input speed ωin (rad/s)  
Output speed ωout (rad/s)  
Input torque τin (N·m)  
Output torque τout (N·m)  
Power P (W) ideal gearbox: τ·ω conserved
Pitch-line speed v (m/s) same at every mesh · module 12 mm
Output direction  

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.