Like its twin that's busy exploring Mars aboard the rover Curiosity, the device known as SAM II spends its days as if it were 200 million miles away, in a very different environment than our own.

Temperatures around the instrument plunge to minus 130ºF (-90°C), the air pressure is one percent of Earth's, and the atmosphere it sits in consists largely of carbon dioxide.

But this second SAM—short for Sample Analysis on Mars—resides in suburban Maryland, inside a tightly controlled chamber where it plays a little-known but essential role as a test instrument for the Curiosity mission to Mars. (Watch: How Curiosity took a self-portrait.)

And for a short time last month, this microwave-size "test bed" SAM was out of its deep freeze for repairs and upgrades, offering a rare peak into exactly what it takes to keep a rover and its scientific instruments alive and well on Mars.

Simply put, SAM is the most complex and sophisticated suite of scientific equipment to ever land on another celestial body.

The gold-covered box holds two tiny cylinder ovens that can vaporize Mars's rocks and soil at temperatures up to 1800°F (1,000 °C). Three instruments (spectrometers) then identify and analyze the gases produced by the ovens, as well as those collected from the Martian atmosphere. Some six miles (nine kilometers) of electrical wire connect these and many other parts together.

SAM's task constitutes a primary aim of Curiosity's mission: investigating whether Mars preserves the chemical ingredients needed for life, including organic carbon. (Related: Intriguing new evidence of a watery past on Mars.)

SAM has already analyzed some Martian soil and will very soon get its first taste of Martian rock, dug out with a drill last week and crushed into powder. A pre-programmed examination of that rock powder—a first-of-its-kind procedure—is scheduled to begin inside SAM shortly. (Related: Curiosity completes first full drill for Martian rock samples.

Maryland SAM in the Operating Room

But for the SAM on Mars to operate safely and properly, it needs the Maryland SAM (a 99 percent duplicate) as a test bed.

Every command sent to the instrument on Mars must first be run through the twin on Earth to make sure it doesn't confuse the operating system, doesn't open a wrong valve, doesn't set into motion a fatal cascade of events. So keeping the test-bed SAM in near-perfect shape is essential to Curiosity's success.

Yet some parts or connections have failed in recent months, requiring less-than-ideal work-arounds. And when the SAM team recently devised additional ways to further improve their creation, they decided to bring it in for repairs.

Which is why test-bed SAM was out of its chamber last month, laid out on a gurney in a clean room at the NASA Goddard Space Flight Center in Greenbelt, Maryland.

Several days before, the liquid nitrogen piped into SAM II's chamber to keep it cold had been turned off. Myriad pipes and tubes going in were shut down. The near-vacuum pressure inside the chamber—which is the size of a washing machine and wrapped in aluminum foil—had been changed to Earth conditions.

The big chamber door (which would have exerted some 10,000 pounds, or about 4,500 kilograms, of force) was swung open.

SAM II's lustrous gold plating, needed to regulate temperatures and keep the instrument as clean as possible, had been removed, exposing the warren of intricately packed equipment and wiring inside.

In a Mylar-draped section of the room, two of the men who put both SAMs together were poking and prodding, vacuuming and tightening its insides. In their head-to-toe white cover-ups, they looked like surgeons in the OR.

One of them, Oren Sheinman, is a lead designer and builder of the two SAMs. His repair involved a heat pipe for the tunable laser spectrometer—an instrument Sheinman designed to sniff the Mars air for gases such as carbon-based methane, which could be a sign of past or present life.

Problems with SAM's heat pipe had made it difficult to ensure that the new computer instructions going up to Mars were accurate and effective, so Sheinman and colleague Bob Arvey had to find a work-around.

Speaking from behind the Mylar screen, Sheinman said that what they had created was actually similar to some spacecraft he had worked on. "Not in terms of guidance and propulsion," he said, "but in terms of system issues and sheer complexity."

"With SAM, the difficult part mechanically was packaging, because it isn't really an instrument, but an instrument suite," he said.

Discovery Requires Complexity

SAM was already the largest and heaviest instrument that Curiosity would carry, but it needed to be as small as possible to make room for Curiosity's other equipment.

Fortunately, the hardware Sheinman was working on sat near the outside of the SAM configuration; fixing a piece deeper inside would have required what he called an "excavation."

For Arvey, the primary repair job involved his specialty, the miles of wire. Because SAM has high-temperature wires to supply the ovens and low temperature wires for the instruments, all the wiring had to be crimped together rather than connected with welds.

One of those crimps, or "getters," had failed some time ago, and it too had to be replaced.

Arvey said he needed all of his 40-plus years of experience in wiring space-bound equipment (to Venus, Jupiter, Titan, and Mars) to lay out the electrical rigging of SAM.

"Everything we did in building SAM had to be made up new," he said.

It was SAM principal investigator Paul Mahaffy who decided to open up the chamber, and he says his rationale was more improvement than repair.

While the several malfunctioning parts were making life difficult, his primary goal was to better stabilize the test-bed SAM so the team could send up commands that would allow Mars SAM to make more sensitive measurements.

Curiosity is a "discovery-driven" mission, Mahaffy said, and that means demands placed on the faraway rover and its instruments are ever changing. The result is a constant process of tweaking, upgrading, and modifying as scientists and engineers learn about Mars and look to devise ways to follow new leads.

Everyone Needs a Test Bed

The Goddard test bed is hardly the only one used for Curiosity.

The home institutions of the principal investigator for all ten Curiosity instruments have their test beds, and their results have to be squared with the entire Curiosity system, headquartered at the Jet Propulsion Laboratory in Pasadena, California.

JPL has its "Mars yard," where duplicate Curiosity rovers are put through their paces—everything from climbing a steep incline to approaching and drilling a rock.

Using the drill, for instance, involves more than a hundred discrete commands, and they have been put through their paces at the yard in advance of Curiosity's first ever Mars drilling.

"It's kind of unexpected and occasionally funny, but the test beds tend to come up with more problems than the actual equipment on Mars," said Curiosity mission manager Michael Watkins.

Since the equipment and instruments are virtual duplicates, Watkins said it's not an issue of quality. Rather, problems arise because the equipment is made to operate under Mars atmospheric and gravity conditions, which are difficult to entirely reproduce on Earth.

The test equipment is also used far more frequently and aggressively than what's on the actual Curiosity.

The constant testing slows a mission down at times, and after six months on Mars the rover has traveled only about a quarter mile, or less than half a kilometer.

But it has been a productive trip. Since landing on Mars in early August, Curiosity has identified a once fast-flowing stream bed on the planet, found tantalizing but unconfirmed signs of organic materials, and has drilled into low-lying bedrock and found gray (rather than the usual Martian red) rock inside.

The rover's travels on Mars are officially set to continue until the summer of 2014, but if Curiosity and its instruments remain healthy, all involved expect it will operate for several years beyond that.

With that kind of time frame in mind, the SAM team recently arranged to have its busy test bed moved to a building that has a supply of liquid nitrogen just outside a back door.

Before that, researchers and technicians had to roll large, heavy canisters of the gas long distances into a different test room. Hardly ideal for a test bed that's likely to be busy for a long time to come.