Why build this?

This project started with a simple question: what would a computer look like if we never agreed that binary was the only sensible choice?

Balanced ternary is an elegant number system with a long history in theoretical computing. Its use was seriously considered in early Soviet computer research (most notably the Setun machine, 1958), and it remains theoretically interesting today.

Instead of bits, balanced ternary uses trits: −, o, or +. The least significant digit represents ±1, the next ±3, the next ±9, and so forth. Numbers are coded as follows:

Decimal

9

3

1

The Logic

1

o

o

+

0 + 0 + 1

2

o

+

0 + 3 − 1

3

o

+

o

0 + 3 + 0

4

o

+

+

0 + 3 + 1

5

+

9 − 3 – 1

-5

+

+

1 + 3 − 9

This makes negation trivially easy (just flip the signs), eliminates the need for a separate sign bit, and keeps arithmetic symmetric around zero. In this project, the three states are represented physically as voltage levels: −5V, open, and +5V.

I chose relays and diodes because they are easy to understand and relate to. You can hear them click, watch LEDs change state, and trace every signal path by eye. This is not about speed or efficiency. It is about understanding computation at a fundamental level, exploring an alternative number system, and embracing the constraints — and beauty — of hardware logic. What followed was a long descent into diode matrices, relay logic, and the realization that ternary arithmetic is elegant in theory but not trivial in hardware.

No References, Just Plain Curiosity

All of this was designed completely from scratch. No reference designs, no copied schematics, and no “standard” ternary circuits quietly borrowed from somewhere else. I started with an empty page and worked forward by thinking, prototyping, testing, redesigning, and debugging.

Schematics, logic concepts, PCB layouts, and mechanical assemblies are all original. This project isn’t about efficiency or usefulness; it’s about understanding computation by physically building it, one clicking relay at a time.

The Ternary Relay

The whole project hinges on a deceptively simple trick: building a three‑state switching element from bog‑standard SPDT relays on a single PCB.

This Double‑Pole Triple‑Throw (DPTT) relay is synthesized from two sub‑miniature G6K‑2F‑Y SPDT relays, packaged in a wide 24‑pin DIP configuration. When neither coil is energized, the common pin floats, representing the o (open) state. Energizing the first coil connects the common to −5 V, representing . Energizing the second coil connects it to +5 V, representing +. Diodes ensure that only the appropriate relay is driven.

Red and blue LEDs indicate positive and negative states, chosen to evoke “warm” (positive) and “cold” (negative) temperatures. This creates a true three‑state switching element that maps directly onto balanced ternary logic; built from parts you can hold in your fingers and hear click.

A Design Challenge

A critical design constraint follows directly from this arrangement: the −5V and +5V rails must never be connected to each other through the relay contacts.

Since both supply rails are always present in the circuit, a single wiring error or logic fault that simultaneously activates both coils — or routes both rails to the same common pin — would create a direct short circuit, with the inevitable magic smoke as an unpleasant result. Every stage of the adder, the demultiplexer tree, and the amplifier board was therefore carefully designed to guarantee that at any given moment only one coil per relay module can be driven, and that no signal path can ever bridge the two supply rails.

Clear Stages and LEDs

The adder was designed with an educational purpose in mind. Every stage is named (in Dutch) so that its function can be clearly identified. The stages are:

Colors are used to clarify information flow:

Yellow – decimal

Red – positive ternary value

Blue – negative ternary value

Green – seven‑segment display

LEDs are sprinkled everywhere so internal states are visible at a glance; because if you’re going to build a relay computer, you might as well watch it work.

How It Works: The Full Stack (in Balanced Ternary)

The Input

Input is provided via two 16‑key keyboards (0–13 plus sign selection). The numbers must be pressed simultaneously and optionally combined with the − key. To add two negative numbers, four keys must be pressed at the same time. The decimal input values are shown using yellow LEDs.

From Decimal to Ternary: The Coder

Two diode matrices are used to convert the entered decimal numbers into disjunct balanced ternary trits.

From Disjunct Bits to Real Ternary

Because relay coils require more current than the keyboard contacts can reliably provide, a Darlington driver stage amplifies the ternary signals before they drive downstream relays. When a number is negative, the trits must be flipped; this is also handled in this stage. Bi‑color LEDs on the ternary bus provide visual feedback of the current trit states.

Adder Logic

As in the binary version, this is the heart of the machine; but balanced ternary changes the rules in subtle and interesting ways. The ternary full adder follows the classic two‑half‑adder architecture, adapted for balanced ternary:

From Ternary to Decimal: The Demultiplexer

The 4‑trit ternary result (covering −26 to +26) must be decoded into a human‑readable decimal number. This is handled by a cascaded relay demultiplexer tree spanning all 53 possible output values.

Unlike the binary version, the ternary demultiplexer does not simply select a number… What makes this approach interesting is that the tree is tapped at strategic points. These taps directly generate the minus sign and the higher decimal digit (10 or 20), while the remaining paths are merged into the 0–9 digit group. This avoids separate sign handling or digit‑selection logic: the structure of the tree itself already contains that information.

The demultiplexer naturally separates the result into three outputs: the sign, the tens digit, and the units digit.

From Decimal to Seven‑Segment

A third diode matrix converts the decimal digit information into seven‑segment coding.

Display

This matrix drives a two‑digit seven‑segment display with sign support, mapping each decimal value to the correct segment pattern, including the minus sign for negative numbers.

Mechanical Aspects

The adder is constructed from a large number of PCBs interconnected by signal wiring. All wiring is routed beneath the PCBs, which are raised using standoffs to provide clearance.

This project is part of my four‑project series “My Relay ADDiction” (pun intended): a hands‑on exploration of logic and arithmetic built with relays, diodes, LEDs, and a healthy amount of curiosity.

Each project stands on its own, but together they form a learning path—from basic binary gate behavior (It’s logic!), through number representation (TritBits), to full adders in both binary and balanced ternary.

Related projects in the series: 

 • It’s logic!https://hackaday.io/project/184752 

 • Visual Binary Adderhttps://hackaday.io/project/205210 

 • TritBitshttps://hackaday.io/project/205130 

 • Balanced Ternary Relay Adderhttps://hackaday.io/project/205212