The Binary Marble Adding Machine is a device that adds binary numbers mechanically. It uses wood instead of silicon, gravity instead of voltage, and marbles instead of current. We don’t need no stinkin’ CMOS!

The machine may be more cool than practical, but it certainly is educational. It illustrates basic principles of binary numbers, binary arithmetic, and binary logic. Let’s take a closer look.

(I’ll be writing this as if you have the machine in front of you, but you won’t; I think less than ten were made.)

## What the Machine Does

The marble adding machine adds 6-bit, positive binary integers; that is, numbers, when expressed in decimal form, are between 0 and 63 (of course adding zero is not interesting — there’s nothing to do). It takes a binary integer as input, adds it — using binary arithmetic — to the binary integer present in its memory, and then presents the resulting binary integer as output.

The machine can store a maximum sum of 63; that is, 2^{6} – 1. If you exceed this, the machine overflows, meaning it stores the sum modulo 64. For example, 57 + 12 = 5, and 63 + 1 = 0.

## Input/Output

To add two or more binary numbers, simply enter them into the machine one at a time. To enter a number, place marbles in the slots corresponding to the 1-bits; leave the slots corresponding to the 0-bits empty. For example, the number 1101, which is 13, would look like this:

The number 1101 is only 4 bits, but it is equivalent to 001101; leading zeros are implied. To avoid confusion, load marbles from right to left. You’ll be sure to get them in the correct slots that way.

Output is in the same form as the input: empty slots represent zeros, and slots with marbles represent ones.

### Working in Decimal

Although the machine adds binary numbers, it’s more likely you’ll want to add decimal numbers. This requires conversion between decimal and binary. Before you enter a number, you must convert it to binary. To read the result, you must convert it to decimal.

Practically speaking, you’ll find that you won’t convert directly to and from binary; you’ll convert to and from a sum of nonnegative powers of two. It’s easier for humans to work that way, especially when doing calculations mentally. By converting a number to a sum of powers of two, you’ll have converted it to binary indirectly. After all, binary integers are made up of a 1s place, a 2s place, a 4s place, an 8s place, etc. The machine is labeled as such to facilitate this form of conversion.

The powers of two present in a sum tell you where to place the marbles. For example, to enter the number 9, which equals 8 + 1, place a marble in the 8 and 1 slots. To enter the number 15, place marbles in the 8, 4, 2, and 1 slots. Any number between 1 and 63, if not already a power of two, can be converted to a sum of powers of two from this set: {1, 2, 4, 8, 16, 32}. *Each power of two can appear at most once.*

(There is a systematic way to convert a decimal number to a sum of powers of two, but that’s beyond the scope of this article. For small numbers, such as those handled by this machine, you should be able to get by on trial and error.)

To interpret the result presented by the machine, simply do the reverse — add the resulting powers of two to come up with the decimal answer.

### Example

If you want to add 13 to 44, perform the following steps:

- Push the result lever to set the machine’s memory to 0.
- Load 13 into the input tray and push the input lever to add it to 0 (13 = 8 + 4 + 1 = 1101).
- Load 44 into the input tray and push the input lever to add it to 13 (44 = 32 + 8 + 4 = 101100).
- Push the result lever to get the result of 57 (111001 = 32 + 16 + 8 + 1 = 57).
- Pull the result lever to clear the result from the output tray.

## Binary Logic

The key component of the logic of the machine is the rocker. The rocker serves both as one bit of memory and a carry mechanism for addition. Each rocker has two stable positions, rocked left and rocked right; rocked left represents 0, and rocked right represents 1. The six rockers give 2^{6}, or 64, states in total. These states correspond to the binary representations of the numbers 0 to 63.

For example:

When a marble falls on a rocker, the rocker toggles. If it’s rocked left before the marble lands on it, it rocks right; if it’s rocked right before the marble lands on it, it rocks left. In the latter case, the falling marble is channeled through a hole to the next rocker, where this process is repeated. The cascading of rockers continues until a left rocked rocker is reached (if there is none, that’s overflow, and the marble just falls out of the machine).

The action of the falling marbles on the rockers is the mechanical analog of binary addition. A falling marble represents a 1. When added to 0, the result is 1. When added to 1, the result is 0, with a carry of 1 to the next position. The carry propagates until a 0 bit is reached.

## Examples in the Video

Matthias goes through six examples in the video — here is my analysis of each (time stamps are noted in parentheses):

**1 + 1 + 1 + 1 = 4**(0:00-0:47).This shows how to use the machine to count; that is, by adding 1 repeatedly.

**5 + 6 + 7 = 18**(0:48-1:27).This is an example of adding three numbers.

**21 + 6 + 13 = 40**(1:28-1:55).This is another example of adding three numbers.

**31 + 1 = 32**(1:56-2:22).This shows a long cascade of marbles, which is easy to see in binary: 11111 + 1 = 100000. The added 1 carries all the way to the 6th place.

**31 + 31 = 62**(2:23-2:55).This shows what happens when you double a number — it shifts the entire number one bit to the left. In binary, you see that 11111 becomes 111110.

**63 + 1 = 0**(2:56-3:25).This demonstrates overflow, which in this case results in 0; 64 mod 64 = 0.

## Using the Machine to Subtract

You can use the machine to subtract if you represent binary numbers using complement notation; for example, two’s complement. Two’s complement encodes negative numbers as well as positive numbers, allocating the 64 binary values to the numbers -32 through 31. The numbers 0 through 31 keep their normal binary form, 0 through 11111. The numbers -32 to -1 are assigned the values 100000 through 111111, respectively.

In two’s complement, the negative of a number is computed by inverting its bits and adding 1 (all 6 bits must be inverted, including leading zeros). For example, to compute -31,

- Compute the binary representation of 31, which is 011111.
- Invert the bits, getting 100000.
- Add 1, getting 100001 = -31.

You can subtract *b* from *a* by adding the two’s complement of *b* to *a*. For example, 31 – 31 = 11111 + 100001 = 1000000. That’s 7 bits, but thanks to overflow, the machine gives the correct answer — 0.

## Comparison to a Digital Computer

The machine functions like an accumulator and a ripple-carry adder. An accumulator is a register inside a microprocessor that stores a value and is modified with arithmetic, and a ripple-carry adder is a collection of logic gates that add individual bits and propagates carries sequentially.

To add two numbers in an accumulator, you would write assembly-language code like this:

mov ax,0 ; set accumulator to 0 add ax,00001101b ; add 13 add ax,00101100b ; add 44 mov bx,ax ; store result (57)

Here are some other similarities and differences between the marble adding machine and a digital computer:

- The machine’s register size is much smaller — it has 6 bits instead of 32 or 64.
- The machine’s memory is non-volatile (retains its value without power), unlike a register inside a microprocessor.
- The logic of the machine is not based on logic gates (AND, OR, NOT, etc.) like a microprocessor. However, the logic is binary, based on the two states of each rocker.
- The machine, like a microprocessor, can subtract by adding two’s complement numbers.
- The user of the machine must convert between decimal and binary, unlike in a general purpose computer, where this can be done automatically.

## For More Information

Go to Matthias’ web page, “More on the Binary Marble Adding Machine”, for details on how the machine is constructed. He discusses details like how he keeps marbles from falling out, how two marbles can land on a rocker in quick succession and still toggle it correctly, etc.

There are only 10 types of people in the world,

Those that understand binary and those that don’t.

(oldie but a goodie)

….Love that machine; that dude has has has an excellent woodworkers webseite.

Cheers,

Steve

You provided a nice description. Your first sentence though may need more consideration.

a) The first patent for a marble powered ripple adder (3,006,082) was issued in 1961. It can be made from primative materials but the adder is hardly primative.

b) Saying a digital, binary, ripple adder is “analog” seems almost exactly wrong.

c) It is not accurate to say a simple ripple adder is a “computer.” Calling it an “adding machine” would be better.

Bob S.

Bob,

I agree it isn’t an analog computer. I really mean it’s an analog to an electrical circuit. But I still say it’s primitive — in the year 2009 at least! In any case, I changed the opening sentence from this

“Here’s a primitive analog computer, called the Binary Marble Adding Machine, that adds numbers mechanically.”

to this

“The Binary Marble Adding Machine is a device that adds binary numbers mechanically.”

Thanks for the comments and the pointer to the patent.

For as much website building as I do, I wish I understood binary language and programming so much better than I do.

This video was honestly one of the coolest things I have seen in a while. I seriously had a dumb grin on my face the whole time.

I want one of those…

Is it possible if you could post a video on the substraction process using this machine. I’m not really good with math visualization but hope could use this machine to help student have a good time studying math.

And if possible other mathematical function like multiplication and division…

@arthoz,

The only videos I know of are for addition. (I do not have access to one of these machines.)

The best I can offer is my introductory articles on binary addition, subtraction, multiplication, and division (see links at top of sidebar).