/building · 2011

Lego Logic Gates

not · nor · and · xor

NOT, NOR, AND, and XOR gates built from Technic axles and beams, where an axle pushed in is a one and pulled out is a zero.

A yellow Lego frame labelled NOT gates, with input and output axles marked 0 and 1

The trick is to decide that an axle sliding back and forth inside a beam is a signal. Pushed in is one, pulled out is zero. Once you accept that, a logic gate is a mechanism that moves an output axle to the right position for a given pair of input axles, and you can go looking for one in a box of Technic parts.

A yellow Lego frame labelled NOT gates, with input and output axles marked 0 and 1
Two NOT gates in one frame. An input pushed in drives a lever that pulls the output out.

NOT and NOR came quickly. Inversion is a lever, and NOR follows from it without much trouble.

A tan and grey Lego NOR gate with two black input axles
A Lego AND gate on paper next to a hand-drawn gate symbol and truth table
NOR, and the AND gate with the truth table I kept redrawing to check it.

AND and XOR took considerably longer. Both need the mechanism to tell one input being high apart from both being high, and finding a linkage that does that without binding or sticking took a lot of rebuilding. XOR ended up the widest of the four by some margin.

A wide Lego XOR gate assembly built from several linked sub-mechanisms

I posted the result as an answer to a question on the Bricks Stack Exchange about whether logic gates can be built from Lego mechanics, and that is still how most people find it. Others built better versions, and for a while in the early 2010s there was a small community around mechanical logic. It remains the thing strangers most often email me about, usually with an improvement attached.

cd /building