Margaret H. Hamilton: Apollo Computer Programmer

Presidential Medal of Freedom 2016 ceremony
President Barack Obama presents Apollo code developer Margaret Hamilton (at left) and "Apollo 13" actor Tom Hanks (right) with the Presidential Medal of Freedom on Nov. 22, 2016. (Image credit: The White House via collectSPACE.com)

Margaret H. Hamilton is a computer scientist who was instrumental to NASA's efforts to land humans on the moon in the 1960s and 1970s. For her work, she was honored with the Presidential Medal of Freedom in 2016.

Hamilton led the software engineering division at Massachusetts Institute of Technology's Instrumentation Laboratory. In that role, she took the lead on the software used to govern the flight dynamics of the Apollo spacecraft, which were used for six landing missions between 1969 and 1972.

"Hamilton contributed to concepts of asynchronous software, priority scheduling and priority displays, and human-in-the-loop decision capability, which set the foundation for modern, ultra-reliable software design and engineering," the citation for her medal read. [Related: Apollo Coder and 'Apollo 13' Actor Receive Presidential Medals of Freedom]

Early accomplishments

Hamilton has a diverse background, including an undergraduate degree in mathematics from Earlham College in Indiana, and postgraduate work in meteorology at MIT. Besides her work in Apollo, she was part of MIT Lincoln Laboratory's Semi-Automatic Ground Environment Air Defense System, or SAGE. According to MIT, this was the first air defense system for the country and helped to push forward digital computing in the 1950s and 1960s.

MIT's instrumentation lab received the contract for the Apollo guidance and control systems on Aug. 9, 1961, when the United States had accomplished only two spaceflights — both with just one crewmember on board, and both in suborbital space. The contract was awarded just weeks before then-President John F. Kennedy announced that he planned to have humans on the moon by the end of the decade. 

The guidance and control systems would apply to both the lunar module (which would land on the moon) and the command module (which would orbit the moon while the lunar module was on the surface, then house the astronauts on their journey home.) It was intended to guide the spacecraft once they had achieved Earth orbit. 

After only one crewed mission in Earth orbit — Apollo 7 in early 1968 — NASA elected to send Apollo 8's command module solo that December on an orbital mission to the moon, out of concerns that the Soviet Union would get there first. Apollo 9 tested out the lunar module and command module together in Earth orbit for the first time, and then the two spacecraft were tested again in lunar orbit for Apollo 10. 

The crowning mission, Apollo 11 in July 1969, saw Neil Armstrong and Buzz Aldrin descend all the way to the surface in the lunar module, safely return to the command module (piloted by Mike Collins) and make it home to Earth.

The 1201 and 1202 alarms

But a software incident almost derailed the landing, as Hamilton recalled in a 2009 interview with MIT. "Everything was going according to plan until something totally unexpected happened, just as the astronauts were in the process of landing on the moon," she recalled.

"All of a sudden, the normal mission sequences were interrupted by priority displays of 1201 and 1202 alarms, giving the astronauts a go/no-go decision (to land or not to land)," she added. "It quickly became clear that the software was not only informing everyone that there was a hardware-related problem, but that the software was compensating for it. With only minutes to spare, the decision was made to go for the landing."

While a decision was made in the moment to let the astronauts land, Hamilton pointed out that a fault analysis was done to see where the error was made. It turned out that the astronaut checklist, which governed the actions the crew had to do before landing, had the crew set the rendezvous radar hardware switch in the wrong position. This overloaded the central processing unit during the landing, but fortunately, the software recovered in the heated moments before Apollo 11 touched down.

"Every time the CPU approached overload, the software cleared out its entire queue of processes, restarted its functions; allowing only the highest priority ones to perform until the landing was completed," she said. With the error addressed, the lunar landings for Apollos 12, 14, 15, 16 and 17 were made possible. (Apollo 13 aborted before landing due to an explosion in the command module's service area.)

Computer scientist Margaret Hamilton poses for a series of photos with the Apollo guidance software she and her team developed at the MIT Instrumentation Laboratory. (Image credit: MIT Museum)

Hamilton's legacy

NASA was so impressed with the software used in Apollo that the basis of it was adapted for Skylab (the first U.S. space station), the space shuttle (which ran more than 100 successful missions in Earth orbit – and two fatal failures – between 1981 and 2011) and the first digital fly-by-wire systems in aircraft.

"Hamilton was honored by NASA in 2003, when she was presented a special award recognizing the value of her innovations in the Apollo software development," NASA wrote in 2016. "The award included the largest financial award that NASA had ever presented to any individual up to that point."

Hamilton later left MIT to start her own software company, but her name is still most recognized for her lunar landing accomplishments. Her name was clearly visible when the entire Apollo 11 source code was released on GitHub in 2016; according to MIT, the first full line of the software read, "SUBMITTED: MARGARET H. HAMILTON DATE: 28 MAR 69 / M.H.HAMILTON, COLOSSUS PROGRAMMING LEADER / APOLLO GUIDANCE AND NAVIGATION."

For Hamilton, although Apollo 11 was monumental, she relished the challenge of doing her job for it. "From my own perspective, the software experience itself (designing it, developing it, evolving it, watching it perform and learning from it for future systems) was at least as exciting as the events surrounding the mission," she said.

Join our Space Forums to keep talking space on the latest missions, night sky and more! And if you have a news tip, correction or comment, let us know at: community@space.com.

Elizabeth Howell
Staff Writer, Spaceflight

Elizabeth Howell (she/her), Ph.D., is a staff writer in the spaceflight channel since 2022 covering diversity, education and gaming as well. She was contributing writer for Space.com for 10 years before joining full-time. Elizabeth's reporting includes multiple exclusives with the White House and Office of the Vice-President of the United States, an exclusive conversation with aspiring space tourist (and NSYNC bassist) Lance Bass, speaking several times with the International Space Station, witnessing five human spaceflight launches on two continents, flying parabolic, working inside a spacesuit, and participating in a simulated Mars mission. Her latest book, "Why Am I Taller?", is co-written with astronaut Dave Williams. Elizabeth holds a Ph.D. and M.Sc. in Space Studies from the University of North Dakota, a Bachelor of Journalism from Canada's Carleton University and a Bachelor of History from Canada's Athabasca University. Elizabeth is also a post-secondary instructor in communications and science at several institutions since 2015; her experience includes developing and teaching an astronomy course at Canada's Algonquin College (with Indigenous content as well) to more than 1,000 students since 2020. Elizabeth first got interested in space after watching the movie Apollo 13 in 1996, and still wants to be an astronaut someday. Mastodon: https://qoto.org/@howellspace