
Marble adding machine: www.youtube.com/watch?v=GcDshWmhF4A
DigicompII: http://digi-compii.com/
Ball Logic: http://brain.wireos.com/?p=2207

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

Reading the time (http://www.youtube.com/watch?v=iFKargQxN8k):


flip-flop 1 pointing left == 1
flip-flop 2 pointing left == 1
flip-flop 3 pointing left == 1
flip-flop 4 pointing right == 0






    0000 is 0 but its 12 in the clock case
    0001 is 1
    0010 is 2
    0011 is 3
    0100 is 4
    0101 is 5
    0110 is 6
    0111 is 7
    1000 is 8
    1001 is 9
    1010 is 10
    1011 is 11






Step 1: CPU instructions

For a CPU to do any meaningful work, it needs to be told what to do. This comes in the form of instructions. For this wall clock I will only concentrate on the hours to make things simple. That is, we will increment a variable named Hours and check to see if its equal to 11 (we will use 0 base indexing for the hours, so 12 is represented as a 0). If the check is true, then we will reset the variable back to 0.  We do not want to code the above statement directly into the CPU, since we want it to be general purpose CPU (otherwise we are just making a clock). Therefore, we will implement a basic instruction set and write the clock code around these primitive instructions (the set of instructions to execute are known as an assembly language). Lastly, we will keep the hour variable in a Register, which is a term given for a special memory component used to hold data and operate on it.  We will also use a simple 1 unit (1 bit) memory address to act as a flag for the control unit, and name it DTD for personal reasons (stands for dedicated to Dani. A long personal story). Note that this CPU will be programed with the clock instructions, but it could be programed with any other code to do a number of other things.

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).

2: JUMP 5
4: JUMP 1
6: EQUAL 11
7: JUMP 1
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.
<p>Neat! Very creative.</p><p>I want to make one :)</p>
What did you use to control the timing and the sweep arm? An existing clock mechanism? Microcontroller? <br> <br>Thanks
I used a 1RPH motor (I got mine here http://www.herbach.com/Merchant2/merchant.mv?Screen=PROD&amp;Store_Code=HAR&amp;Product_Code=H1-33&amp;Category_Code=SYNCTIME).
Just plain neat I like it. Looks like fun. <br>Joe
First of all, nice job in implementing this device and showing how it works. Also, congrats on getting the &quot;pass&quot; to buy your laser cutter. ;-) <br> <br>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. <br> <br>Your machine includes a set of flip flops representing the &quot;current state&quot;. Every time a ball is dropped, the flip flops decide what the &quot;next state&quot; will be based on the &quot;current state&quot; of the machine. <br> <br>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. <br> <br>Here is a write up on the differences I found with a quick Google: <br>http://www.cs.utah.edu/~rajeev/cs3810/slides/3810-14.pdf <br> <br>
Thanks for you comment. <br>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. <br> <br>This clock can be shown to be a Turing Machine, and thus a computer (see fixed-program computers), however, where is its program memory? <br>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. <br> <br>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) <br> <br>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. <br>
I think you have handled the religious discussion on what a CPU is quite well. You are not trying to model a Von Neumann computer (http://en.wikipedia.org/wiki/Von_Neumann_architecture) that so many of us are used to. <br> <br>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 ;-) <br> <br>Your implementation of a binary mechanical clock is wonderful.
Either my kids will end up in EE/CS or they will need years of therapy because dad insisted this clock is a computer, but they could never access facebook with it. <br> <br>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
Very c lever and well implemented. Bravo, sir!
Incredible! <br>Brilliant idea, very very nice execution. <br>Thanks for the detailed instructable!
This is a really great idea and build! <br> <br>Also it is a super clear i'ble. <br> <br>Congrats. This is definately a 5 star project.
Thanks. But remember that English isn't my mother tongue. It is only my 3th language (of the four that I read, write and speak if you don't count Latin and ancient Greek) and I do make a mistake from time to time. A lot of people aren't even able to write theire own mother tongue properly!<br> <br><br> <br>I wil <strike>definately definatly definantly definetly definently defiantly </strike>definitely remeber it.
what laser cutter did you buy?
Look on my website. www.liorelazary.com. I wrote a whole article of how I imported the laser cutter from china.
This is brilliant. I am humbled and blown away. Not only for what this device does, but more so for helping me understand what a CPU does. You: &quot;One of the motivations for this project was to get people to understand how a CPU (the heart of a computer) works&quot; - done, beautifully, unexpectedly; thank you.
Just fabulous! People like you make people like me teach my kids that the evil professor in Cartoon Networks is somewhere out there in the real world! <br>Damn good job on a crazy idea! :) <br>
Awesome work! Love the idea of the 2nd track!
Completely mad! And utter genius! I salute you sir!
It's a must for geeks. :) respect.
I have total admiration for the depth and persistence of geekery that can produce something like this. <br>Stunning!!
Frankly, I have no freakin' idea what you are talking about, but I have to say, even if I don't understand a bit, I think it's the best Instructable AND project I've seen in a while. <br> <br>I'd take my hat off if I'd wear one ;) <br> <br>
Reminds me of the joke we use around here - &quot;freaking smart guy, no context though; ask him the time, he'll explain how to build a clock&quot;
Absolutely beautiful! Kind regards, tamberg
A 5 million cubic meters graphing calculator: http://www.youtube.com/watch?v=wgJfVRhotlQ
This is fantastic!
I am blown away. I can not begin imagine how one can come up with something like this
very cool
Hats off, sir!
Simply genious !!!

About This Instructable




More by lelazary:Mechanical CPU Clock 
Add instructable to: