A very early computer, quite unlike any other, is discreetly hanging in the sacristy of a small chapel in the heart of Turin, the beautiful Italian city at the foot of the Alps. Thousands of people pass by every day along Via Garibaldi, one of the main shopping thoroughfares in town, but hardly anyone knows it is there. That is because the tiny baroque jewel that owns the artifact is hidden in plain sight, and the church only opens on Saturday afternoons and Sunday mornings for mass. Still, anyone in-the-know or curious enough to find it will be awestruck by the Perpetual Calendar of Giovanni Antonio Amedeo Plana.

Built by the astronomer and mathematician in 1831, the Perpetual Calendar took 10 years to complete, from planning to assembly. The device, which resides in the Chapel of Bankers and Merchants, operates via a simple wooden crank under the adorned golden frame, a crank that hides a stunningly accurate universal mechanical calculator spanning the years 1 to 4,000. Want to know the day of the week that the Western Roman Empire fell to the barbarians, on September 4, 476? The calendar will tell you that it was a Monday. Or maybe the phase of the moon on the day you were born? Or the date of Easter a thousand years from now (April 18, 3019)? All of this information can be accessed by a pre-internet machine made of fragile wood and paper, and communicated through 46,000 little numbers carefully arranged around nine cylinders. Each of these is linked to a central one—the only adjustable part of the device—where the user can input the year. That cylinder synchronously regulates all the others through gears and chains.

The Perpetual Calendar features windows that show key dates and moon phases for 4,000 years.
The Perpetual Calendar features windows that show key dates and moon phases for 4,000 years. Eccekevin/Wikimedia/CC-BY-4.0

The display of the calendar actually looks like a painting, though a visually dense one, and it includes a range of fixed information: a chronology of popes, from St. Peter to Gregory XVI (the pontiff of Plana’s time); portraits of Julius Caesar and of Pope Gregory XIII (progenitors of the two main Western calendar systems); and depictions of Leopold II, Grand Duke of Tuscany, and King Charles Albert of Sardinia, two Italian sovereigns who were supporters of science in the 1830s. As for the mechanism, its results appear in windows running down the center of the device. They indicate lunar and solar cycles, moveable Catholic holidays, days of the week and of saints for the year in question.

According to Giovanni Demichelis, a longtime member of the congregation of the Chapel of Bankers and Merchants, “This is the first calculation system run by fixed-program set of codes ever constructed.” (That’s not entirely certain, but it’s definitely early and anomalous.) Demichelis became an appassionato about Plana’s machine some 20 years ago, when a group of Japanese researchers from the Tokyo Polytechnic University came to Turin in order to have a look at how the calendar works.

The rolls inside the calendar (left) are operated by a wooden crank at the bottom (right), which is used to set the year.
The rolls inside the calendar (left) are operated by a wooden crank at the bottom (right), which is used to set the year. Ranna Utida

“They spent a whole morning here studying it and then offered to buy it for their museum of electronic machines, because the concept with which this was built is exactly the same as the one behind the first electronic calculator made after World War II,” he says. The chapel did not sell. Demichelis recalls that one members of the Japanese team asked if the calendar does indeed date to the 1830s. Upon confirmation of that, the visitors simply bowed in its direction.

Details of how the device actually works were more or less a secret until very recently. Plana, for all his assiduousness, did not leave any written material describing the mechanism inside. So in 2015 the prestigious Polytechnic University of Turin challenged its students to parse the algorithm that governs the machine. Four teams responded to the call. “This challenge has shown itself a useful way of valorizing the territory, proposing the use of engineering disciplines to improve the fruition of cultural goods,” the university’s vice dean of research, Enrico Macii, said in a statement at the time.

The Chapel of Bankers and Merchants in Turin.
The Chapel of Bankers and Merchants in Turin. Eccekevin/Wikimedia/CC-BY-4.0

The winning team of three students—Meysam Nasiri, Roberto Cappato, and Sergio Spano—spent months unraveling the device’s mysteries. “They came here a few times mainly to take pictures and do experimentations,” says Demichelis. “After photographing all the calendar’s columns, they have done their research and found the algorithm.”

“To decode the mechanism, to perceive by intuition the functioning, almost without being able to touch it, because of its fragility,” Nasiri described the process to local newspaper Corriere della Sera, “going down a path of reverse engineering to go back to the origins, to the logic of that time, to the secrets.” Nasiri, originally from Iran, wrote his thesis on the industrial design of the calendar. As part of their project, the three students built a smaller replica of the Perpetual Calendar with modern materials, which now resides alongside the original, as well as a digital version.

Giovanni Demichelis, a member of the congregation of the Chapel of Bankers and Merchants and a self-taught expert on the Perpetual Calendar.
Giovanni Demichelis, a member of the congregation of the Chapel of Bankers and Merchants and a self-taught expert on the Perpetual Calendar. Ranna Utida

They were astounded by the precision of the original. It accounted for the 10 days (of October 1582) obliterated by the conversion from the Julian to the Gregorian calendar (with blank spaces), accounts for leap days (every four years, except for years divisible by 100 and not 400), and tracks the phases of the moon and feast days through all of it. Notably, the calendar stops at the year 4,000. Some think Plana simply got tired of performing calculations, but Demichelis has a different theory.

Around that time in the future, our slightly inaccurate way for accounting for the true length of a year (leap years) will catch up with us—and the calendar will be off by a full day. Demichelis guesses Plana had surmised this and decided to halt the calendar there to maintain its accuracy, just in case. “If true,” he says, “it shows even better the greatness of this scientist.”

The entrance, organ, and hall of the chapel.
The entrance, organ, and hall of the chapel. Ranna Utida

Plana was no shy, solitary researcher. From the Piedmont, he was educated at the École Polytechnique in France. He was the head of astronomy at the University of Turin and director of the local observatory. In 1832 he published a book in French, Théorie du mouvement de la lune, in which he describes his formula to calculate the position and cycles of the moon—any day, any year. Plana was famous and received many honors and awards for these contributions (maybe the greatest being the lunar crater later named for him), which impacted religion, for addressing moveable holidays tied to lunar and solar cycles; agriculture, for tracking planting and harvests; and navigation, for calculation of longitude and anticipation of tides. Naturally, commerce, war, and politics were influenced by all of these. The English Royal Navy, the most powerful in the world at the time, asked Plana for a fresh lunar chart every new year. His device, certainly, cut down on calculation time.

“I think his wife might have said to him, ‘You spend all night at the observatory and all day making calculations,” Demichelis guesses, laughing. “Do something out of it.” As to how the device ended up in the Chapel of Bankers and Merchants, it is believed that a relative may have donated it upon becoming a member of the congregation around 1845 or 1850. Demichelis says that at the time, people thought the device an intriguing mechanical curiosity, rather than a landmark in the history of a technology that would change the world. Now we know better.