Carl Hasbargen's RC-C Relay Computer


Computer.

Figure 1

: The computer overall.

Introduction

While meandering on the internet in 2021, I discovered the website of Dr. Harry Porter. He was a professor of computer science at Portland State University and he had designed and built a computer out of 415 relays. He documented his design concepts in a paper and he even posted copies of his circuit diagrams on his website:

The Design of a Relay-Based Computer (PDF)
Harry Porter’s Relay Computer - More Info

After digesting his work, I was hooked. I decided to build my own version of his computer—with a few modifications.

Further scanning of the internet showed that I was not the only person inspired by Dr. Porter. In 2007, Jon Stanley built a smaller relay computer based upon Porter’s machine and dubbed it “Relay Computer Two” or RC-2. Then Phil Ryals went on to spend several years putting together a museum-quality machine based upon Porter’s design, but in a single cabinet and with an expanded instruction set, in about 2011. He dubbed his machine “RC-3". He has posted videos of it in operation and also provided a great deal of documentation regarding his schematics and such. A very nicely designed version of Porter’s basic design was put together in the United Kingdom by Paul Law. There is a great web-site showing the compact machine (using smaller-sized and faster relays than Porter or RC-3). Wonderful videos.

Phil had the assistance of several people to bring his machine to life, and it still took 1500 hours over 21 months to accomplish. Paul’s machine was done on hobby time off and on over 12 years, I believe. Undaunted, I decided that since I had just retired in 2021, I could dig into the project. It ended up coming together pretty quickly that year. I guess when one is willing to slap together things “good enough”, as opposed to making a museum-quality machine, things can move along faster!

I have never named my machine, and I do not know if others have put Porter-like computers together in recent years. I might just christen my machine as “RC-C” since I do not really know where my correct number should be on the list, but C is my first initial, so it can be considered “Carl’s relay computer”.


What Changes Did I Make?

Because others have done such a great job documenting the main structure and operation of this computer design, I will not repeat their work here. Instead, I will tell you about what I chose to do differently and I will conclude with some general observations and thoughts, in retrospect.

The changes I made to the Harry Porter computer include:

  1. Form factor
  2. LED display of registers built into the register relays themselves
  3. One instruction is modified
  4. The addition of DIP-switch ROM
  5. The addition of three 8-bit input / output ports
  6. The addition of a battery backup for the RAM memory

I will give a bit more detail about each of these changes below.


Diagram of memory scheme.

Figure 2

: Diagram of memory scheme.

Form Factor

Dr. Porter’s computer was a collection of four mahogany cabinets, each housing a different portion of the computer and interconnected to each other with cables. Paul’s relay computer and the RC-3 computer each were contained in a single cabinet. Mine is also contained in a single cabinet, but it is made out of mahogany in honor of Dr. Porter. I decided to have the lower half house the relays in a way that displayed them fully, while the upper half would have a display panel with all of the control switches and some strategic LEDs displayed.

I wanted to make the machine without relying on any printed circuit boards (although I ended up cheating when it came to making my ROM). Instead, the relay cage had a rectangular frame of aluminum channel strips bolted together with several parallel vertical aluminum strips in the middle to allow for additional structural integrity. I used the table saw in my garage to cut strips of 1/16" thick fiberglass sheet that could be mounted horizontally across this aluminum frame. Each fiberglass strip had 25 pairs of holes drilled into it to accommodate my relays. A dab of silicone sealant was used to stick each relay onto its fiberglass strip, with the two coil solder tabs protruding through the pair of holes for that relay, and then a silicon flyback diode was soldered in the back between the coil tabs to prevent the relay contacts from arcing every time an active coil is disconnected during computer operation. The semiconductor diodes may be “cheating” with a relay computer, but if it prevents the relay contacts from burning away, it is a wise choice, I think.

I have a 12 volt switching power supply in the bottom of the computer and a small 6 volt supply that then goes through a 3-lead 7805 5-volt voltage regulator[1] to supply the RAM chip for memory. On one side of the cabinet interior, I have strung color-coded wires to act as the data bus for the computer. On the other interior side, I have strung 16 color-coded wires to act as the address bus. Any row of registers that need to tap into those buses does so via wires from that row of relays over to the appropriate bus. I have taken the 12 volt lead from the power supply and divided it into multiple lines, which are independently fused. Every handful of relay rows gets its own fuse and has its own voltage-smoothing electrolytic capacitor.

The control panel has a “Debug” rocker switch. When that switch is on, it allows the various toggle and rocker switches on the panel to be used to enter data or to test and debug the computer. When the computer is running, that debug switch is turned off to prevent an accidental switch position from interfering with the operation of the machine or to short-circuit something while the computer relays are doing their thing.

Back wiring.

Figure 3

: Back wiring.

I have cut a plexiglass sheet to cover the relay portion of the machine, but have never mounted it. I suspect it might get scratched up over time and it also might muffle the sounds of the clacking relays. Since the fun of this machine is in watching the relay lights blink and listening to the relays sounding, I have hesitated to mount it. Having said that, if I ever seal it up, I have muffin fans mounted in the back that draw air in from the top and blow it out the bottom (I did not want to draw dust bunnies in from below).


Register LEDs

Dr. Porter’s initial design appears to have used panel-mounted LED assemblies that ran on 12 volts. He would run wires from the various relays to these displays to show register status on his front panels. His paper says he bought 350 of these for $1.49 each. The relays I used are OMRON style (probably cheaper Chinese knock-offs) like the Porter and RC-3 computers used, which I bought for about $4 each. The relays without a built-in LED were a bit less expensive than the ones with LEDs; I used these for non-registers. However, I chose to have my visible relay registers reveal their contents using relays with built-in LEDs.

Some of the register contents were also carried up to my control panel, where I used 25¢ 5mm LEDs with 10¢ resistors to operate them from 12 volts. I bought most of my panel-mounted toggle switches off of eBay, but the larger black toggle switches and rocker switches used for programming were picked up at a local surplus store inexpensively. As I write this up four years after building my computer, I see that eBay prices for relays like mine are now $10–12 each. My 413 relay computer would now cost more than $4500 just to buy $11 relays![2] There are some large-lot relay deals that come up from time to time on eBay, but those are typically DPDT varieties, not the 4PDT like I have used. If DPDT relays were to be used, then numerous places in the computer design would require two relays with coils wired in parallel to accomplish the same thing as a single 4PDT relay.


One Modified Instruction

The original Porter computer had three function bits, f0, f1 and f2[3]. They had eight possible combinations, which were used to assign the function that the ALU would perform:

Function BitsOperation
f0f1f2
000ADD
001INCREMENT
010AND
011OR
100XOR
101NOT
110SHIFT LEFT
111<not used>

Per Dr. Porter’s paper describing his machine, he would have done things differently:

In retrospect, it was a mistake to assign the function code 111 to <not used>; it would have been a better decision to assign 000 to <not used>. The reason is that it is convenient at times to turn off portions of the computer’s control circuitry, which causes the ALU function control to be 000. Unfortunately, this causes the data bus to be driven by the ADD circuitry in the ALU, rather than to be quiescent. If 000 had been the <not used> function code instead, then whenever the control circuitry was not driving the ALU function inputs, the ALU result would be unconnected to the data bus.
Panel (ROM).

Figure 4

: ROM section of front panel.

With the benefit of his hindsight, I use the 000 to represent <not used> and I use 111 to represent ADD. Unlike the RC-3 computer, I have neither added nor changed any other instructions in the instruction set.


Addition of DIP-switch ROM

The idea of having to manually enter every program line bit-by-bit every time I fired up the computer to show to someone was not appealing. I thought it would be nice to have a simple program or two that were “at the ready” when the machine powered up. I think the RC-3 computer accomplished this by having a 32 kB RAM chip like Dr. Porter’s machine, but they added a 32k ROM chip with programs pre-entered into the chip, if I recall. There are 16 address lines in the machine and the original RAM chip only used 15 of those bits, so there is indeed an “extra” 32k of memory to play around with.

My idea was to use the 16th address bit as a flag that we were operating out of the range of the RAM chip. If that 16th bit was active, then I would interrogate a few more bits to see what was going on. Here was my plan, expressed as a memory map[4]:

Bit PatternAddress Type
0xxxxxxx'xxxxxxxx
RAM chip data
100xxxxx'xx******
64 ROM addresses designated by the last 6 bits
101xxxxx'xxxxxxxx
write out to the printer output port
110xxxxx'xxxxxxxx
read in from the input port
111xxxxx'xxxxxxxx
third port, can be configured as input or output by a switch

So of the “spare” 32k of memory addresses not used by the 32k RAM, I end up using 64 addresses for my front-panel ROM and 3 addresses for my back-of-computer ports.

To implement the ROM memory, I use two banks of DIP switches, each containing 32 words (Figure 4). For the youngsters in the crowd, DIP refers to the format used for 1970s-era integrated circuit chips where pins on each side of the chip were spaced 0.1" apart. My DIP switch units each have 8 simple tiny SPST switches in parallel next to each other to store a single instruction for this computer.

To decode the address to access a word from this read-only memory, my decoding system places 12 volts into one relay which is activated or not by address line A15. If A15 is active, the 12 volts goes on to another relay, whose coil is powered by the A14 line. If A14 is zero, then the 12 volt signal goes to a third relay, whose coil can be activated by the A13 line. If that is also zero (“100" for the first three digits in the address), the 12 volt signal is passed through a collection of relays whose coils are activated by address lines A0 through A4. That results in one of 32 wires having a level of 12 volts. These 32 lines are connected to each of my two 32-word ROM arrays, but several more relays are controlled by address line A5 to determine which of the 32-word ROM banks gets to pass its 8 selected bits onto the data bus during a memory read. I used a total of 17 relays to do this address decoding. (See also Figure 2.)

When I first started putting together my ROM arrays, I was using some perf board with 0.1" spacing. Many hundreds of closely-packed wires and solder joints was kind of a nightmare when I had to find and fix a bad solder joint. Ultimately, I broke down and sent away for some printed circuit boards for the ROM switches.

I made a “sandwich” with two layers of PCBs, separated by about 1/4". One layer had holes to mount DIP sockets (I elected not to solder the switch units directly to the board, in case a unit needed replacement). The sockets I used were “wire wrap” sockets with long legs. Once the sockets were soldered into place, I cut off the leads from one side but kept the 8 leads on the other side long so they could pass down into the second PCB. The side with the leads cut off was basically the side where all 8 switches of the unit were “selected” to be at 12 volts by one of the 32 wires coming into the array from the decoding relays. Those 8 pins were all soldered together electrically on the PC board. The 8 long leads on the other side represented the 8 bits chosen by the position of the 8 switches of the unit: if the switch was on, the 12 volts would be passed down the appropriate lead to the layer below. The second PC board had a silicon diode soldered into place for each of the switches in the array, which keeps the closing of one switch from interfering with the voltage levels on other lines.

Port and battery.

Figure 5

: One of three ports, above the 3V battery backup.

Even with no RAM chip installed into the computer, this 64 words of ROM was quite useful. I could write, perhaps, an 8-word program to test a specific instruction, like “shift the contents in register B to the left one space, then start again”. Or I could write a program to generate the Fibonacci series and have it visible in any given register. Admittedly, such small programs for testing or for display to others would not take a very long time to enter by hand, but I am still glad to have added this ROM.


Addition of Three Ports

I have already noted above how I use address lines A13–A15 to potentially select a port in the back of the computer. These ports are simple. Each one has 8 connections that go directly to the data bus. Each one also has a screw terminal connected to electrical ground and another connected to 12 volts. That is so any peripherals I might design can integrate with the proper voltages of my computer. Finally, each port has a “strobe” line.

The strobe line tells the external peripheral when it should read from or write to the data bus. How are those strobe signals generated? Well, the computer already generates a “memory read” signal when a memory read function is being executed. I just pass this memory read signal to the strobe terminal of the port whenever the A13–A15 address lines have selected that input port. To output from the data bus, I just pass the “memory write” signal along whenever the A13–A15 address lines have selected that output port. One of my three ports is dedicated to input, one is dedicated to output and the third can do either input or output depending upon the position of a slide switch next to the port. I did not know when I put this machine together if I would prefer the third port to be for input or output, so I built in some flexibility.

Having said that, care will have to be used so that I keep my software in order. I do not want an external peripheral device to be trying to put 12 volts onto the bus lines when the computer is not expecting it. My basic decision was to have some sophistication in my peripheral devices—perhaps using an Arduino microcontroller to manage the queuing and timing at the ports while letting the computer plod along. If I am loading a program via the input port, for example, the computer may take 5+ seconds to read a word in and then to deposit it into RAM. That would give the peripheral device plenty of time to tee up the next word and wait for the strobe. There is no handshaking protocol here. The computer treats a port just like it treats any other memory address.


Diagram of battery backup scheme.

Figure 6

: Diagram of battery backup scheme.

RAM Battery Backup

As I mentioned earlier, there may be a variety of old 5 volt memory ICs that could work with this computer. The chip I have will preserve its memory contents as long as about 2.4 volts is maintained on the power pin, but if power goes down or if the computer is turned off, the CE (chip enable) line of the memory chip should be deactivated to preserve power used by the memory chip.

A web article by Stephen H. Lafferty[5] described how he used a 3 volt lithium battery to maintain the contents of his memory chip when main power was down. My idea was to implement something like this with my computer. If the computer were turned on and power provided by the power supply, all is well. But if the power went down or the machine is turned off, the little 3 volt battery would preserve memory for over a year. If the battery needed to be changed, I would do that while the computer power was on, rather than having both the main supply and the battery be down at the same time.

For safety, I had the 3 volt battery mounted to the exterior of the computer so I would not have to be rummaging around inside the machine while power was on. This battery backup idea was for preserving large programs or collections of programs that had been painstakingly entered into the machine. In Phil Ryals’s RC-3, he simply has a 32k ROM chip that has been pre-programmed. But for me, a battery backup seemed like a simple thing to add.


Difficulties

From time to time, some relays that seemed to have operated just fine in the past would not work. If I just let the machine run for a while, some of those would seem to work again. I suspect some contacts were oxidized or something and repeated working of the relay may have temporarily “renewed” the contacts? Clearly, if each of my relays had instead been a relay socket, like the RC-3 computer uses, I could just pop out the offending relay and plug in a new one. But since sockets could cost as much as the relay itself, I never seriously considered them for this project. Some soldered joints that seemed to work in 2021 have needed to be “refreshed” after the computer has endured 4 years of up and down temperatures and humidity in my garage. Those joints were clearly marginal soldering jobs to begin with, so it is a reminder to pay attention to each joint before moving on during construction. Fortunately, the design is simple enough that problems can usually be traced back to the faulty connection just by seeing which diode is not lighting up.

My RAM memory IC was less than reliable. I think all of the electrical noise generated by 400 clacking relays may have been a problem for the CMOS chip. I did add more electrolytic capacitance to the power pin of the chip, and then I took the ribbon cables that supplied signals and split them apart a bit so I could run each lead through a ferrite core. Still not perfect. I have read that earlier versions of the chip may have been more robust, while the “newer” versions of these obsolete chips are faster and more prone to disruption from noise. The DIP ROM switches do a more reliable job when doing some short program, but they do not store results.


Gallery

Gallery (click images to view original photos):


Figure 7

: Video of RC-C
computer running.

Final Thoughts

I am happy to have done this project, but I know that starting something like this may be intimidating to others. From a work perspective, it was helpful to take things one step at a time. Soldering up a few relay registers in one day was a good thing. Soldering up the more complex instruction-decoding logic over the course of a week was more taxing, but then was done and I could move on. As I noted earlier, I built this machine pretty quickly in 2021, but I had just retired, so could put multiple days each week into the project for multiple months.

I think the current cost of relays might be one of the biggest obstacles at this time, but perhaps those could be purchased in an “installment-like” way, too. Buy 50 small relays and build three or four registers, then buy another 50 relays when able to do so. Realistically, most folks may prefer to buy smaller DPDT relays, rather than the 4PDT ones that I used. When I review my wiring diagrams, it seems that 242 of my 4PDT relays could be replaced by DPDT relays outright and the remaining 171 4PDT relays could be implemented with 2 DPDT relays each—wiring their coils in parallel, meaning my computer could be built using 584 DPDT relays total. I have just now discovered some 50-relay lots of small DPDT 12v relays on eBay for $31 per lot, so 600 relays could be purchased for $400. That would NOT have the built-in LEDs like my machine and the little pins designed for PCBs would require a different assembly approach, but at least it may be within the reach of more people if deals like this come up from time to time.

For me, there is satisfaction when I watch the LEDs of the sequencer move left to right and than start again with the next instruction, or when I watch the program counter go up one count at a time as the program executes. If I have written a little program that moves the contents of one register to another, it is fun for me to see the pattern change on the front of the relays as one register lights up or another goes out. But even for my friends and family who have no real idea of what is happening inside the computer, they enjoy listening to the clacking of relays and the flashing of lights. Whenever a sibling asks “what can you do with it?” I just hand them a beer and have them sit down to enjoy the experience.

Carl Hasbargen - Saint Paul, MN



Back to Mr. Clicky-Clack and other relay computers.

Back to Electronics Projects.


Notes