Mr. Selznick was inspired, in large part, by the machine at the Franklin Institute. While working on the book he learned that Georges Méliès, the early French filmmaker who is central to the story, had a collection of automatons that was eventually thrown out. Mr. Selznick knew little about the machines. An Internet search turned up references to the Franklin Institute’s automaton.

“When I called, that’s when I was informed it had broken many years earlier,” he said in an interview. “And that it was in the basement and out of view.”

When Mr. Selznick visited, the Maillardet automaton’s head was off, and it could not actually write or draw. But Mr. Penniman was able to wind it up and show him how things moved, and how all the gears and cams worked. “It feels like Charles has this very personal friendship with the automaton,” Mr. Selznick said.

Mr. Selznick was also instrumental in getting the machine repaired, by Andrew Baron, a designer of pop-up books and restorer of vintage mechanisms in Santa Fe, N.M.

Photo

Mr. Baron came to the museum for several weeks in 2007 and set to work, with the aid of photographs Mr. Penniman had taken. “On one photo, Charlie had written, ‘Possible shoulder impingement,’ ” he recalled. “I operated it for the first time and it jammed up — and it was the shoulder.”

He took apart some elements of the mechanism, had a crucial replacement part produced by the museum’s machinist, and oiled and adjusted the rest. The automaton, which sits, unclothed, in a glass display case as part of the museum’s permanent “Amazing Machine” exhibition, is now in working order, although it is demonstrated only rarely.

Advertisement Continue reading the main story

When it is operated, Mr. Penniman and museum staff treat it with kid gloves, using a block of aluminum to delicately set the hand and its pen (the original writing instrument is unknown; it was lost long ago) in the proper position over a small piece of paper. Once wound up and turned on, the machine whirs into action, producing a drawing or poem in about three minutes. Each requires multiple cams, and trouble can arise when the machine has to move the whole stack, by only an eighth of an inch, to shift cams. If all goes exceedingly well, it will automatically begin another drawing or poem shortly after finishing the first.

Automatons of this type were exhibited by makers of fine watches as advertising and public relations tools to build exposure to their wares, said Jeremie Ryder, conservator of the Murtogh D. Guinness Collection of automatons and mechanical musical instruments at the Morris Museum in Morristown, N.J. Early-19th-century audiences would have been astonished by the lifelike movements.

No one knows exactly how they were made — trade secrets were common at the time — but the precision of the work is remarkable. “The pieces that date from that period were the pinnacle of complexity,” Mr. Ryder said. “There was an extreme amount of hand labor that went into them.”

Photo

“It’s hard to get a very lifelike, fluid motion of a simple arm movement or hand movement without becoming jerky,” he added. “Here they were doing it just brilliantly.”

Mr. Penniman said he first understood how extraordinary the machine was when he studied the movements encoded by the cams. “I said, ‘Oh, I did geometry — x, y and z axis,’ ” he recalled. But then he realized that it was not so simple: If Maillardet wanted the automaton to draw a straight diagonal line, for instance, he had to encode the cams to move the arm back while it was moving side to side — otherwise it would draw an arc.

“How do you think that through?” Mr. Penniman said. “Yes, you’re a clockmaker, and yes, you’ve had that experience. But this is a lot more complicated.”

Newsletter Sign Up Continue reading the main story Please verify you're not a robot by clicking the box. Invalid email address. Please re-enter. You must select a newsletter to subscribe to. Sign Up You will receive emails containing news content , updates and promotions from The New York Times. You may opt-out at any time. You agree to receive occasional updates and special offers for The New York Times's products and services. Thank you for subscribing. An error has occurred. Please try again later. View all New York Times newsletters.

Even more remarkable for Mr. Baron, the restorer in New Mexico, were the movements of the head and eyes, which are controlled by a couple of simpler cams.

“Maillardet could have had the head in a fixed position, the eyes in a fixed position,” he said. Instead, when the automaton stops writing briefly as the cam stack shifts, the head comes up and the eyes turn up and gaze out for a few seconds, and then lower as the hand begins moving again.

“In this moment, he appears to his audience as if he’s thinking about what is going to do next,” Mr. Baron went on. “It’s performance art.”

Maillardet “created an illusion of life,” he said. “That, to me, is the real magic.”