Drop pins, connect links, add sliders — and watch your mechanism come alive. Powered by a Newton-Raphson constraint solver. No install, no account, no limits.
MechSim runs entirely in your browser — no downloads, no account required. Build any planar mechanism from simple four-bars to complex multi-slider chains, then simulate, record, and export kinematic data.
📐
Pin & Link Editor
Place grounded pivots, free joints, and connect them with rigid links. Drag to reposition, click to edit properties.
🛤️
Rail, Arc & Circle Sliders
Linear rails, arc paths, and full circle sliders — passive or motor-driven. Mix slider types in a single mechanism.
⚙️
Newton-Raphson Solver
Levenberg-Marquardt constraint solver resolves complex chains in real time. Configurable tolerance and iterations.
📈
Data Recorder
Record position, velocity, and acceleration for any tracked joint. Export to CSV for analysis in Excel or MATLAB.
✏️
Trace Paths
Visualize coupler curves in real time. Enable trace on any pin to see the path it draws during simulation.
💾
Save & Load
Download your mechanism as a portable .mechsim.json file. Reload anytime — no account needed.
Quick Start
Three steps to your first mechanism
Getting started with MechSim takes under a minute. The keyboard-driven workflow keeps you focused on the mechanism, not the interface.
Place ground pivots
Press G and click on the canvas to place two grounded pins. Set angular speed on one to make it the crank.
Add joints & links
Press J to add free pins, then L to connect them with rigid links. The solver auto-detects the chain.
Hit Play
Press Space and watch it move. Enable trace paths, record data, or adjust speed — all in real time.
Complete Tutorial
Tools & keyboard shortcuts
Every action in MechSim has a keyboard shortcut. The tool palette covers all the primitives you need to build any planar mechanism — from simple four-bars to multi-slider assemblies.
◎
Select S
Click any pin or link to select it. Drag to move. Open the properties panel to edit length, speed, or toggle ground.
◉
Pin J
Place a free joint anywhere on the canvas. Pins are the joints that connect links.
━
Link L
Click pin A then pin B to create a rigid link. Length is fixed at creation distance.
⚓
Ground G
Toggle any pin between free and grounded. Set ω (rad/s) in the props panel to make it a crank pivot.
⇔
Actuator A
Creates a prismatic joint. Can be articulated piston or fixed-axis rail. Supports passive (coupler-driven) mode.
Rail Slider R
Two endpoints define a rigid rail. A slider pin S rides between them. Connect couplers to S for passive mode.
Arc Slider C
Select 3 pins (start → mid → end) to define an arc. Pin S slides along the circular arc.
Circle Slider O
Select center then rim pin. Pin S orbits the full 360° circle. Set speed for continuous rotation.
W
Weld W
Rigidly fix two pins together. Useful for attaching extensions to existing joints without allowing relative rotation.
Keyboard Shortcuts
Work fast
Every tool has a key. Tools are disabled while Running or Paused — press Reset first to return to Edit mode.
SSelect
JPlace pin
LLink
GGround
AActuator
RRail slider
CArc slider
OCircle slider
WWeld
SpacePlay / Pause
DelDelete
Ctrl ZUndo
Ctrl YRedo
ScrollZoom
DragPan canvas
⚠
Edit mode only: J L G A R C O W are disabled while Running or Paused. Press ↺ Reset to re-enable all tools and return to initial state.
💡
Background images: Drag and drop any image onto the canvas to use it as a reference layer. Adjust opacity in the header. Images are saved with the mechanism file.
Mechanism Library
Classic linkages you can build
The fundamental mechanisms of planar kinematics, all assemblable from pins and links in MechSim.
Four-Bar Linkage
Crank, coupler, rocker, ground. Grashof's law governs whether it's a crank-rocker, double-crank, or double-rocker. Foundation of engines, wipers, walking machines.
Crank-Slider
Converts rotation to reciprocating linear motion. The foundation of piston engines and pumps. Built with a grounded crank, coupler, and a fixed-axis slider pin.
Chebyshev Linkage
A four-bar where the coupler midpoint traces an approximate straight line — useful for converting rotation to translation without a prismatic joint.
Rail + Arc + Circle Sliders
Three slider types: straight rail, circular arc (3-point), and full 360° circle. Each slider pin can be passive (coupler-driven) or active (motor speed).
Step-by-Step
Build a four-bar from scratch
The four-bar is the simplest closed kinematic chain — three moving links plus the ground. It's the starting point for almost every mechanism you'll design.
// Step 1 — Ground pivots
Press G (Ground tool)
Place two grounded pins — O₂ and O₄
Select O₂ → set ω = 1 rad/s// makes it the crank// Step 2 — Free pins
Press J (Pin tool)
Place pin A near O₂, pin B near O₄
// Step 3 — Links
Press L (Link tool)
Connect: O₂ → A// crank arm
Connect: A → B// coupler
Connect: O₄ → B// rocker// Step 4 — Simulate
Press Space → watch it move
📐
Grashof's Law: For a crank-rocker, shortest + longest ≤ sum of the other two. The preset uses L₂=80, L₃=180, L₄=120, L₁=200 which satisfies 80+200 ≤ 180+120.
Slider types: passive vs active
Understanding the difference between passive and active sliders is key to building complex multi-slider mechanisms.
PassivePosition driven by coupler geometry — NR circle∩line intersection
ActiveMoves at set speed (rad/s or u/s), bounces at limits, drives dependent joints
Active + couplerpinS is fixed anchor — NR resolves downstream passive joints from it
Under the Hood
Newton-Raphson constraint solver
Every link contributes a scalar equation f(q)=0. MechSim assembles the Jacobian and iterates using a Levenberg-Marquardt variant that prevents divergence near singular configurations:
// Revolute link
|A − B|² − L² = 0
// Fixed-axis actuator
(B − G) · n̂ = 0
// Rail slider (S on line A→B)
(S − A) × (B − A) = 0
|A − B|² − L² = 0
// Arc slider
|S − center|² − r² = 0
// Iteration (Levenberg-Marquardt)
q ← q − Jᵀ(JJᵀ + λI)⁻¹ f(q)
The tol and iter inputs in the header control convergence. Lower tol = more precise. Higher iter = handles complex configurations.
⚙
Tuning: For fast preview use tol=0.1, iter=20. For accurate recording use tol=0.001, iter=100. The λ=0.1 damping factor prevents divergence near singular positions.
Simulation state machine
⚠
LOCKED: NR failed to converge. Usually a link is too short to reach two pins. Fix geometry and press Reset.
FAQ
Common questions
How do I save my mechanism?
Click 💾 Save to download a .mechsim.json file. Click 📂 Open to reload it. No account needed — fully portable. Save files include geometry, link lengths, slider configs, background image reference, and all simulation settings.
What does "LOCKED — singular position" mean?
The Newton-Raphson solver couldn't find a valid configuration — usually a link is too short to connect two pins at their current positions. Press ↺ Reset to restore the last valid state, then adjust link lengths or pin positions.
What's the difference between passive and active sliders?
Passive: position is determined by coupler geometry — NR places the slider at the circle∩line or circle∩circle intersection.
Active: slider moves at a set speed, bounces at limits, and its pinS is treated as a fixed anchor that drives downstream passive joints.
Can I export kinematic data?
Yes. Enable Trace path on any pin. Click ⏺ Record to capture position, velocity, and acceleration at configurable intervals. Export as .csv — timestamps start at zero for easy analysis in Excel, MATLAB, or Python.
Can an active arc or circle slider drive a passive linear slider?
Yes. Set the arc/circle slider as Active (non-passive, speed≠0). Connect a coupler link from its slider pin to a pin on the passive linear slider. The solver treats the active pinS as a fixed anchor each frame, then resolves the linear slider's position from the coupler constraint.
Why can't I edit while the simulation is running?
When you press Play, MechSim locks the initial snapshot. Edits during simulation would corrupt that snapshot. Press ↺ Reset to return to Edit mode — all tools are re-enabled and the mechanism returns to its initial position.
What browsers does MechSim support?
MechSim runs in any modern browser with no plugins required. Tested and verified in Chrome, Edge, Firefox, and Safari. The Newton-Raphson solver runs at 60 fps on typical desktop hardware.
How do I use a background image?
Drag and drop any image file onto the canvas. The image appears as a reference layer behind your mechanism. Adjust the background opacity slider in the header to make it more or less prominent. The image path is saved with your .mechsim.json file.
Ready?
Start building mechanisms now
Free, browser-based, no installation. Works in Chrome, Edge, Firefox and Safari.