“Y” in English sounds like “guay” in Spanish (my mother tongue), a colloquial expression or slang meaning “cool.” Starting off with a pun just seems like a good idea, but the truth is that I do believe the Y switch is really cool.

While this terminology is not very commonly used (if ever used before) I think it’s very descriptive or illustrative of the way in which this switch works. Figure 1 shows the schematic of a Y switch. It consists of a controllable switch that can change its position and connect one terminal to either one of two other terminals.


Figure 1. Y switch schematic (Source: Javier Piay)


This change may occur due to an action or stimulus of various natures: manual, mechanical, electrical, electronic, etc. In the absence of such stimulus, the switch remains in its resting/de-energized position, connecting the so-called common terminal (COM) to the so-called normally-closed terminal (NC). Should the stimulus be applied, the switch changes to its active/energized position, connecting the COM terminal to the so-called normally-open terminal (NO).

The Y switch is also known as 3-way or changeover switch, but — as the tech-savvy members of EEWeb already know — this type of switch is commonly known as a single pole, double throw (SPDT) switch (see also “Switch Bounce and Debounce (Part 1): Switch Types”).

Figure 2 shows different implementations of Y switches. From left to right, the devices shown are controlled or operated by manual, mechanical, electrical and electronic means. It goes without saying that there are similar devices implementing other types of switches, like single pole, single throw (SPST), double pole, single throw (DPST), double pole, double throw (DPDT), etc.


Figure 2. From left to right, Y switches intended to be operated manually, mechanically, electrically, and electronically. (Source: Javier Piay)

Any electrically operated switch is commonly known as a relay (second column from right in figure 2). Like the other forms of switches, electromechanical relays come in a wide variety of types, including SPST, SPDT, DPST, DPDT, etc.

Figure 3 shows the schematic of a Y or SPDT relay. The electrical stimulus (the input signal) that will make the switch’s COM terminal flip between the NC and the NO terminals is connected to a fourth terminal labeled S (meaning “select”).


Figure 3. SPDT relay schematic (Source: Javier Piay)


The SPDT relay is the main component (if not the only one) that we will use in our relay computing design and simulation projects. As for the implementation/build stage, I’m currently more inclined to use the electronic version of this device (first column right in Figure 2) for a number of non-negligible reasons like its compact size (three or four switches per IC), very low price (3 cents per switch), rapid prototyping (breadboard compatible), very wide range of digital and analog signal levels, and ease of coupling to other electronic devices (if necessary).

Out of the four terminals/pins available in a SPDT relay (or electronic switch), only S always acts as an input. In some usage scenarios, the COM terminal acts as an input, in which case both NC and NO terminals act as outputs. In other usage scenarios, the NC and NO terminals act as inputs, in which case the COM terminal acts as an output. As with any switch, these configurations are automatically adopted once the relay becomes part of a larger circuit.

Figure 4 illustrates the aforementioned configurations. For demonstration purposes, the COM terminal of the SPDT relay on the left is configured as an output. In this case, both the NC and NO terminals may carry logic 0 (dark green) or logic 1 (light green) values, and the relay selects between these terminals and passes the selected signal to the COM output. Since this relay is shown as being inactive or de-energized (S = 0), the COM output reflects the logic 0 value on the NC input.


Figure 4. Allowed input/output (I/O) configurations for a SPDT relay. (Source: Javier Piay)


By comparison, the COM terminal of the SPDT relay on the right is configured as input. Since this relay is shown as being active or energized (S = 1), the NO output reflects the logic 1 value on the COM input; meanwhile, the NC output is in a high impedance (Z) state, which means that other relays can safely drive logic 0 or 1 values onto the signal (i.e., the wire) connected to this terminal.

In relay-based binary or digital computing, most of the relays (if not all of them) perform logic functions and implement logic gates within a computing module/system, in contrast to the general-purpose application of independent relays performing power and load switching.

What makes a SPDT relay so cool is that it actually is a universal logic gate in its own right; that is, it can be used to implement any two-input logic function. This can be easily proved by just realizing that the SPDT relay to the left in Figure 4 acts as a multiplexer (MUX), and it is well known that this component is a universal logic gate.

MUX: If S is equal to 0, then set COM to NC, else set COM to NO.

By comparison, the SPDT relay to the right in Figure 4 acts as a demultiplexer (DEMUX).

DEMUX: If S is equal to 0, then set NC to COM, else set NO to COM.

Figure 5 shows how to implement any primitive logic gate, as well as a full adder, using SPDT relays.


Figure 5. The SPDT relay as universal logic gate implementing any primitive logic gate and a full adder. (Source: Javier Piay)


NOT: If A is equal to 0, then set output to 1, else set output to 0.

AND: If A is equal to 0, then set output to A (0), else set output to B.

OR: If A is equal to 0, then set output to B, else set output to A (1).

XOR: If A is equal to 0, then set output to B, else set output to NOT B.

NAND: If A is equal to 0, then set output to NOT A (1), else set output to NOT B.

NOR: If A is equal to 0, then set output to NOT B, else set output to NOT A (0).

XNOR: If A is equal to 0, then set output to NOT B, else set output to B.

FULL ADDER (S = A + B + Cin): S = A XOR B XOR Cin. If A XOR B is equal to 0, then set Cout to A, else set Cout to Cin.

As the final example in Part 1 of this “Building a Relay Computer” mini-series, Figure 6 shows the implementation of a 4:16 decoder using SPDT relays.


Figure 6. 4:16 decoder implementation using SPDT relays. (Source: Javier Piay)


I hope you found this article interesting enough to continue reading future columns in this mini-series, in which we will discuss how to build relay-based registers, counters, an arithmetic logic unit (ALU), and other computing modules that will eventually allow us to build a relay computer, all based on the concept of the humble ‘Y’ switch.