Where does a logic gate actually come from?
Before the transistor, computers thought in copper and clicks. Drag mechanical relays onto a canvas, wire them up, and watch a real circuit compute — armatures snapping shut, contacts sparking, every click the genuine sound of a 1940s machine. This is the physical layer beneath every AND gate.
A logic gate isn't magic. It's a switch pulled shut by a magnet.
Every gate you've ever used comes down to three physical ideas. Watch them happen, one relay at a time.
1 · The electromagnet
Send current through the coil and it becomes a magnet, pulling an iron armature down toward it.
2 · The contact
That moving armature flips a switch — closing one path, opening another. Now electricity controls electricity.
3 · The logic
Wire relays in series and you have AND. In parallel, OR. Flip a contact and you have NOT. That's the whole gate set — built from metal.
Not an animation. A simulation.
Under the canvas runs a real DC circuit solver. Nothing here is faked for show.
Real volts and amps
Ohm's law and Kirchhoff's laws solve the actual node voltages and currents. Lamps dim by the power they dissipate.
Mechanically faithful
Armature, spring, and contact geometry move like real hardware — a 22 ms pull-in, and a staggered cascade as one relay trips the next.
The genuine sound
Every click is a recorded Omron relay, fired at the exact moment its contacts make or break. Turn the sound on and hear a computer think.
Seven languages
The whole lab — menus, labels, every example — speaks English, 中文, 日本語, Español, 한국어, Deutsch, and Français.
Chapter 0, then the climb.
DigiSim takes you from a single AND gate to a working 8-bit CPU. The Relay Lab adds the rung beneath it — so you don't just use a gate, you build one from the metal up. When you're ready, keep climbing.
- 1 Relay You are here
- 2 Logic gate
- 3 Adder
- 4 Memory
- 5 8-bit CPU
24 circuits, ready to run.
Every example is fully wired — load it, flip the inputs, watch the relays cascade. They follow the chapters of Charles Petzold's CODE, so the set reads like the book.
Reading CODE? Build every circuit from the book.
Charles Petzold's CODE traces computing from a flashlight to a CPU — and the relay is where it gets real. The lab's examples follow the book's chapters, so you can read a page, then watch it turn into a working machine.
Start with “The relay”Free to play. No login, no setup.
The Relay Lab runs entirely in your browser — drag, wire, and run all 24 examples without an account. When you're ready for the full toolkit — 60 components, saved circuits, and the whole path to a CPU — that's where the tiers come in.
Hear a computer think.
Open the lab, drop in a relay, and flip the switch. (Sound on.)
Open the Relay Lab