Switches and Relays
From the humble light switch to the electromagnet that flips a switch for you.
The question
How can a small battery circuit control a separate circuit without the two ever touching?
What you’ll discover: the different kinds of switches, how a relay works, and why relays need a protecting diode.
In simple terms
BeginnerGaps you control
A switch is a controlled gap in a circuit. Close it and current flows; open it and it stops. Switches come in many styles:
- Toggle and slide switches stay where you put them, like a light switch.
- Pushbuttons (momentary switches) only work while you hold them down, like a doorbell. A “normally open” button connects when pressed; a “normally closed” one disconnects when pressed.
- Reed switches close when a magnet comes near. Many door and window alarm sensors use them.
Poles and throws
Switch catalogues use short codes. The pole count is how many separate circuits the switch controls; the throw count is how many positions each pole can connect to.
| Code | Meaning | Example |
|---|---|---|
| SPST | Single pole, single throw: simple on/off | A basic light switch |
| SPDT | Single pole, double throw: switches one wire between two paths | Choosing between two LEDs |
| DPDT | Double pole, double throw: two SPDT switches moved together | Reversing a motor’s direction |
Relays
A relay is a switch flipped by an electromagnet. A small current through the relay’s coil makes a magnetic field that pulls a metal arm, closing (or opening) a separate set of contacts. The coil circuit and the contact circuit are not electrically connected at all, which is called isolation.
That’s how a car’s small dashboard switch can control a powerful headlight circuit, and how a thermostat switches a furnace on.
Go deeper
IntermediateDriving a relay safely
Most small relay coils need more current than a microcontroller pin or sensor can supply, so a transistor does the switching: the coil goes between + and the transistor’s collector, just like the LED in the night light.
The flyback diode: when the current through a coil is suddenly switched off, the collapsing magnetic field produces a voltage spike far higher than the supply. That spike can destroy the transistor. A diode such as a 1N4001 placed across the coil, with its stripe toward the + side, does nothing in normal operation but gives the spike a harmless path.
AdvancedContact ratings and switch bounce
Relay and switch contacts have ratings for voltage and current, often different for AC and DC, because DC arcs are harder to break. Exceed them and the contacts burn or weld shut.
Mechanical contacts also bounce: for a few milliseconds after closing, they make and break contact several times. A light doesn’t care, but a digital counter might count one press as ten. Circuits debounce with a capacitor, a timing chip, or a short delay in software (Stage 4).
Try it
Swap the switch in My First LED Circuit for a reed switch (a small glass tube with two wires). Bring a fridge magnet close and the LED lights; pull it away and it goes out. Handle reed switches gently: the glass breaks easily.
Quick check
What does SPDT stand for?
Single pole, double throw.
What is the advantage of a relay’s isolation?
The control circuit and the switched circuit don’t connect electrically, so a small, safe circuit can control a separate one.
Which way round does a flyback diode go across a relay coil?
With its stripe (cathode) toward the + side of the coil.
Words to know
- Momentary switch
- A switch that only works while held, like a pushbutton.
- Relay
- A switch operated by an electromagnet.
- Isolation
- No electrical connection between two circuits.
- Switch bounce
- Rapid on-off flickering of mechanical contacts as they close.
Learn more
- Science World (Vancouver): Current Electricity: eight hands-on circuit activities
- Lesson 9: Diodes
- Next: Sensors
Electronics School is part of the Discovery Zone. Every activity here runs on small batteries or a USB cable: never wall outlets. The one plug-in tool is the optional soldering iron, set up by an adult.