Legos are not just for kids' toys: an engineer at Apple has proven they can be used for a technological history lesson.

Andrew Carol, an engineer at Apple, recently used his spare time to build the Antikythera Mechanism out of Lego bricks. The Antikythera Mechanism is an Ancient Greek mechanical computer used to calculate astronomical positions. It is his second major lego project after building a Babbage Difference Engine, the 19th century automatic, mechanical calculator used to tabulate polynomial functions.

I've spent about 5-6 years on this kind of thing, Carol said. The original inspiration was in the early 1990s, Scientific America had a Babbage engine that they built for a science museum. I thought it would be amazing if you do that in Legos. About five years ago, I thought I could do it. I made the first engine and then sat on it a while. I then recently went back made it more streamlined and faster.

He said it took him five months to work on the first one, using up his free time to get it done. Carol used a modular technique, creating one difference engine and duplicating it three times. The machine was able to calculate second order differential equations to three digits. He also said it was impossible to draw up instructions for people that wanted to build one on their own -- the process was too complicated.

The second generation took a similar amount of time but using fewer parts Carol found it was easier to construct. It also calculated to third order differences to four-digit accuracy. The third generation, the latest one, he said is five times faster than the second generation.

While Carol was working on the second generation of the difference engine, an editor at Nature magazine emailed him and asked if making a Lego version of the Antikythera Mechanism would be possible. While Carol said he had heard about the ancient device before, he had no idea how complex and sophisticated it was. Still, he went to work and found it easier to construct than the difference engine.

The main issue with this one was coming up with gear ratios, which is an easier problem to solve than what I had to deal with the difference engine. That was fundamentally analog, figuring out how to increase engine smoothness and efficiency. The Antikythera Mechanism was much more straightforward, Carol said.

Carol said he gained an appreciation for the Greeks while working on the Antikythera Mechanism, adding it stands alone for its sophistication and quality for the period in which it was created. The device is able to calculate 18 years, or 223 lunar months, of solar eclipses. He even created labels for the Lego Antikythera Mechanism, which indicated when eclipses would happen.

The Babylonians and Egyptians figured out timing, they figured out an 18 year cycle. The genius of the Greeks is they made a mechanical device. Think about this: there was no other device that was a complicated as this until the 1300s. They made this in 100 B.C., and for 1,400 years there wasn't something as sophisticated as this machine, Carol said.

As for why he likes to use legos to create some of these complex machines, Carol said the toys are readily available and easier to use than metal, which requires bending. There is also a certain degree of nostalgia attached. Plus, it allows him to show his appreciation for the mechanical side of computing.

I like the mechanical side over electronics. An eighth grader can write a tic-tac-toe code for a computer. It's not really that cool. Mechanically you can do a lot of cool things. I don't think there's an appreciation for what the Ancient Greeks could do mechanically, Carol said.

Tic-tac-toe will actually be the subject of his next lego project. He is looking to create a Lego version of a tic-tac-toe board, where the machine makes an automatic response to a player's move.