Search › A-Z › A › Antikythera Mechanism
Antikythera Mechanism
The Antikythera Mechanism is the world's oldest known analog computer, and this is an original, faithful simulation of it in the browser. It reproduces the c. 100 BCE Greek bronze gear-train: the Sun and Moon pointers with the pin-and-slot device that gives the Moon its varying speed, the Metonic calendar spiral, the Saros eclipse-prediction spiral, and the planetary pointers. You turn the crank to drive it. There is no processor and no memory — the computation lives entirely in the ratios of the gears — so in place of a CPU debugger it exposes a gear-train inspector.
Runs on: Web browser
Antikythera Mechanism Online Emulator
Play Antikythera Mechanism using JavaScript directly in your browser.
Controls
Configurations
| Configuration | Emulator | Machine | OS | Legal | |
|---|---|---|---|---|---|
| Front dials — Sun, Moon & planets | Antikythera Mechanism | Antikythera Mechanism | open | Open ⛶ | |
| Back dials — Metonic, Saros & eclipses | Antikythera Mechanism | Antikythera Mechanism | open | Open ⛶ |
Notes
Embedding
The mechanism is modelled from scratch in plain JavaScript. There is no CPU and no ROM — the "program" is the physical gear train. A single state variable, the day count, is set by the crank; every pointer is then a pure function of that one input through the real tooth-count ratios. Nothing is animated on a canned path: change a tooth count in antikythera.js and the period changes with it.
The crank is the whole input. One full turn advances the model by one mean synodic month (a documented modelling ratio — the original handle ratio is lost). The host owns the "loop": the crank / jog controls call mech.addCrank(deg) or mech.addDays(n), which move the day count and redraw.
var mech = new Antikythera();
mech.addCrank(360); // one turn = one synodic month (29.53 d)
mech.addDays(1); // single-step: advance one day
var st = mech.state(); // Sun/Moon/phase/planets + Metonic/Saros/Games dials
| Member | Kind | What it does |
|---|---|---|
mech.gears | field | The gear scheme: each entry has name, teeth, what it drives, its arbor, a note, and rate(days) = revolutions/day (the product of tooth ratios along the surviving train). |
mech.days / setDays / addDays | state | The one state variable and its setters. The crank writes it; the debugger reads and sets it. |
mech.addCrank(deg) | method | Advance the crank; 360° = one synodic month. Drives the whole train. |
mech.state() | method | Full read-out: Sun longitude + zodiac sign, Egyptian calendar day, Moon longitude + phase, the Metonic/Saros/Callippic/Exeligmos/Games dial positions, and the five planet longitudes. |
mech.gearAngle(g) | method | The current rotation of one gear (degrees), used by the debugger's gear listing. |
mech.eclipseCells | field | The Saros-spiral cells that carry an eclipse glyph, computed from the nodal geometry. |
Debugger integration
antikythera-debug.js reads window.EMU_BOOT and hands the shared debugger a machine whose "CPU" is the bronze gear train. Every debugger feature maps onto the mechanism.
- Registers = live mechanism state. The input
CRANK°andDAYcount (both settable — type a value and the pointers jump to it), then the read-only pointer anglesSUN°,MOON°,PHASE°and the five planets, and the back-dial positions (MET.cell,MET.yr,SAROS.cell,CALLIP,EXELIG,GAMES), grouped as pointers and dials. - Single-step = advance one day. The Step control calls
transport.stepInsn, which adds one day to the model; every pointer and gear updates. Run/pause free-cranks at a steady rate. - Breakpoints & watchpoints. Execution breakpoints match the integer day index as it advances; watchpoints fire when a watched day index is reached — both are real checks in the crank loop, not stubs.
- Disassembly = the gear train. A new
gearsdecoder (debugger/src/cpus/gears.js) renders one row per gear — name, tooth count, the gear it meshes with, revolutions per year, and its current angle — so the "code" window literally lists the mechanism, and it updates as you crank. - Memory. Two chips: the gear train (one gear per address, gears-disasm) and the pointer angles as bytes (hex/bits), read side-effect-free.
- Controls. The Controls window carries an on-screen crank (forward / back), day / month / year jogs, a FRONT/BACK face toggle and a reset — the same handlers the page's mouse-wheel and dial use.
Architecture
The Antikythera Mechanism (c. 100 BCE, recovered 1901 from a Roman-era shipwreck off Antikythera) is the oldest known analog computer: a shoebox-sized bronze case holding at least 30 surviving gears (37+ originally). A hand crank turned a great four-spoke wheel and a nest of gears converted that one motion into a model of the sky. It has no electronics, no CPU and no stored program — the computation IS the gearing.
Gear trains modelled here (tooth counts from the Antikythera Mechanism Research Project — Freeth et al., Nature 2006, and Freeth et al. 2021):
- Mean Sun / date. The great wheel
b1(223t) turns once per tropical year, carrying the date pointer round the 360° zodiac and the movable 365-day Egyptian calendar ring. - Sidereal Moon.
b2(64) →c1(38) /c2(48) →d1(24) /d2(127) →e2(32) gives exactly 254/19 turns per year — one turn per sidereal month (27.32 d). The 127-tooth wheel is the famous one (127 = ½ of 254). - Pin-and-slot lunar anomaly. Two 50-tooth wheels
k1/k2that do NOT mesh: a pin onk1rides in a radial slot ink2, and because their centres are offset the Moon speeds up and slows down — the Moon's real 1st anomaly (~6° equation of centre). The pair rides on a carrier (e3223 /e4188) that turns at the lunar-apogee rate (~8.85 yr) so the anomaly line precesses. Modelled with the true pin-and-slot geometry, so the variation emerges, it is not a scripted wobble. - Moon phase. A differential takes Moon − Sun to turn a half-black/half-white ball at the synodic period (29.53 d).
- Metonic calendar.
b2(64) →l1(38) /l2(53) →m1(96) /m2(15) →n1(53) gives 5/19 turns/year, driving the back upper 5-turn spiral of 235 cells (235 synodic months = 19 years, 47 per turn). The two 53s cancel — the real design. - Saros eclipse cycle. A 4-turn spiral of 223 cells (223 synodic months ≈ 18.03 yr). Each cell that can carry an eclipse is marked with a ☉ (solar) or ☾ (lunar) glyph; here those cells are computed from whether a syzygy falls inside the ecliptic limits of a lunar node, so the glyph pattern is derived from the nodal geometry (≈38 glyphs, 5–6 months apart, as on the real dial).
- Subsidiary dials. Callippic (76 yr = 4 Metonic), Exeligmos (3 Saros, +0/8/16 h eclipse-time correction) and the Games / Olympiad 4-year dial naming the Panhellenic games (Olympia, Nemea, Isthmia, Pythia, Naa, Halieia).
- Planets. Pointers for Mercury, Venus, Mars, Jupiter and Saturn.
Faithful vs conjectural. The Sun, Moon (including the pin-and-slot), Metonic and Saros gearing survive in the fragments and are modelled from their real tooth counts. Much of the Saros/Callippic/Exeligmos intermediate gearing, and all of the planetary gearing, did not survive and is reconstructed or conjectural (the 462-year Venus and 442-year Saturn cycle inscriptions are the main planetary evidence). Those gears are flagged RECONSTRUCTED / CONJECTURAL in mech.gears. The planet positions shown are computed from real orbital motion (which the lost epicyclic gearing only approximated) so the pointers are honest even though their bronze is speculative. Nothing here is faked: the periods you can check — synodic month 29.53 d, sidereal month 27.32 d, the Metonic 235/19 and the Saros 223 — all fall out of the gear ratios.