• Jim MacArthur
Robots, automata and electronics


Mechanical decoder logic

Sunday, 25th June 2017

A 1-of-n decoder is an electronic device which takes a number (n) of binary inputs and produces a binary '1' on one of 2^n outputs. It's a special case of a demultiplexer in which the data input is always '1'.

Alt text not implemented

Applying, say, the digital pattern "101" on the inputs will cause output 5 to be high and all the other outputs to be low.

A decoder can be part of a programmable logic array. By taking the logical "or" function of selected outputs of a decoder, any function of the decoder's inputs can be mapped to any output:

Alt text not implemented

Implementing a decoder mechanically is relatively easy. We create a series of rods for each selection input, with bumps that enable a plate to fall into a gap, with each rod moved a small distance, or not, depending on the input.

Alt text not implemented

In the top diagram all the rods are in the off state, and output zero is able to fall into the gap provided. The output plate can only fall if all the rods have a space where the rod can fall. In the bottom diagram, output 5 is selected by moving the 1 and 4 rods one space to the right.

Following is a picture of a 3-to-8 decoder I've made using laser-cut acrylic. There is nothing to drive the inputs or use the outputs at the moment, but hopefully it demonstrates the principle.

Alt text not implemented

In this picture, the second (2^1) rod is moved right by 5mm, and the rod in position 2 has dropped (0 is on the right). The red lever on the left lifts up all the output rods at once so the input can be changed.

As well as providing a means of general combinational logic, the decoder is also a vital part of my RAM system. Using a three-input decoder to select one column, and another three input decoder to select one row, we can select one element out of an 8x8 matrix, which works as a 64-bit memory.