The Moon Landing
Orbital Mechanics & Software Engineering

The Moon Landing

Orbital mechanics, software engineering, and the computer that saved Apollo 11.

Orbital Mechanics & Software Engineering12-Month Curriculum 14h

The Story

Three Minutes to Landing

On July 20, 1969, at 4:06 PM Eastern Time, the Apollo 11 Lunar Module — call sign Eagle — was three minutes from the surface of the Moon. Astronauts Neil Armstrong and Buzz Aldrin were inside. Michael Collins orbited above in the Command Module, alone.

And then the computer started screaming.

The Apollo Guidance Computer — a machine with 74 kilobytes of memory and a processor that ran at 0.043 megahertz (your smartphone is about 100,000 times more powerful) — flashed a 1202 alarm. Then a 1201 alarm. The numbers meant the same thing: executive overflow. The computer had more tasks than it could handle.

In Mission Control in Houston, a 26-year-old engineer named Steve Bales had fifteen seconds to make a call. Abort the landing and fly back to orbit — safe but a failure? Or continue the descent and trust the computer?

Bales knew something about that computer. He knew that its software had been designed by a team led by Margaret Hamilton, a 33-year-old mathematician at the MIT Instrumentation Laboratory. And he knew that Hamilton had built the software with a feature that was revolutionary for 1969: priority scheduling.

The computer wasn't crashing. It was triaging. When the 1202 alarm fired, the software automatically dropped its lowest-priority tasks — rendezvous radar calculations that weren't needed during landing — and kept running the highest-priority ones: navigation, throttle control, and altitude measurement. The computer was telling the crew: I'm overloaded, but I'm handling it.

"We're GO on that alarm," Bales said.

The descent continued.

Getting There

The journey from Earth to Moon took three days. But the trajectory was not a straight line — it was a precisely calculated curve called a Hohmann transfer orbit.

A Hohmann transfer is the most fuel-efficient way to move between two orbits. Instead of pointing your rocket at the Moon and firing (which would require an enormous amount of fuel), you fire your engine briefly to enter an elliptical orbit whose far point just touches the Moon's orbit. You coast for three days, using no fuel at all. When you arrive at the Moon, you fire again briefly to slow down and enter lunar orbit.

The mathematics was worked out by Walter Hohmann in 1925 — decades before spaceflight was possible. The key equation is the Tsiolkovsky rocket equation:

Δv = ve × ln(m0 / mf)

Where Δv is the change in velocity you need, ve is the exhaust velocity of your rocket engine, m0 is your initial mass (with fuel), and mf is your final mass (without fuel). This equation explains why rockets are mostly fuel: the Saturn V rocket that launched Apollo 11 weighed 2,970 tonnes at liftoff. The spacecraft that reached the Moon weighed 45 tonnes. More than 98% of the launch weight was fuel.

The Computer

The Apollo Guidance Computer (AGC) was the first computer designed for a real-time, life-critical mission. It had to navigate, control the spacecraft's attitude, manage the engine burns, and display information to the crew — all simultaneously, with less computing power than a modern calculator.

Margaret Hamilton's team wrote the software in assembly language — the lowest-level programming language, where every instruction corresponds to a single operation of the processor. The entire program was 145,000 lines of code, hand-woven into rope memory — a physical memory system where copper wires were threaded through or around magnetic cores. A wire through a core was a 1; a wire around it was a 0. Once woven, the memory couldn't be changed.

The priority scheduling system that saved the landing worked like this: every task in the computer was assigned a priority level. When the processor was overloaded, it would interrupt the lowest-priority task, save its state, and run the highest-priority task instead. When the high-priority task finished, it would resume the interrupted task where it left off.

This technique — now called preemptive multitasking — is the foundation of every modern operating system. Every time your phone runs multiple apps simultaneously, it's using the same principle that Margaret Hamilton invented for Apollo.

The Landing

At 4:14 PM, with 25 seconds of fuel remaining, Neil Armstrong saw that the computer was guiding them toward a boulder field. He took manual control, flew the Lunar Module sideways — burning precious fuel — and set it down in a clear area.

"Houston, Tranquility Base here. The Eagle has landed."

In Mission Control, Charlie Duke replied: "Roger, Tranquility, we copy you on the ground. You got a bunch of guys about to turn blue. We're breathing again."

Six hours later, Armstrong climbed down the ladder, placed his left foot on the lunar surface, and said the most famous sentence in the history of exploration.

Four hundred thousand engineers had made this moment possible. Rocket scientists who calculated trajectories. Metallurgists who forged the heat shield. Seamstresses who sewed spacesuits by hand. And a team of software engineers, led by a woman who invented a new way to write code, whose program worked exactly as designed at the most critical moment in the history of computing.

The Numbers

The Apollo program, from 1961 to 1972, cost $25.4 billion (about $200 billion in today's money). It employed 400,000 people. It produced twelve astronauts who walked on the Moon and brought back 382 kilograms of lunar rock and soil.

But its greatest legacy wasn't on the Moon. It was on Earth. The integrated circuit, the fuel cell, freeze-dried food, water purification systems, fireproof materials, and the concept of software engineering itself — all either invented for or advanced by the Apollo program.

Margaret Hamilton later coined the term "software engineering" — arguing that writing code for critical systems deserved the same rigor and respect as any other branch of engineering. The term stuck. Today, software engineering is one of the largest professions on Earth. It began with 145,000 lines of hand-woven code, a 1202 alarm, and a 26-year-old engineer who said "GO."

The end.

Try It Yourself

Choose your level. Everyone starts with the story — the code gets deeper as you go.

Story Progress

0%

Ready to Start Coding?

Here is a taste of what Level 1 looks like for this lesson:

Level 1: Explorer — Python
import numpy as np
import matplotlib.pyplot as plt

# Your first data analysis with Python
data = [45, 52, 38, 67, 41, 55, 48]  # measurements
mean = np.mean(data)

plt.bar(range(len(data)), data)
plt.axhline(mean, color='red', linestyle='--', label=f'Mean: {mean:.1f}')
plt.xlabel("Sample")
plt.ylabel("Value")
plt.title("Orbital Mechanics & Software Engineering — Sample Data")
plt.legend()
plt.show()

This is just the first of 6 coding exercises in Level 1. By Level 4, you will build: Build an Orbital Transfer Calculator.

Free

Level 0: Listener

Stories, science concepts, diagrams, quizzes. No coding.

You are here

Enrolled

Levels 1-4

Python, NumPy, Matplotlib, real projects, mentorship.

Sign Up Free

Stay Updated

Join Waitlist

Get notified when enrollment opens for your area.

Notify Me

Level 0 is always free. Coding levels (1-4) are part of our 12-Month Curriculum.