Three months after John F. Kennedy's 1961 speech committing the country to "landing a man on the moon and returning him safely to the Earth," NASA awarded its first contract for the fledgling Apollo program. It wasn't for a spacecraft or launch facilities, but for a box - a computer that would guide the astronauts across the 250,000 miles to their objective. It was built at Raytheon facilities in Sudbury and Waltham.

Editor's note: Monday is the 40th anniversary of man walking on the moon. Today is the first of two parts about local connections to Apollo 11.

Three months after John F. Kennedy's 1961 speech committing the country to "landing a man on the moon and returning him safely to the Earth," NASA awarded its first contract for the fledgling Apollo program.

It wasn't for a spacecraft or launch facilities, but for a box - a computer that would guide the astronauts across the 250,000 miles to their objective. The Apollo guidance computer was designed at Charles Stark Draper's Instrumentation Laboratory at the Massachusetts Institute of Technology. It was built at Raytheon facilities in Sudbury and Waltham.

MetroWest companies and organizations played key roles in the Apollo program, from making sure spacecraft made it to the moon to feeding the astronauts and helping them communicate with Houston's Mission Control.

Today, in the first of two profiles, The Daily News looks at how MIT and Raytheon designed and built the guidance computer.

Raytheon was awarded the subcontract to build the guidance computer in 1963. The company had worked with the Instrumentation Laboratory to build guidance systems for an early Mars probe and the U.S. Navy's Polaris guided missile.

The Lab and Raytheon were eminently qualified to work on the lunar mission.

"But nobody really knew what they were doing, because no one had ever done anything like it before," said David Mindell, an MIT professor and author of "Digital Apollo: Human and Machine in Space Flight."

Early versions of the guidance computer were built at Raytheon's Boston Post Road facility in Sudbury. Later, production moved to Seyon Street in Waltham, where all of the computers that flew in Apollo spacecraft were built.

Two identical computers would fly on each lunar mission - one in the command module and one in the lunar module.

They were about the size of a suitcase and weighed 70 pounds each. Today, the Apple Mac Mini is about the size of a dictionary and weighs in at 3 pounds. And the difference in computing power is like comparing a Model T to a Porsche Carrera.

Apollo 12 astronaut Alan Bean, the fourth man to walk on the moon, bristles at comparisons of the Apollo computer to current models, though.

"It's mentioned to me frequently nowadays about how the (Apollo) computer doesn't have as much memory or capability as a watch does nowadays," he said, "but we never thought of it that way. We thought of it as the best that was available at the time. And so we were glad to have these computers."

Jack Poundstone, Raytheon's technical director for the project, agrees.

"At the time it was state of the art," the former Sudbury resident said. "We pioneered an awful lot of integrated circuit development, and pioneered things like non-erasable memory."

That non-erasable memory consisted of a series of wires woven into what was called a "core rope" built by "a bunch of little old ladies down in Waltham," Poundstone said.

Affectionally known as "LOLs," those women came from Waltham's textile mills and watch factory.

"There was a big watch industry in Waltham back in the '40s and '50s," Poundstone said. "When that kind of collapsed, electronics came along and a lot of the ladies that had been assembling watches came over into the electronics world."

Manufacturing the core ropes could be tedious. Two women sat on either side of a rack containing a number of small doughnut-shaped magnets. The women would pass the wire back and forth through holes indicated by a computer-controlled guide.

"Every bit had to be sewn with a needle and a thread-like wire through these little magnetic cores," said Mindell. "There were all these women sitting at these stations threading the needles, sewing the software bit, by bit, by bit, into the cores and they had to do it with 100 percent accuracy with thousands and thousands of different bits."

The Apollo guidance computer's software was actually hardware. Every time a wire went through one of the magnetic cores, it represented a "1" in binary code - the building block of computer language - and if it was guided around the core it was a "0."

The core rope accounted for 74 kilobytes of read-only memory that was programmed before each Apollo flight. The computer also had 4 KB of rewritable memory used for temporary programs and data.

Every flight's read-only programming was different. The program had to be finalized about two months before an Apollo launch.

"When the programmers finally figured out what they wanted to do for the mission, they would release a deck of (computer punch) cards that went to the machine in Waltham," Poundstone said. The women "had to work very fast. They would have to get this thing built in time to get it shipped down to (Cape Canaveral) and installed, checked out and be ready for the launch. Every mission went through this same kind of a crisis to get these core ropes built in time."

Each memory module was tested extensively by Raytheon before being delivered to NASA. Mary Lou Rogers, of Waltham, worked on a different part of the Apollo production line, but in a recent BBC interview, she recalled the testing process.

Each piece "had to be looked at by three or four people before it was stamped off. We had a group of inspectors come in from the federal government to check out work all the time," she said.

Occasionally an error would be found before it was "potted" in a heavy epoxy to avoid corrosion.

"There was some very limited ability to go in and change a bit here and a bit there," Mindell said.

But, if an error was found after the potting, Poundstone said it was not generally worth trying to fix it. "They just threw the whole thing away."

The Apollo guidance computer proved itself to be reliable and accurate. It never failed in flight and, during Apollo 11, only two small mid-course corrections were required on the three-day coast to the moon.

"The computers were wonderful," Bean said. "They worked perfectly on all the missions. We, every once in a while, would put in a wrong number or read it wrong or do something like that, but it didn't have any effect on any of the missions."

During the launch of Bean's Apollo 12 mission, the Saturn V rocket that propelled the spacecraft to the moon was struck twice by lightning, disrupting power to the computer.

"It was real scary," Bean said. "We had never practiced it. We had no thought in designing the spacecraft that this would ever occur. But it didn't seem to upset our computers."

When the astronauts reached Earth orbit they realigned their guidance platform and were able to continue with the mission, all thanks to the computer's core rope memory made by the little old ladies of Waltham.

When Apollo 12 was hit by lightning, "the software didn't disappear like it would on your PC," Mindell said. "It was still there. It survived that."

On Apollo 13, when an oxygen tank exploded in the service module mid-flight, the command module had to be shut down. When the computer was restarted in preparation for re-entry, it had survived three days of extreme cold and condensation with no ill effect.

As the moon landings ended in 1972, the computers continued to be used in the three Apollo spacecraft that visited the Skylab space station and one that took part in the Apollo-Soyuz Test Project.

Bob Zagrodnick, a former Apollo program manager who works at Raytheon in Sudbury, said the Apollo guidance computer changed the way people thought about computers.

"The technology was so new 40 years ago," he said, "it was at the forefront of everything. Graduate computer architecture classes were just beginning to be offered at universities. But the success of the Apollo 11 mission and of the AGC sparked a new movement in computer architecture."

As NASA prepares to return to the moon in 2018, Bean says the focus will be less on computers.

"Though it's going to have a better computer, I don't think it's going to be any easier going back, because the computer was never a problem, really, the problem was always the rocket engines and things like that," he said.

After Apollo, Raytheon went back to making Navy missiles, building guidance computers for the Poseidon and Trident. Said Poundstone, "basically, it was the same team of people who had worked the Navy programs that also worked the Apollo program."

Poundstone said he looks back on Raytheon's contribution to the moon landings with pride.

"(Apollo) was probably one of the best programs the government's ever had," he said. "The people involved had an awful lot of enthusiasm and dedication. Everybody, all the contractors, government people, MIT Instrumentation Lab people all worked very, very hard and long, long hours to make (the moon landings) a success."

(Part two of the series runs tomorrow)

(Paul Ring can be reached at 508-626-3821 or pring@cnc.com.)