The Mechanical CPU Clock shows the basic building blocks of a CPU (ALU, buses,RAM,registers, and a Control Unit). It executes a set of instructions which will emulate a simple wall clock.
The inspiration for this project came from trying to teach my son and daughter about how a computer works (in reality, I was always fascinated with mechanical computers and clocks, but I had to give a better excuse to my wife for buying a laser cutter specifically for this project). After looking around the web at various mechanical computers, I could not find something that represented all the components of CPU. However, I draw my inspiration from the following projects (and their derivatives):
Marble adding machine: www.youtube.com/watch?v=GcDshWmhF4A
DigicompII: http://digi-compii.com/
Ball Logic: http://brain.wireos.com/?p=2207
In the following sections I will attempt to explain how everything works as it is being built. I am not going to go deep into the subject of computer science and will purposely try to avoid some terms, so to not confuse the novice reader. If I do use any terms, I will try to explain them simply. However, there might be some needed background information that I will miss, so please do not hesitate to contact me about trying to explain the concepts in more details (I don't promise anything, but I will do my best). Even if you are not going to build the clock, going through the sections will help in the understanding of how the clock/CPU works (the build sections will go over the concepts of ALU,RAM,register,control unit and buses). Again, one of the motivations for this project was to get people to understand how a CPU (the heart of a computer) works.
More details about the clock can be found here: http://www.liorelazary.com/index.php?option=com_content&view=article&id=46:mechanical-cpu-clock&catid=10:clocks&Itemid=15
123D: http://www.123dapp.com/idw-3D-Model/Mechanical-CPU-Clock/604647
MCCV1.0.zip561 KBStep 1: CPU instructions
Here are the basic instructions (assembly language) that we will use:
INCRMENT: Increment register A by adding 1 to it.
EQUAL: If register A is equal to a specific number, then skip the next instruction.
CLEAR: set register A to 0, set DTD to false
JUMP: jump to a specific instruction at a given line number
SET_DTD: set DTD to true
CHECK_DTD: if DTD is true, then skip the next instruction.
Here is the assembly language code for the clock (register A will hold the hours).
1: CHECK_DTD
2: JUMP 5
3: CLEAR
4: JUMP 1
5: INCREMENT
6: EQUAL 11
7: JUMP 1
8: SET_DTD
9: JUMP 1
Line 1 checks to see if DTD is set to true (this is used to indicate if we need to reset the hour). If its true the we jump to line 3 and set the hour to 0 and the DTD to false. If DTD is false then we continue with the next instruction and jump to line 5. Line 5 increments the hour (register A), while line 6 check to see if it equal to 11. If register A is equal to 11, then we jump to line 8 and set the DTD to true and jump back to the beginning (line 1). Otherwise, we go to the beginning. If we run though this code once an hour, then by reading register A, we can tell what is the current hour.
Step 2: Hardware Design : Flip-Flop
We start by implementing register A and the ALU (Arithmetic/Logic unit). The ALU is a CPU component that performs all the mathematical operations. In our CPU, the ALU will simply perform a simple operation of adding a 1 to register A. This is also known as an adder (http://en.wikipedia.org/wiki/Adder_%28electronics%29)
Start by creating a 12” diameter disc and attach a Flip-Flop (http://en.wikipedia.org/wiki/Flip-flop_%28electronics%29) to it. A Flip-Flop is a device that alternates its state with a given input. For example, a politician might change his stance on a specific issue based on some event, and then will change it back based on another event. In that case, we say he is a flip-flop, and we might be able to build a computer out of him:) Modern CPUs utilize transistors for their flip-flops, however we will build a mechanical flip-flop that will change its state based on a ball drop.
Step 3: Hardware Design : Register
Step 4: Hardware Design : Register
Step 5: Hardware Design : Register C
Step 6: Hardware Design : DTD
Step 7: Hardware Design : Programming
Step 8: Hardware Design : Buses
Step 9: Hardware Design : Code
1: CHECK_DTD
2: JUMP 5
3: CLEAR
4: JUMP 1
5: INCREMENT
6: EQUAL 11
7: JUMP 1
8: SET_DTD
9: JUMP 1
Line 1 is at the top of the clock, implemented as a wall. When the ball is on track A, it will hit the wall and drop to register A (line 2). In register A, it will increment the register (line 5) and check to see if register A is equal to 11 (line 6). If the check is false (DTD false) then the ball will end up on track A and the ball gets lifted to the top again (line 7). However, if register A is equal to 11, then the ball will end up on track B (DTD true) and will be lifted up to the top again (line 9). Since the DTD is true this time, the ball will be on track B and pass the CHECK_DTD by moving over to register B. Register B will clear itself to 0 and copy the data via the bus to register A. If will then end up at the bottom on track A (DTD false) and move back up to the top (line 4).
Step 10: Hardware Design : Simulation
Step 11: Hardware Design : Lifter
Step 12: Hardware Design : Clock Face
Step 13: Building the clock
The piano wire used is 0.5mm which I got from do-it-center as well as the screws (6-32). I got 2.5 inch screws and cut them to length as needed. Other then that, you only need the acrylic. I used 1/2" for the tracks, and 1/8" for the rest (12x12 sheets).
Step 14: Building the clock
Attach the buss wire to the flip-flops by forming an L band at the bottom.





























































Visit Our Store »
Go Pro Today »




Thanks
Joe
I think that this is actually a Finite State Machine and NOT a CPU. A CPU fetches instructions from a memory and then takes actions based on those instructions. Actions include jumps within the program counter (PC) space, math operations in the ALU etc.
Your machine includes a set of flip flops representing the "current state". Every time a ball is dropped, the flip flops decide what the "next state" will be based on the "current state" of the machine.
In your description, when you say that your machine is jumping to a line of code, I think you mean that it is jumping to a new binary encoded finite state.
Here is a write up on the differences I found with a quick Google:
http://www.cs.utah.edu/~rajeev/cs3810/slides/3810-14.pdf
You might be right that its not a CPU, but not because its a Finite State Machine (because a CPU can be boiled down to a FSM). So first you must define what is a CPU (and there are a few), but the view I take is that a CPU is a Universal Turing Machine (UTM). Which state that a UTM is one that can simulate every possible Turing machine (or every possible FSM). There are one instruction set computers (see OSIC) which are able to simulate every possible FSM, and they don't need to fetch instructions, since they only have one.
This clock can be shown to be a Turing Machine, and thus a computer (see fixed-program computers), however, where is its program memory?
I argue that the program memory is implemented in the paths the ball takes, and is burned in using the laser as well as the configurations of the flip-flops, so its similar to burning the program on a ROM. (although I agree this is a far fetch, but remember that the goal of this project was to help explain what's inside a CPU, and not create a CPU to solve various problems). Therefore, I could change the program of the clock (or change the FSM) by simply rotating one of the L levers or changing the T flip-flops to an L. I could also, remake the tracks of the C register, to check for a different number, or change the B register to increment instead of reset (by changing the L to flip-flops and reconfiguring the paths). Also see the Harvard Architecture CPU which has its instructions separated from the data.
However, the main problem is in proving that the instruction set I provided are able to simulate every possible Turing Machine for it to be a CPU (which I don't believe it does). Note that its not that easy, since there are very simple machines which can be a UTM (http://en.wikipedia.org/wiki/Wolfram%27s_2-state_3-symbol_Turing_machine)
However, even if you don't buy the argument that the program is read from memory (and I agree this is hard to swallow, even for me) or that it can not emulate every possible Turing machine. I still stand by the fact that this is still useful in describing a CPU.
My thought is that your son and daughter will learn a lot from your device but are more likely to use their understanding of it to become Electrical Engineers with digital logic design skills (VHDL/Verilog on FPGA/ASICs) than Computer Scientists slinging C or assembly code ;-)
Your implementation of a binary mechanical clock is wonderful.
In the mean time you can enjoy my 6 year old son trying to explain how to read the clock: http://www.youtube.com/watch?v=iFKargQxN8k
Brilliant idea, very very nice execution.
Thanks for the detailed instructable!
Also it is a super clear i'ble.
Congrats. This is definately a 5 star project.
I wil
definately definatly definantly definetly definently defiantlydefinitely remeber it.Damn good job on a crazy idea! :)
Stunning!!
I'd take my hat off if I'd wear one ;)
it is to eqpencife for me to order the parts
and i cant never afourd a laser cutter
:(