A 16-bit relay computer where saving instructions means saving days

relay CPU, retrocomputing

This is the read-only HTML version. For the full Visual Space experience, open the app.

relay computer, LED matrix — I

relay computer, LED matrix — I
relay computer, LED matrix — I
relay computer, LED matrix — I
relay computer, LED matrix — I

Source: Homebrew 16 bit relay computer on Hackaday.io · Peter

CPU design, optimization

Peter’s homebrew accumulator machine uses four clock pulses to manage its relay registers. With a memory-mapped display and BASIC tools now added, its latest Mandelbrot comparison puts the cost of software choices at 25 days versus two—timings presented by the creator, not a documented multi-day hardware run.

Award badge 1
👍 1

On Peter’s 16-bit relay computer, reducing a program’s instruction count can mean getting an answer days earlier. Shared on Hackaday.io, the build combines an accumulator-based relay CPU with Arduino-backed memory and clock generation. Its latest additions—a 32×32 display, a simulator and a BASIC compiler—make the relationship between hardware and software particularly tangible.

The project was created on February 22, 2023, and the supplied updates extend through October 15, 2026. This is an evolving physical machine, designed with help from a simulation in the game Logic World, rather than a newly announced concept.

Why a register needs four pulses

The CPU puts an accumulator at the center of its arithmetic and load/store operations. Its program counter gets a dedicated adder that does just one job: add one. Peter describes that as a “High Performance” feature, a small architectural luxury in a machine built around slow switching elements.

The more revealing detail is how the registers change state. They use self-retaining relays, and Peter explains that a register must be cleared before new information can be stored. Updating a value therefore isn't simply a matter of presenting the next word and issuing an ordinary clock edge. The system uses a sequence of four different pulses to manage its operation.

That constraint also explains the extra holding register associated with the program counter. The machine cannot directly replace the counter’s existing value with that same value plus one; it needs somewhere to preserve information during the update. Here, a physical storage mechanism leaves a visible mark on the CPU architecture.

Other choices keep the design compact without making it entirely bare-bones. Instructions can use an operand following the opcode, access memory at an address supplied there, or follow an additional address stored in memory. CALL and RET are supported too, but a single return-address register replaces a stack. Only one level of subroutine calls is supported. That is a meaningful boundary for anyone writing software for the machine.

Modern support around a relay core

This isn't an all-relay system. The overview identifies Arduino implementations of memory and the clock generator, while the arithmetic, accumulator and branch logic sit on relay boards. That division is worth keeping in view: the project explores a relay CPU without requiring every supporting function to use the same technology.

In the August 17, 2026 display update, Peter reports adding a 32×32 LED matrix through another Arduino. Part of the system’s memory now serves as video memory, making the display memory-mapped. From the CPU’s perspective, drawing becomes a matter of writing data to the relevant memory locations.

There has also been an experiment with a different kind of assistance. A December 25, 2025 update describes calculating the square root of 60,000 with an FPGA acting as a mathematical coprocessor. Peter says its VHDL emulates the relay design, allowing it to use the same square-root routine. That result should be understood as a coprocessor-assisted demonstration, not as a relay-only calculation.

From eight minutes to multiple days

The logs give a useful sense of what running software demands. On March 24, 2026, Peter reported finding a hardware problem during a second attempt at calculating pi; the excerpt doesn't identify the fault. By May 16, he reported a successful result accurate to two decimal places, taking slightly more than eight minutes and 1,377 instructions. Each of those instructions had to execute reliably for the result to hold together.

A July 26 update then described running Dijkstra’s shortest-path algorithm on a weighted graph of eight Austrian cities, finding a route from Eisenstadt to Innsbruck. It’s a compact problem, but one that gives the machine more to do than a single arithmetic demonstration.

The October 15 Mandelbrot update pushes the timescale much further. Peter compares a BASIC version that he says would take 25 days on the physical machine with AI-generated machine code presented as reducing that time to two days. The excerpt does not document a completed multi-day hardware run, so these figures are best treated as the creator’s timing comparison rather than confirmed endurance results.

Even with that distinction, the comparison gives software optimization a concrete stake. A more convenient programming language may make a program easier to produce, while the resulting instruction workload can dominate how long the relay machine must keep operating. Peter also links a software simulator and BASIC tool for exploring that software side.

The next revealing result would be a sustained hardware run paired with an instruction count and a checked output. The pi demonstration already shows why: fewer instructions aren't just a route to a quicker picture. They also reduce the amount of repeated physical operation required to reach an answer.

Source: Homebrew 16 bit relay computer

Hardware

3 Followers

A workshop for electronics and physical computing. Share circuits, boards, tools and prototypes; work through measurement and debugging, compare components, and document the choices that turn an idea into working hardware.

Visual Space is built for projects like this—where creators collaborate, organize goals, and grow communities around real work.