PREVIEW
relay-logic

Full Adder from Relays: Carry the One — and Add Any Number

DigiSim Relay Team DigiSim Relay Team
10 min read

In the previous post, we built the half adder: XOR for the sum bit, AND for the carry bit. Two inputs in, two outputs out — a clean circuit that correctly adds any single column of two binary digits. It works. And for exactly one column, it’s all you need.

The problem appears the moment you try to go further.

Real numbers have more than one binary digit. When you add two multi-bit numbers column by column, starting from the rightmost, the first column may generate a carry — a 1 that spills into the second column. Now the second column has three things to add: one bit from the first number, one bit from the second number, and the carry arriving from the right. The half adder has exactly two input ports. Three things to add, two input ports. That mismatch is not a minor annoyance — it’s a fundamental design gap. You cannot chain half adders to do multi-column arithmetic. The carry has nowhere to go.

The fix is a third input pin. The circuit that adds it is the full adder, and once you understand it, the path to adding any number of any size is straight and clear.

The three inputs and why all three are necessary

A full adder accepts:

  • A — one bit from the first number, in this column
  • B — one bit from the second number, in this column
  • Cin — the carry arriving from the column to the right (from the previous, lower-order full adder)

It produces:

  • Sum — the result digit to write in this column
  • Cout — the carry to pass to the column on the left (to the next, higher-order full adder)

The presence of Cin is what the half adder was missing. With it, full adders become composable: wire the Cout of one straight into the Cin of the next, and the carry signal flows up the chain as naturally as it does when you add by hand — start at the right, carry the one, carry the one again, keep going until you run out of columns. Without Cin, that ripple has nowhere to enter each new stage, and every column is forced to start fresh.

Building it from the pieces you know

The elegant fact about the full adder is that you already have everything needed to build it. It requires no new gates — only a deliberate two-step arrangement of the building blocks from the previous post.

First half adder: feed A and B in. XOR gives you ABA \oplus B — call it Sum1, the raw sum of just those two inputs. AND gives you Carry1: the carry from A and B alone. (Carry1 is 1 only when both A and B are 1.)

Second half adder: now feed Sum1 and Cin in. XOR gives you Sum1Cin\text{Sum1} \oplus C_{in} — this is the final Sum output of the full adder. AND gives you Carry2: the carry produced by combining the intermediate sum with the carry that arrived from below.

One OR gate: Cout is 1 if either half adder generated a carry: Cout=Carry1ORCarry2C_{out} = \text{Carry1} \,\text{OR}\, \text{Carry2}.

That OR gate deserves a moment’s attention. Can Carry1 and Carry2 ever both be 1 simultaneously? If Carry1 is 1, that means A and B are both 1 — which means Sum1 is 0. But if Sum1 is 0, then Sum1 AND Cin is always 0, so Carry2 is always 0. The two carries can never overlap. The OR gate is not covering an edge case — it’s the precise logical combination needed, and it neatly ensures we never need to add a carry bit for the carry itself.

Put it together in algebra:

Sum=ABCin\text{Sum} = A \oplus B \oplus C_{in} Cout=(AB)+(BCin)+(ACin)C_{out} = (A \cdot B) + (B \cdot C_{in}) + (A \cdot C_{in})

Two half adders wired in sequence, one OR gate across their carry outputs. That’s a full adder.

The kitchen-table computer

In November 1937, a researcher named George Stibitz at Bell Telephone Laboratories in New York took an idea home for the evening. He’d been thinking about whether relay circuits could do binary arithmetic — whether the same clicking switches that routed telephone calls could be organized to compute rather than merely connect. He gathered a handful of telephone relays from a box in the lab and brought them home with a few flashlight bulbs, a dry cell battery, and a detail that has delighted every computing historian since: strips of metal cut from a tobacco tin to serve as electrical contacts.

He sat down at the kitchen table and assembled these parts into a working 1-bit binary adder.

Stibitz and his wife nicknamed it the Model K — K for Kitchen. The circuit on that table was doing exactly what this post describes: reading binary inputs, computing a sum bit, producing a carry. It was not elaborate. But it was proof — real, clickable, illuminated-by-flashlight-bulb proof — that a relay could perform arithmetic.

Bell Labs noticed. Stibitz was given support and colleagues, and the kitchen-table curiosity grew into a full design project. By 1939 the team had a working prototype; by early 1940 they had delivered the Complex Number Calculator, a relay machine capable of performing arithmetic on complex numbers at a speed and accuracy no human operator could match. It occupied a room at Bell Labs in lower Manhattan.

The story has one more chapter, and it is the one that reaches across eighty-five years. In September 1940, at a mathematics conference in Hanover, New Hampshire, Stibitz demonstrated something that had never been done before: he sat down at a teletype terminal and used it to send calculations to the Complex Number Calculator hundreds of miles away in New York. The machine computed the answers and sent them back over the telegraph wire. Problems typed in New Hampshire, solved in Manhattan, results received in New Hampshire — the first time in history that a computer was operated remotely.

Cloud computing, remote access, the idea that computation is a service you reach over a wire rather than a machine you physically touch — all of it has a root that traces back to a conference room in New Hampshire and a tobacco-tin relay adder built on a kitchen table. Stibitz was not trying to invent the internet. He was doing binary addition.

The truth table in physical clothing

Three inputs, eight possible combinations:

ABCinSumCout
00000
00110
01010
01101
10010
10101
11001
11111

The bottom row is the telling one: A, B, and Cin are all 1 — three 1-bits in a single column. In decimal that’s 1+1+1=31 + 1 + 1 = 3, which in binary is 11: a Sum bit of 1 and a Cout of 1. The carry doesn’t vanish; it becomes the output signal that the next stage in the chain will receive as its Cin.

Compare rows 4 and 7 with the half-adder truth table from Post 13. Rows where Cin is 0 match the half adder exactly: Cout is just the AND of A and B. The full adder is the half adder, generalized to handle that third input whenever it arrives. The extra eight rows in the table are, precisely, the ones the half adder could not deal with.

Try it yourself

Below is a live full adder — the two-half-adder, one-OR-gate circuit described above — running as a genuine relay simulation in your browser. Not an animation: the relay contacts are switching, the current is flowing, and the Sum and Cout outputs update in real time as you change the inputs.

A full adder built from relays: toggle A, B, and Cin and watch Sum and Cout follow the truth table exactly. Open it in the DigiSim Relay Lab.

Three things to pay attention to as you work through the table:

  1. Start with Cin = 0 and confirm it behaves like the half adder. Walk through A = 0/0, B = 0/1, then A = 1/B = 0, then A = 1/B = 1 with Cin always off. The Sum and Cout outputs should match Post 13 row for row. You’re verifying that the half adder is embedded inside the full adder, untouched.

  2. Now flip Cin to 1 and hold it. Walk through the same four A/B combinations again. Every row has shifted — the Sum bit that was 0 becomes 1, the row that was 1 becomes 0. The Cout column gains extra 1s. You are now computing column arithmetic where a carry has arrived from the previous stage. That carry is real and the circuit is handling it correctly.

  3. Find the bottom row: A=1, B=1, Cin=1. Turn your sound on before you set it. Three relays fire, two carries are generated, the OR gate closes its contact, and Cout lights alongside Sum. Listen to the cascade — two half adders and an output gate firing in sequence. That sequence of clicks is the sound of 1+1+1=1121 + 1 + 1 = 11_2 being computed in relay hardware. Stibitz heard something very close to this from his kitchen table in 1937.

Building and toggling a single full adder here is free and fully interactive. When you’re ready for the scale of the idea, the natural next step is chaining eight of them together — an 8-bit adding machine where every carry ripples visibly from stage to stage, capable of adding any two numbers from 0 to 255 with every relay visible and audible. That build, along with a 4-bit adder/subtractor that uses the same full adders for both operations, lives in the DigiSim Relay Lab behind a one-time unlock. Build one here; go watch eight of them ripple in the Lab.

The ripple-carry adder and why it matters

Take two full adders and wire the Cout of the first to the Cin of the second. Set the Cin of the first to 0 (no carry arrives at the rightmost column). Now you can add two 2-bit numbers. Extend the chain to four, eight, sixteen, thirty-two, sixty-four full adders and you can add numbers of those widths — all with the same circuit, replicated.

This is the ripple-carry adder, and it is the direct architectural ancestor of every arithmetic unit in every processor ever built. The carry signal ripples from right to left, each stage contributing its bit to the chain before passing the baton. It is, in hardware, exactly the algorithm you learned as a child: rightmost column first, carry the one, next column, carry the one, and so on.

The relay computers of the 1940s and 50s — including the descendants of Stibitz’s Complex Number Calculator — used this structure at their arithmetic cores. When a later generation of engineers switched from relays to vacuum tubes, then to transistors, then to integrated circuits, they carried the same logical structure forward. The gate symbols changed; the labels changed; the clock speed went from milliseconds to nanoseconds to picoseconds. The logic did not change. A full adder from 1940 and a full adder inside a 2026 processor obey the same truth table, row for row.

There are faster designs — the carry-lookahead adder precomputes groups of carry signals in parallel rather than waiting for each to ripple from the previous stage, and for modern processors at gigahertz frequencies that speed matters enormously. But the carry-lookahead adder is an optimization of the ripple-carry adder, not a replacement for its logic. Understand the ripple, and the faster variants are immediately comprehensible. You already have the foundation.

What you just learned — and what’s next

Post 14 adds these pieces to your toolkit:

  • A half adder handles two inputs but has no Cin, so it cannot be chained. A full adder adds a third input — Cin — and produces Cout, making it composable.
  • The full adder is two half adders plus an OR gate: first HA handles A and B; second HA takes that intermediate sum and Cin; OR combines the two carries.
  • Sum = A ⊕ B ⊕ Cin; Cout = (A·B) + (B·Cin) + (A·Cin) — the two outputs from eight possible input combinations, all visible in the truth table above.
  • Chain N full adders — Cout to Cin — and you get a ripple-carry adder that handles N-bit numbers. This is the arithmetic heart of every processor.
  • George Stibitz built the first working relay adder in November 1937 on his kitchen table (the Model K), which grew into the Complex Number Calculator and in September 1940 was the machine in the world’s first remote computation.

In Post 15 of Building a Computer from Relays, we leave arithmetic and enter a new territory: circuits that don’t just compute a result and stop, but circuits that refuse to stop. Wire an inverter so its output feeds its own input and something strange happens — the circuit can’t settle. It oscillates. That instability, tamed and regularized, becomes the clock pulse: the heartbeat that lets sequential circuits — flip-flops, registers, everything that holds state — update in lockstep. Feedback, and a circuit that won’t sit still.

The arithmetic is done. The clock is next. DigiSim Relay Lab.