Hi, I'm Anthony.

Rod Logic and Mechanical Computation

November 9, 2015

There’s just something beautiful about the sight of gears and linkages in motion. Let’s build some logic gates!

Background

There are currently a few well-known systems of mechanical computation:

The Zuse Z1 is especially interesting because it was actually built - Konrad Zuse finished the original in 1938, predating the ENIAC by 8 years. The mechanisms within the device implemented Boolean logic, memory, and even floating point operations, using rods, bars, and levers.

Rod logic is a well-researched topic - here’s a few common logic gates implemented using just rods and knobs. However, all of these mechanical logic systems have a problem - their gates are not composable. Consider the identity gate from the previous link:

Identity gate in standard rod logic

The vertical green rod is the input - it can either be retracted up (logical 0) or extended down (logical 1). The horizontal rod is the output - it can either be retracted left (logical 0), or extendable right (logical 1).

When the input rod is extended, the output rod is extendable rather than extended - we must attempt to push it in order to obtain its value. That means that in order to feed the output of this gate into the input of another, we need a device to reset the output rod and attempt to push it every time the input rod changes.

The Zuse Z1’s rod logic has the same issue. Konrad Zuse solved this with a clever clocked gate design described in the paper linked above - the mechanisms for composing gates took up the entire lower part of the computer. Unfortunately, this also meant that all the gates had propagation delays of at least a quarter of a clock cycle.

Design

We’re going to avoid this issue by designing gates that are directly composable - the output rod will be extended to represent 1, and retracted to represent 0.

NOT Gates

This one is pretty simple:

When the cyan input rod is pushed, it turns the blue gear, which then retracts the red output rod. It is easy to analyze this system and see that the output rod’s extension is exactly \(E - x\) where \(E\) is the maximum extension and \(x\) is the input rod extension.

Note that NOT gates will often not be necessary, because retracting a rod from one point of view is extending it from the opposite side - the following two circuits are equivalent, since rotating the AND gate by 180 degrees inverts all of its inputs:

Removing NOT gates where not necessary

OR Gates

This is a bit more complex than the NOT gate, having 3 mechanical layers:

Here, either of the two cyan and magenta input rods can be extended right to push on the red output rod and cause it to extend right, so the output rod’s extension is at least \(\max(x_1, x_2)\) where \(x_1\) and \(x_2\) are the amounts by which the input rods are extended.

Additionally, the unanchored small blue gear moves the purple rack gear right by \(\frac{x_1 + x_2}{2}\), which, through the green gears, moves the longer orange rack gear by \(x_1 + x_2\). The orange rack gear hooks onto the red output rod to ensure that the output rod’s extension is at most \(\min(E, x_1 + x_2)\), where \(E\) is the maximum extension and \(x_1, x_2\) are the extensions of the input rods.

Therefore, the extension of the output rod is between \(\max(x_1, x_2)\) and \(\min(E, x_1 + x_2)\) inclusive:

OR gate output

From the plots, we can tell that the position of the OR gate’s output rod is exactly \(\max(x_1, x_2)\) whenever either \(x_1\) or \(x_2\) are either \(0\) or \(E\).

AND Gates

This is very similar to the OR gate:

Here, either of the two cyan and magenta input rods can be retracted left to pull on the red output rod and cause it to retract left, so the output rod’s extension is at most \(\min(x_1, x_2)\) where \(x_1\) and \(x_2\) are the amounts by which the input rods are extended.

Additionally, the unanchored small blue gear moves the purple rack gear right by \(\frac{x_1 + x_2}{2}\), which, through the green gears, moves the longer orange rack gear by \(x_1 + x_2\). The orange rack gear pushes the red output rod to ensure that the output rod’s extension is at least \(\max(0, x_1 + x_2 - E)\), where \(E\) is the maximum extension and \(x_1, x_2\) are the extensions of the input rods.

Therefore, the extension of the output rod is between \(\min(x_1, x_2)\) and \(\min(0, x_1 + x_2 - E)\) inclusive:

AND gate output

From the plots, we can tell that the position of the AND gate’s output rod is exactly \(\min(x_1, x_2)\) whenever either \(x_1\) or \(x_2\) are either \(0\) or \(E\).

Alternative designs

There are actually simpler ways to do mechanical AND and OR gates. One of them has a free spur gear like the above designs, but connects that gear to a sliding channel that moves the output rod perpendicular to the input rods (the shape of the channel determines whether it is an AND or an OR gate). In fact, this would even allow us to create an XOR gate with minimal effort. However, the presented designs have several advantages:

Construction

The schematics were made directly in Inkscape. In hindsight, it would’ve been better to simply stick with CAD software, even if Inkscape did make the laser cutting process easier later on.

Inkscape gate designs

These designs are the same as in the visualizations above, but with support structures that hold all the parts in place.

I ordered my designs from Ponoko, a self-serve laser cutting service. The material is ordinary 3mm clear acrylic, to allow the internal mechanisms to be visible from outside.

Here’s what the cutting design looked like:

Part schematics for laser cutting

A few weeks later, we’ve got a beautifully cut sheet of acrylic, and the parts come out perfectly:

Laser cut parts

I’m going to skip the assembly steps, but here are a few notes on the process:

Completed gate assemblies

Results

Both gates currently have an actuation force of less than 300 mN in all states. This can be reduced further by sanding down the parts that are binding and cleaning up all the extra hot glue.

Off topic, but my laser cut business cards also arrived while writing this. I’m really happy with how they turned out:

Laser cut business card

Downloads

Questions or comments? Drop me a line at me@anthonyz.ca.
Creative Commons License This work by Anthony Zhang is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. Copyright 2013-2023 Anthony Zhang.