Switches and Wire

Now that we understand the theory behind Boolean logic, we need to start thinking about how we can physically implement it so that we can create actual devices based on it.

Regardless of their complexity, digital electronics are built, at the lowest level, from switches and wire. Switches are a perfect fit for digital systems because a switch only has two states: connecting or not connecting. To see how switches and wire can implement digital logic, first consider the circuit in the schematic below. The battery on the left is connected to the light on the right. Current will flow if there is a complete path from one side of the battery to the other (which there is), and the light will turn on if current flows through it (which it does), so in this situation, the light is on.

battery and light

Disambiguation: The word "circuit" can be used in the specific sense of a single closed loop (like "racing circuit"), or it can be used to refer to an entire group of connected electronic components (which could contain many of the more narrowly-defined "circuits"). The former is very common when designing and anlyzing analog electronics, but the latter is much more common in digital electronics.

A light that is always on is not very interesting, so we can make and break the circuit with a switch. (Which meaning of "circuit" is used here? The "loop" definition, because we are talking about conceptually closing and opening the loop, not creating and destroying the group of components.)

single switch circuit

If the switch is open, no current can flow, so the light is off. If the switch is closed, current flows, and the light is on.

Definitions: A switch is "closed" when it is connecting its sides so that current can flow through it, and "open" when the connection is broken so that current cannot flow through it. Don't try to relate this to a water valve, which would use the opposite sense of the words; think of it as two pieces of metal with a gap between them: when the gap is closed, electricity can flow; when the gap is open, electricity cannot flow, because it cannot cross the gap.

The behavior of this simple circuit can be expressed using this truth table:

switch light
open off
closed on

In this system, the 'input' is whether the switch is open or closed, and the 'output' is whether the light is on or off. The table above spells that out, but if we substitute the input with true/false for if the switch is closed (and write 1/0 for brevity), and substitute the output with true/false for if the light is on, then it's more clear that this is describing a digital system.

switch closed? light on?
0 0
1 1

We can define the output as a function of the input. If desired, we could express that function as a Boolean algebraic expression (light on := switch closed).

Now consider this circuit with two switches.

series switches

With two inputs, the truth table for the circuit above has four rows. The order doesn't particularly matter (though we will usually use a standard order), as long as all cases are listed. As above, this truth table will use '0' for a switch being open (because that is when current does not flow) and '1' for it being closed, and '0' for the light being off and '1' for the light being on.

switch A switch B light
0 0 0
0 1 0
1 0 0
1 1 1

In this circuit, the light is only on when both switches are closed (which could more-generally be described as all switches being closed, if there were more than two switches). Since either switch can block the flow of current, they both need to be closed for a complete circuit to exist. You should recognize this behavior as logical AND -- the light is on when switch A is closed AND switch B is closed.

This illustrates an important point: a series connection of switches produces AND behavior. The word "series" means "one after the other" and you can see that that describes how the switches are arranged in the circuit.

The next system has two switches in parallel. A "parallel" connection means that they are arranged such that either one (or any one, if there are more than two) could create a path.

parallel switches

Now the output is true if either switch is closed (which could be described as any switch being closed, if there were more than two). This is logical OR -- the light is on if switch A is closed OR switch B is closed. Here’s the truth table:

A B Out
0 0 0
1 0 1
0 1 1
1 1 1

Note that the logic descriptions just given only make sense with the given definitions of "true" and "false". That might seem like a strange thing to bring up, but consider this: in the parallel circuit, the output is only off when both switch A AND switch B are open. Now all of a sudden the system was described using AND instead of OR! So, it's important to know (and express, if not clear from context) what you have chosen "true" and "false" to mean.

You might have noticed that all that really matters in these analyses is whether or not there is a path for current to flow through the switch network. The term "network" means a collection of connected devices, and what we have been describing is different ways to connect switches to control the flow of current, so "switch network" describes what we are creating. By connecting switches in different combinations of series and parallel, we can implement different logic functions.

This third circuit is more complex. Since all that we care about right now is the switch network, we will ignore the rest of the circuit and focus on whether or not there is a connection all the way through the network.

three switch network

With three inputs, the truth table has eight rows to capture all combinations of the switches. This circuit's behavior is described in this truth table:

A B C Connection?
0 0 0 0
1 0 0 0
0 1 0 0
1 1 0 1
0 0 1 0
1 0 1 1
0 1 1 0
1 1 1 1

It can be difficult (or at least tedious) to create a truth table directly from a switch network, so alternative would be to describe the logic created by the switch network using a Boolean expression. By interpreting the switch network above as a series connection of two subsections, one consisting just of switch A and one consisting of a parallel connection of switches B and C, we can quickly derive a Boolean expression: A·(B+C). Note that the parentheses are required here! Without them, A·B+C describes switches A and B in series, and that block in parallel with switch C, because AND has precedence over OR.

Normally-open / Normally-closed Switches

With all of the switches used above, they were normally open, and something had to 'happen' for them to close. Switches can also be made to operate the other way around -- to normally be closed, and to require action to open. To unambiguously discuss switches, we need proper definitions of several terms:

  • open / closed: As described earlier, open means that current cannot flow through the switch, and closed means that current can flow.
  • normal position: The normal position of a switch is its position (open or closed) when it is not being activated.
  • active / inactive: Active means that something is happening, which for a switch, means that it is moved from its normal position to the other state. We will discuss electrically-controlled switches later, but for now, you can imagine 'activated' as something like pushing on it with your finger.

It is very important to not conflate "active" with "closed," because that is only true for a normally-open switch -- since it is normally open, when it gets activated, it becomes closed. However, for a normally-closed switch, being activated would mean that it opens. This is indicated in their schematic symbols by always drawing the switch in its normal position. Here are two common styles of schematic symbol for both normally-open and normally-closed switches.

switch schematic symbols

When creating a truth table for a switch network from now on, instead of the inputs to the system being open or closed, it will be much more useful to consider the inputs of the system to be whether the switch is active or inactive. Note that for all of the examples above, that doesn't change anything, because they all used normally-open switches, so active means that the switch is closed. But consider one of the normally-closed switches: when the switch is inactive (which we represent in the truth table with '0'), there is a connection through the network. And conversely, when the switch is activated, it opens, and breaks the connection. So the truth table is

Active Connection
0 1
1 0

This creates logical inversion (NOT) -- there is a connection when the switch is NOT active (noting how important it is to describe the switch in terms of active/inactive instead of open/closed).

Now that all of the basic Boolean logic functions (AND, OR, and NOT) can be implemented with switch networks, any logic function can be implemented, since they can always be created from those three.

Summary

  • Switches either allow current to flow through them (closed) or block current (open).
  • Switches can be swapped from their "normal" state (which could be either open or closed) to their "active" state (which is the opposite of their normal state).
  • When considering whether or not there is a path all the way through a collection of connected switches (a switch network), connecting switches in series implements the AND logic function and connecting switches in parallel implements OR.
  • A normally-closed switch behaves as if its control signal is inverted (when considering "active" to be "true" for the input, and "there is a connection" to be "true" for the output).
  • You should be able to create a switch network from a given Boolean expression, and write a Boolean expression for a given switch network.