HOME | CONTACT

Marble Computer

Overview

One day, when I was between jobs and had some free time, I decided to build a digital computer made of wood and operated by marbles. I thought it could be a cool toy on my desk. I have managed to built such a computer, which can add and subtract with 4 bits. This means that this computer can calculate values between 0-15 (or –8 to 7 if you want to support negative numbers).

The Design

A single bit
The simplest unit in a digital computer is a binary digit (bit). A bit can have the value of 0 or 1. In the marble computer, a bit is represented as a slide where if the left side is higher, the value is considered as one, and if the left side it lower, the value is zero. The slide has a hole in the middle with a nail going through it as an axis, and by rotating the slide from side to side the value of the bit is changed.

A flip-flop
A flip-flop is an element where a single bit value is toggled between one and zero by a marble. I found this design on Mathias Wandel’s marble machine page.
The top guides direct the marble to drop vertically exactly above the axis. The way the flip-flop works is that if the bit’s value is initially zero, the marble will hit the right side, will roll to the right, and with it’s weight will make the right side drop and the left side raise (and set the value to 1). If the initial value is one, the marble will slide to the left, causing the left side to drop, and set the value to zero.

The flip-flop can be extended to have 3 operations: set to zero, set to 1 and toggle. This option is not used in my computer.

Multiple bit values
A digital binary computer (which is the common computer architecture) uses several bits to represent numbers. 2 bits can be used to represent values 0-3:

• Zero is stored as 00
• One is stored as 01
• Two is stored as 10
• Three is stored as 11
With 4 bits of memory a computer can represent the values between zero (0000) and 15 (1111). Read more about binary arithmetic if you are not familiar with the subject. When writing binary numbers, we normally write them left to right, with the most significant bit on the left. In the marble computer, bits are stacked one on top of the other. The most significant bit is the on one the bottom. The example below shows how the binary value 100 (4 in decimal) is represented in the marble machine.

The algorithm for adding 1 to an existing number is this:

1. Start with the last (least significant) bit, which is the bit on top
2. Toggle the value of this bit (zero becomes one and one becomes zero)
3. If the value of the bit is now one, stop
4. If the value of the bit is zero, we have a carry. Go one bit back (down) and return to step 2.
To support additions, the marble coming from the flip-flop is allowed to fall all the way down if it comes from the right side, and is carried into the next bit if it comes from the left side.

The following schema shows the process of adding 1 to the binary value 101 (5 in decimal). Te result is 110 (6 in decimal).
 Start of operation Top bit flipped Carry rolled to next bit Carry toggles second bit No carry, marble drops

To compute the value of 3+4, set the initial configuration to 3 (0011) and let 4 marbles drop one by one from the top.

Subtracting
The algorithm for subtracting 1 from an existing number is this:

1. Start with the last (least significant) bit, which is the bit on top
2. Toggle the value of this bit (zero becomes one and one becomes zero)
3. If the value of the bit is now zero, stop
4. If the value of the bit is one, we have a borrow. Go one bit back (down) and return to step 2.
As you can see, the subtraction is very symmetric to the addition algorithm.

The following schema shows the process of subtracting 1 from the binary value 110 (6 in decimal). Te result is 101 (5 in decimal).
 Start of operation Top bit flipped Borrow rolled to next bit Borrow toggles second bit No borrow, marble drops

The operation selector
I wanted to enable both additions and subtractions using the same machine. To do this, I combined the adding side and the subtracting side on an operations selector bar than can be manually moved to perform either operation.
In the following schema, the operations controller is painted in green.
 Selector in addition mode (pushed left) Selector in subtract mode (pushed right)

Pushing the selector to the left will set the machine to add numbers, while pushing it to the left will set the machine to subtract.

In my machine I have 4 bits, with an operation selector for the topmost 3. All 3 selectors are connected to a single bar which is used to move all of them at once.

The actual computer in action

Once I get my hands on a good digital camera, I will post here images of the actual machine.

Ideas

The idea of a binary marble computer can be extended. I have a few things I would like to do whenever I get some time:
• Do some complex calculation, like multiplication, powers, or roots
• Build a machine that can receive a complex program as input. I though of using different sizes of marbles to define operation codes and operands.
• Make a nice display of the current value. This can be done by LEDs to give the computer an “electronic” look, or by some mechanical means.