Back

How Circuits Work

Switch Circuits: Series Is AND, Parallel Is OR, Push Buttons, and 3-Way Switches

Chapter 3: Switches and Logic ·

This page sums up what you play through in ElecLab Chapter 3, "Switches and Logic", with diagrams and tables. Depending on how you wire switches, you can build conditions like "when both are pressed", "when either is pressed", or "only while pressed". The same ideas are used in home lighting and in machine safety devices.

1. Switches in series make AND

Switches in a single line (series) leave only one path for the current. If any one of them is OFF the loop is broken, so the LED lights only when every switch is ON. The condition is "S1 is ON and S2 is ON", called AND.

S1S2LED
OFFOFFOff
ONOFFOff
OFFONOff
ONONLit

A machine that runs only while you press two buttons with both hands (a safety device that keeps hands out of the way) uses this AND idea.

B12.2VS1ONS2OFFL1−++−
Only S1 ON: stays dark
B12.2VS1ONS2ONL120.0 mA−++−
Both ON: lights

Wiring example from 3-1

2. Switches in parallel make OR

Switches side by side (in parallel) make two paths. If either one is ON there's a path, so the LED lights. The condition is "S1 is ON or S2 is ON", called OR. A doorbell that rings from either the front door or the back door button is wired this way.

S1S2LED
OFFOFFOff
ONOFFLit
OFFONLit
ONONLit
B12.2VS1OFFS2ONL120.0 mA−++−
One switch ON: lights
B12.2VS1OFFS2OFFL1−++−
Both OFF: dark

Wiring example from 3-2

If you write "there's a path" as 1 and "no path" as 0, series works like multiplication (1 × 0 = 0), and parallel gives 1 whenever any input is 1. It's the same idea as the AND and OR logic inside a computer.

3. Push buttons: ON only while pressed

A push button connects only while you hold it down and disconnects when you let go (momentary action). Doorbell buttons and computer keys work this way. In contrast, a switch that stays ON after one press and turns OFF with the next, keeping whatever state you set, has maintained action.

B12.2VP1L1−++−
Released: dark
B12.2VP1L120.0 mA−++−
While pressed: lights

Wiring example from 3-3

In ElecLab, press "Run!" to turn on the power, then hold the button down to try it. A switch (such as S1) flips between ON and OFF each time you press it.

4. SPDT switches

An SPDT switch (Single Pole Double Throw) has three terminals. The middle one (com, the common terminal) connects to either a or b, never both. It's used to send one path to one of two destinations.

B12.2VS1L1Red 20.0 mAL2Yellow−+ab+−+−com (common)
At a: com connects to a, so L1 lights
B12.2VS1L1RedL2Yellow 10.0 mA−+ab+−+−com (common)
At b: com connects to b, so L2 lights

Wiring example from 3-4

5. 3-way switches: on and off from either end

On a staircase or in a long hallway, you can turn the same light on and off from the switch at either end. This is called a 3-way switch, and it's made from two SPDT switches.

The key is that flipping either switch always reverses the light. With the version that lights when both switches are on the same side, the switch positions and the light go like this.

S1S2Light
aaOn
abOff
baOff
bbOn

From any row, check that flipping only S1, or only S2, reverses the light. A result that is 1 when the two inputs match is called XNOR (the opposite of XOR) in logic. Wired the other way round, it lights when the switches are on different sides, which is XOR, and either version works as a 3-way switch.

Switches in parallel (OR) or in series (AND) can't produce this table. In parallel, for example, while one switch is ON, flipping the other one never turns the light off. Work out how to run wires between the two switches to get this table in stage 3-4.

Common misconceptions

If I put two switches in parallel, can I turn the light on and off from either one?
No. In parallel (OR), while one switch is ON, the other can't turn the light off. Reversing the light from either switch takes a 3-way switch made from two SPDT switches.
For AND, do the two switches have to sit right next to each other?
No. As long as both switches are in the same single loop, it's AND even with an LED or a resistor between them. Anywhere in the loop works the same (Chapter 1).
Does a push button flip between ON and OFF each time I press it?
ElecLab's push button connects only while pressed and disconnects when released (momentary). It's the switch (such as S1) that flips each time you press it.
Can an SPDT switch connect to both a and b at once?
No. Com always connects to exactly one of a and b.

Try it in the Chapter 3 stages

You can check what you read by actually wiring it up. It runs in your browser with no sign-up.

Start with 3-1Choose a Stage