Lego Turing Machines


I originally started my hobby in electronics because I wanted to make machines that performed complex tasks. So clearly I was going to be a mechanical engineer. Then I found out that it was not actually as difficult as it appeared to design electronic devices to perform computations. After that, electronics became my main hobby. I eventually attempted to make logic gates from Legos, but I could not figure out how to make simple versions. One Christmas, I recieved a Lego pneumatics kit with pneumatic cylinders, switches, and pumps. Eventually, I made a pneumatic switch by using a cylinder to flip one of the switches. In other words, I made a Lego relay, and computers used to be made of relays. One of the first things I learned about when studying electronics was the Turing machine, which is pretty straight forward to implement and uses few resources. Therefore, a Turing machine was the logical thing to make out of these Lego relays.

The Turing machines would have used a punch card as the program input, and a long Lego "tape".

The first Turing machine (TM1) would read off of a location on the punched card and then execute what it saw just like a normal Turing machine. The problem was that I only put one address in the instruction, so what it read on the tape did not influence the next state. Only after I completed design of the second machine would I realize this mistake. Another problem was that I was planning on making extensive use of Lego one-way valves that I believe were only sold in one rare set. The purpose of these was to make a comparator (SN74L85) that would check to make sure it was reading the correct state. A rough estimate placed the price at around $935, which is still cheaper than its competitor.

The second Turing machine (TM2) fixed the $935 problem (mostly) by eliminating the Lego equivalent of the 7485 comparator, and instead using a mechanical counter to cause a relative jump to another state. This meant that TM2 was not a true Turing machine, but is close enough to be considered one. Like TM1, this version has the the bug where the next state is not selected by the contents of the tape.

The third Turing machine (TM3) is more expensive than TM2 ($265) due to added complexity that went into fixing the bug. This was fixed by reading the tape and then moving the card to the proper substate. Here is a comparison of the two card formats:

TM1/2 had a format like this:
|drive|if-0|if-1|5'address|5'next-address|

Drive is used to move the card.
If-0 is what is written onto the tape if a 0 is read, and if-1 is what is written onto the tape if 1 is read.
5'address is the 5-bit address of the state.
5'next-address is the 5-bit address of the next state. This will be jumped to no matter what is on the tape.

While I never came up with an exact card format for TM3, it would have looked a bit like this:
|drive|if-0|5'address|0|5'next-address-0|
|drive|if-1|5'address|1|5'next-address-1|

0 and 1 are what are written in the instruction.
Next-address-0 is the next state if the tape reads 0, and next-address-1 is the next state if the tape is reads 1.

The two instructions are in the same column, so the card must be physically moved in order to read the '1' instruction. If I were to make a TM4, I would probably remake TM2, but with this instruction format:

|drive|if-0|if-1|5'next-address-0|5'next-address-1|5'address|drive|

The Turing machines provided my first experience in computer design, and figuring out how to create a computer that was practical to program was the next step.

Updated 1/8/2020