Chris Collins

Tools · physics

Linkages and mechanisms

Mechanisms you can play with — an animated four-bar linkage with the Grashof check, its type, the coupler curve and the transmission angle; slider-cranks with stroke and quick return; disc cams with uniform, harmonic, cycloidal and 3-4-5 motion, pressure angle and undercut check; a 2- or 3-link robot arm you drag by the hand, with both inverse-kinematics solutions; and differential-drive kinematics and odometry for small robots.

Added

How to use it

Lengths are in millimetres or inches (the Units switch at the top, remembered). Every drawing animates — Pause it and drag the angle slider to step through by hand. ⛶ Full screen (or f) gives the drawing the whole window; ☰ Inputs and Readouts ◨ hide the panels so the drawing goes edge to edge, and Escape leaves.

Four-bar

Enter the crank a (the input, pivoted at O₂), the coupler b, the rocker c (the output, pivoted at O₄) and the ground link d between the pivots. The tool reports:

  • Grashof condition — with s the shortest and l the longest link, and p, q the other two, s + l < p + q means at least one link can turn fully. Which link is shortest then decides the type (Barker’s classification): shortest link the crank → crank–rocker; the ground → double-crank (drag link); the coupler → double-rocker; the rocker → rocker–crank. If s + l > p + q nothing turns fully (a triple-rocker); if they are equal it is a change-point linkage that passes through a flat position where it can flip between assemblies.

  • Input range and output swing — for a rocking input, the limits where the coupler and rocker line up (found by bisection).

  • Transmission angle μ, between coupler and rocker at B. Its extremes for a crank–rocker fall where the crank lines up with the ground: cos μ = (b² + c² − (d ∓ a)²) ÷ 2bc. Keep μ between about 40° and 140° for a smooth-running linkage.

  • Angular velocities at the crank speed you give: ω₃ = aω₂ sin(θ₄ − θ₂) ÷ (b sin(θ₃ − θ₄)), ω₄ = aω₂ sin(θ₂ − θ₃) ÷ (c sin(θ₄ − θ₃)), and the speed of the coupler point.

  • Coupler curve — the path of point P, placed u along AB from A and v to its left. Hoeken’s linkage (example=hoekens) traces a nearly straight line over part of its path, the basis of many walking-robot legs. Open and crossed are the two ways the loop can close for the same crank angle.

Slider-crank

Crank radius r, rod l and offset e of the slider’s line from the crank centre. Position x = r cos θ + √(l² − (r sin θ − e)²); stroke = √((l + r)² − e²) − √((l − r)² − e²) — exactly 2r with no offset. With an offset, the forward and return strokes take different crank angles, giving the quick-return ratio. Velocity and acceleration curves are for the crank speed you give; at top dead centre the acceleration is rω²(1 + r/l), so a shorter rod means harsher motion.

Cams

A disc cam turning anticlockwise with a translating roller follower (a roller radius of 0 is a knife edge), offset e to the right. Program: rise h over one angle, dwell, return over another, then dwell for the rest of the turn. Motion laws:

  • Uniform velocity — infinite acceleration at the ends (jerky; slow cams only).

  • Simple harmonic — peak velocity πh/2β; the acceleration jumps at the ends of the rise.

  • Cycloidal — zero acceleration at both ends; peak velocity 2h/β and acceleration 2πh/β².

  • 3-4-5 polynomial — s = h(10t³ − 15t⁴ + 6t⁵); peak velocity 1.875h/β.

Pressure angle — the angle between the follower’s line and the contact normal: tan φ = (ds/dθ − e) ÷ (s + √(Rp² − e²)), with the prime circle Rp = base circle + roller. Keep it under about 30° for a translating follower; a bigger base circle (or an offset) lowers it. Undercut is flagged where the pitch curve bends tighter than the roller radius: the follower cannot follow the motion there. Formulas from Norton, Design of Machinery, ch. 8, and Rothbart, Cam Design Handbook.

Robot arm

A planar arm with two links (shoulder and elbow, like a SCARA) or three (adding a tool link held at angle φ). Drag anywhere in the drawing to move the hand — inverse kinematics — or move the joint sliders — forward kinematics. For two links, cos θ₂ = (x² + y² − L₁² − L₂²) ÷ 2L₁L₂ and θ₁ = atan2(y, x) − atan2(L₂ sin θ₂, L₁ + L₂ cos θ₂); the ± in θ₂ gives the elbow-up and elbow-down solutions, both listed (the other is drawn faintly). For three links the wrist is solved first, at the target minus L₃ along φ, then θ₃ = φ − θ₁ − θ₂. The shaded ring is the workspace (radii |L₁ − L₂| to L₁ + L₂, shifted along φ for three links); targets outside it snap to the nearest reachable point. The Jacobian determinant L₁L₂ sin θ₂ goes to zero when the arm is straight or folded — a singularity, where the hand cannot move in some directions however fast the joints turn.

Diff drive

Two driven wheels a track width W apart. With wheel surface speeds vL and vR: v = (vR + vL)/2, ω = (vR − vL)/W, turn radius v/ω. Write a program, one move per line, as left_rpm right_rpm seconds; each move is integrated exactly as a circular arc and the path is drawn from the origin facing +y. Below that, wheel speeds for a wanted forward speed and turn radius (vL = v − ωW/2, vR = v + ωW/2), and the pose change for a pair of encoder tick counts (travel per tick = πD ÷ ticks per revolution).

Limits

  • Kinematics only: no masses, inertia, friction or forces — no torque, bearing loads or deflection.

  • Links are ideal rigid bars with frictionless pin joints and no clearance.

  • The four-bar animates in one assembly; a real change-point linkage may jump to the other.

  • Cams: translating roller (or knife-edge) follower only — no flat-faced or swinging followers — and the same law for rise and return. The curvature check is numerical (0.5° steps).

  • The arm has no joint limits or self-collision; real servos usually turn only about 180°.

  • Odometry assumes no wheel slip and perfectly known wheel diameter and track width: real robots drift. To hold a speed or heading, close the loop — see the PID loop simulator.

Linking to an example

Links can be written by hand; lengths in links are always millimetres. Add the tab after #: four-bar, slider-crank, cam, arm or drive.

Parameter Meaning Example

units

mm or in (display only)

units=in

a, b, c, d

Four-bar crank, coupler, rocker, ground

a=40&b=120&c=80&d=100

u, v

Coupler point along AB and to its left

u=60&v=30

asm

Assembly: 1 open, -1 crossed

asm=-1

rpm

Four-bar crank speed

rpm=60

r, l, e

Slider-crank radius, rod, offset

r=45&l=150&e=0

srpm

Slider-crank speed

srpm=3000

rb, rr, off

Cam base circle, roller radius, follower offset

rb=30&rr=6&off=0

lift, law

Lift; uniform, shm, cycloidal or poly345

lift=15&law=cycloidal

rise, dwell, ret

Rise, top dwell, return angles in degrees

rise=120&dwell=60&ret=120

crpm

Cam speed

crpm=120

links

Arm links: 2 or 3

links=3

l1, l2, l3

Arm link lengths

l1=200&l2=150

elbow

up or down

elbow=down

x, y, phi

Hand target and tool angle (degrees)

x=220&y=150&phi=0

wd, track, ticks

Wheel diameter, track width, encoder ticks per rev

wd=65&track=130&ticks=360

prog

Drive program, lines of left_rpm right_rpm seconds (newline as %0A)

prog=60%2060%202%0A30%2060%203

example

One of the presets below; parameters given with it override the preset’s

example=hoekens

Presets:

example= Shows

crank-rocker

A crank–rocker, 40/120/80/100 mm: μ swings between 26° and 86° (open)

hoekens

Hoeken’s straight-line linkage: a nearly straight stretch of coupler curve (open)

drag-link

A double-crank: the output turns fully at a varying speed (open)

triple-rocker

A non-Grashof linkage: the input can only swing ±134° (open)

engine

An engine: 90 mm stroke, 150 mm rod, 3000 rpm (open)

quick-return

An offset slider-crank with a quick return (open)

cam-cycloidal

A cycloidal 15 mm rise over 120°: pressure angle peaks near 18° (open)

cam-undercut

A small cam asked for a fast uniform rise: undercut (open)

scara

A 200 + 150 mm two-link arm (open)

servo-arm-3

A three-link servo arm holding the gripper level (open)

square-path

A small robot driving a square: straight, spin 90°, four times (open)

Runs entirely in your browser; nothing you type leaves this page.