Logic Gate Linkage Calculations

In my previous post, I simulated some mechanical logic gates using a novel 3-bar linkage.
The dimensions of the linkage are critical to achieving correct operation;

Inputs , , must all produce the same output position.

For the simulations, an empirical approach was used. (fiddle with the values until it looks right)

This time, I’m going to attempt to find the exact values to use for a given stroke, separation distance and output position.

analysis
Here, you can see the linkage layout for and

Mathematics

Ahead lurks tough mathematics (which may be unsuitable for liberal-arts majors)
If it’s hard to read, then sorry! It was hard to write!

Parameters

  • Separation between inputs
  • Stroke length
  • Input link length
  • Output link length

Geometry

  • is the input position when
  • is the input position when
  • is the input position (The system is symmetric, does not need to be tested.)
  • is the middle position when
  • is the middle position when
  • is the output position. ( for the gate to function correctly.

Solving

Finding :

Finding :

Finding :

  • is the midpoint of
  • is the length of the line
  • is the length of the line

Using this, we can calculate M’:

Finding :

And then:

Now that and are found, and we know …

Finding the equation in terms of :

Substituting back into the equation:


Ugly, but workable?

Example:

  • Separation between inputs
  • Stroke length
  • Input link length
  • Output link length
  • Desired output position


Pushed through Wolfram Alpha…

Summary:

Phew!

Thusly, one can calculate the input and output linkage lengths for any logic gate.
These dimensions will work for an OR gate too, as the linkages are just reversed.

It’s irksome that I couldn’t work out a symbolic solution for the last equations, especially since in the example came out to such a neat value.

I might revisit this further in the future, and it’ll definitely come in handy when building something with these gates.

Springless Reversible Mechanical Logic

Logic gates! The building blocks of computing as we know it. What if we ditch the electrons?

I want some mechanical logic for an upcoming project, so I did some research…

Research

There are several examples of mechanical logic out there on the internet:

WebsiteComments
Keshav Saharia’s Lego LogicPush-pull, needs a spring return.
Randomwraith’s Lego LogicPush-pull with internal rotating elements, reversible.
Mechalogic’s Logic ElementsPush-pull, AND & NOT reversible, OR needs a spring return.
Xiaoji Chen’s Linkage ComputerRotating logic, reversible, some mechanical issues with parallelogram weakness.
Spillerrec’s Lego Logic GatesPush-pull, very compact, needs a spring return.
He identifies the problem with needing springs, but doesn’t have a fix. Mentions how AND/OR gates can be reversed to become OR/AND gates.
Zeroumus’s AND GatePush-pull, needs a spring return.
KNEX XOR GatePush-pull, needs a spring return.
Carolin Liebl and Lisa Hopf’s NAND GatePush-pull, reversible, complex.

There are many more ideas out there, even water pipe logic, and of course the early mechanical computers Digi-Comp I and Digi-Comp II.

For my project, I have the following requirements;

  • Push-pull logic
  • Output movement range must equal input movement range
  • No springs/elastic bands, and no forces for inputs to overcome
  • No gears!
  • Easily chain-able, and simple enough to implement a score of them.

This disqualifies most of the designs I found, particularly the ‘no springs’ requirement.

AND Gate

Mechalogic’s AND gate design uses an elastic band, but doesn’t appear to need it, so it serves as a good starting point:

Mechalogic 2-input AND Gate

It’s time consuming to tweak parameters in the physical world, so I wrote a small simulation: (click to see in action)

2-Input AND Gate

Success! Meets all the requirements, and only needs three parts.

The geometry is important – the ratio will determine the output’s position when only one of the inputs is asserted, according to;

  • distance between the inputs (red),
  • length of the input links (green),
  • length of the output link (teal)
  • input displacement

Now, can an OR gate be designed with the same success?

OR Gate

Most OR gates look like this; the output (on the left of this picture) has a flat plate, and either input will push the flat forward. Unfortunately the design needs that elastic band to return the output to zero.photo-jan-26-2-57-46-pm[1]

Inspired by some earlier attempts to couple an AND and a backwards OR gate together, I tried flipping the AND gate around; (click to see in action)

2-Input OR Gate

Success! Oddly enough, an OR gate is just an AND gate connected up backwards.
Even the linkage lengths are the same!
Best of all, the OR gate is reversible like the AND gate – no springs and no force required.

AND Then?

As the graphs show, output displacement equals input displacement, so these designs should be chainable. Let’s have a look; (click to see in action)

3-Input AND Gate

3-Input OR Gate

Success!

Now I just have to build something complex with them…


All the simulations are viewable here.
The code they’re written with is available on GitHub;
https://github.com/MrTrick/logic_gates