# Watch an Apple Engineer Recreate a 2,000-Year-Old Computer Using Legos

## Here’s a brand new stop-motion video showing the device’s inner workings — and an interview with its creator, Andrew Carol.

Remember that old commercial about “Zack, the Lego maniac”? Well, Zack ain’t got nothing on Andrew Carol. When Carol’s not working on improving the finer points of OS X as a software engineer at Apple, he’s hard at work building analog computers — like the Babbage difference engine — entirely out of Legos.

Recently, Carol has completed his biggest challenge yet: a working Lego replica of the famous Antikythera Mechanism, created by ancient Greeks in 100 B.C. as a way of predicting astronomical events like eclipses. Though pictures of Carol’s device have surfaced before, few people have delved into how it functions. Working with Digital Science, I directed a short film about the device using stop-motion animation to explain how it works — and talked to Andy about his design process.

[A Small Mammal production for Digital Science]

Why did you choose the Antikythera Mechanism, and where did you start?

Andy Carol: It was an email out of the blue from Adam Rutherford at Nature.com that got me thinking about this. Over Christmas of 2009, I was already working on a Lego machine that plays tic-tac-toe mechanically. But Adam had seen my difference engine and contacted me, wondering if it would be plausible to build an Antikythera Mechanism out of Lego instead. That got me thinking it over and researching it. I had a crude prototype a week later, and a decent prototype two or three weeks after that. My proof of concept was just these little boxes of Lego gears I built all in a row. One box did one bit of math with an axle that ran to the next box. It just went from box to box in a straight line and proved that it was plausible.

Turning the yellow crank adjusts dials that predict solar and lunar eclipses.

The original Mechanism and your model use physical gears to perform mathematical calculations. How does that work?

It’s pretty simple; it’s all about ratios between the numbers of teeth on two gears meshed together. If one gear has 50 teeth and another has 25, that’s a 2-to-1 ratio — which means that turning the axle one full revolution on the first gear will multiply by two, because it turns the second gear twice as fast.

But the tradeoff is that when you make it go fast, you lose power. It’s fast, but it’s not strong, and vice versa — and those mechanical effects pile up quickly when you’ve got over 100 gears working together in exotic ratios. When I have to multiply by 127, it’s got to turn very fast, but with little power, which means that whatever amount of friction there is, I’ve effectively multiplied it by 127. So I had to put a lot of thought into designing the optimal layout of gears that would minimize the friction enough to make that kind of calculation physically work.

An X-ray image of the original Antikythera Mechanism reveals a large gear.

The original Mechanism was made out of metal, but you had to work with plastic toys. How did that affect your design?

Regular Lego bricks are problematic because they constantly want to pop apart, so I had to use cross-bracing to keep everything rigid enough to withstand all the mechanical force. And unlike my previous machines which were made from classic bricks, the new machine is purely made from Lego Technic pieces because the gearing is so complicated.

I also designed it using a modular system with racks of gears that I could remove or pop back in easily. For example, I made one module that does nothing but divide by 19. It makes the design problem smaller: all I have to do is focus on getting each module right, then figure out the next one. The hardest part was physically linking the output of one module to the input of the next; sometimes the output of one bit was physically far away from the input of the next one. But modularity really was the secret to making it all work.

The yellow differential in this module combines inputs from other gears to multiply by 5 and divide by 19.

The original Mechanism was also quite a bit smaller than your version, and used about half as many gears. Why did yours end up being bigger and more complicated?

The Greek guy who made the original could cut his own metal gears to the exact ratios he needed, so he only needed 50 or 60 gears total and could fit them together very compactly. But I have to use the gears and ratios that Lego happens to make. That’s why I might need eight gears to accomplish a bit of math that the original machine accomplished with two.

My machine uses about 110 gears, and 7 complete differentials, to do most of what the original one did. But their calendar and ours are completely incompatible, so I also had to add complexity to make the eclipse predictions understandable. My machine has two extra indicators: one for the decade and one for the year. That way, as you turn the crank on the machine, you can read the dials and say “OK, a solar eclipse will happen in April of 2024.”

Carol wrote custom software to generate calendar dials accurate down to the year, date, and time of day.

Is it really accurate to call the Mechanism a “computer”?

Yes, but in a slightly different way than we’re used to using that word. It’s an analog computer, which means it can’t execute programs. But the word “computer” used to be the name given to people who could do tedious math. In the 19th century there were rooms of people called “computers” who were skilled at arithmetic, supervised by a mathematician, who would create tables at great expense that navigators and sailors would use. But when we finally had mechanical devices that could do similar things, they got that name: computer.

But analog computers were still very useful up through the 1940s. World War II battleships would have a mechanical computer in their artillery, so that when you wanted to fire, you’d turn cranks to figure out how many times is this gun to be fired, how far is the other ship, what’s the wind velocity, that sort of thing. And when you turned all the cranks, the gear ratios would tell you how to adjust your aim. So the Antikythera Mechanism, and my Lego version, are both just simple mechanical computers: you turn the crank at one speed and all the wheels move at a another speed, which you’ve calibrated to have a particular meaning — in this case, predicting the cycles of astronomical bodies.

These four modules form the left side of the machine, which calculates the positions of the sun and moon in a 223-month eclipse cycle.

So you’re saying the ancient Greeks had technology equivalent to what we were using in 20th-century battleships?

We don’t give people credit for how smart they were 2000 years ago. There were other mechanical devices as well, that we know about because they’ve been referenced in ancient books. They even had machines to dispense holy water in temples: you’d put a coin in a box and it would move a series of levers to dole out an amount of water to you, just like a vending machine. Kings would commission mechanical novelties because it was considered amazing and clever. But the Antikythera Mechanism is singular because no one is aware of anything else that complicated. To have actually found it, versus just reading about it — you don’t know if those ancient accounts are exaggerated — that’s what’s amazing. It took us 100 years just to analyze how it worked, but over time we’ve found that it’s more and more sophisticated. And we don’t know there were 20 of these things, or if this was the only one.