Switches and Relays
Every circuit needs a way to be turned on and off. A switch does it by hand or by machine. A relay does it with an electromagnet, so that one circuit controls another. This article covers how both are built, how to read their names and ratings, why contacts bounce and spark, how to drive a relay safely, solid-state relays, and the safety rules for switching mains.
A relay is the coil from article 5 put to work. Current through the coil makes a magnetic field, and the field pulls a piece of iron that moves a set of contacts. Everything article 5 said about coils, including the voltage spike when their current is cut, applies to every relay.
About the analogies. Everyday comparisons appear only in shaded "Analogy" boxes beside the real physics, and each box says where the comparison stops working.
Mains switching can kill. Switches and relays are often used on 120 V or 240 V AC. Experiment with low-voltage supplies, and read section 13 before connecting anything to mains.
1. A short recap
- Current flows only around a complete loop, a closed circuit. A break makes an open circuit, and a switch is the deliberate way to make that break. (Recap: what a circuit is.)
- A switch goes in series with what it controls, so the same current flows through both (recap). An open switch has the full supply voltage across it (recap).
- Current through a coil creates a magnetic field, made much stronger by an iron core (recap). Cut a coil's current suddenly and it produces a voltage spike, inductive kickback (recap). A flyback diode tames it (recap).
- A transistor lets a small current switch a larger one (recap).
- Household mains in North America is about 120 V AC at 60 Hz (recap).
2. What a switch is, physically
An electrical switch is any device that interrupts the flow of current. It has two states: closed (on, conducting) or open (off).[1] Every mechanical switch has the same few parts (Figure 1):
- Contacts: the conductive parts that touch to make the connection and separate to break it.[1] Usually one is fixed and one moves.
- The actuator: the lever, button or knob that a person or machine operates.[1]
- A spring that returns or holds the moving contact and presses the contacts together.
- Terminals: the tabs, pins or screws that connect the contacts to the outside.
Contact materials. Contacts are usually silver or a silver alloy, whose conduction is barely affected by surface corrosion. Gold resists corrosion best but carries less current and can "cold weld" if pressed hard.[1] Relay makers use silver-tin oxide where welding is a risk and gold cladding for very small currents.[2]
Contact resistance. Even a closed contact has a little resistance, called its contact resistance.[3] More contact force lowers it.[4] Omron guarantees no more than 0.1 Ω (100 milliohms) for one small relay.[5]
Snap action. In a snap-action switch, a spring flips the contacts over suddenly at a set point, however slowly you move the actuator. That keeps arcs short and reduces wear.[4]
3. Poles and throws
Switches are named by two numbers.[1][3] Poles are the separate circuits the switch controls (the moving contacts). Throws are the positions each pole can connect to (the fixed contacts per moving contact). "Single" means one and "double" two, giving four common types (Figure 2):[6][3]
- SPST (single-pole, single-throw): plain on-off, two terminals. A flashlight switch.
- SPDT (single-pole, double-throw): one common terminal connected to either of two others, three terminals. A vacuum cleaner's low/high speed switch.
- DPST (double-pole, single-throw): two on-off switches on one actuator, four terminals. In an air conditioner, one pole for the chiller and one for the fan.
- DPDT (double-pole, double-throw): two SPDT switches ganged together, six terminals. A hair dryer's heat and fan speed.
The common terminal (COM) connects to the moving contact. Rotary switches can have many throws: "single-pole, five-throw" is five positions on one pole.[1] A multi-position switch either opens the old connection before making the new one (break-before-make, the usual kind) or briefly bridges both (make-before-break), used where the circuit must never be open even for an instant.[1]
4. Momentary or maintained; normally open or closed
A maintained (latching) switch stays where you put it, like a wall light switch. A momentary switch is active only while held, like a doorbell button, and a spring returns it.[6][1] Some pushbuttons latch on and off with alternate presses.[1]
A switch's normal state is its state with nothing pressing on it, as it sits on the shelf. A normally open (NO) contact closes when actuated. A normally closed (NC) contact opens when actuated (Figure 3).[1] "Normal" does not mean "usual": a limit switch may sit pressed all day, but its labels still describe it unpressed. For relays, NO and NC describe the contacts with the coil unpowered.[7]
5. Kinds of switch
- Toggle: a lever resting in one of two or more positions. A household wall switch is one.[1]
- Rocker: a see-saw actuator pressed at one end, made in sizes from miniature to industrial.[3]
- Slide: a knob moved in a straight line, often for on-off or mode selection.[3]
- Pushbutton: pressed and released. Most are momentary.[1]
- Tactile ("tact") switch: a tiny board-mounted pushbutton. A springy metal dome over two contacts collapses when pressed, joining them with a click you can feel.[8][3]
- DIP switch: a row of tiny switches in one package, used to set options on a circuit board.[6][3]
- Rotary (selector): a knob that picks one of many positions, like a multimeter's range dial.[6][1]
- Limit switch: operated by a moving machine part, often to stop a motion that has gone far enough. The lever often has a roller tip.[1]
- Micro switch (snap-action switch): small, needs little force, and snaps over with a sharp click.[3][4]
- Reed switch: two thin nickel-iron blades sealed in glass. A nearby magnet pulls them together.[9][1] Sealed contacts cannot corrode, and switching under 5 V at 10 mA, a reed switch can last billions of operations.[9]
Switching one light from two places
A staircase light uses two 3-way switches, the electrician's name for SPDT switches. Two wires called travelers join their throws. The lamp is on when both switches select the same traveler and off when they differ, so flipping either one changes the state (Figure 4). For more locations, 4-way switches go between them; each connects the travelers straight through or crossed.[10]
6. Ratings: voltage, current, AC and DC
Every switch and relay has a maximum voltage and current. Three things limit a contact: heat from current through it when closed, sparking as it opens or closes, and the voltage across the open gap.[1] A heavy-duty toggle switch might be rated 2 A at 250 V or 4 A at 125 V.[6]
Why DC is harder to break than AC
As contacts part, current can keep flowing through hot, ionized air in the gap: an arc, which burns the contacts. With AC the arc tends to go out by itself, because 60 Hz current stops and reverses 120 times a second. DC never passes through zero, so a DC arc can keep burning (Figure 5). Switches are therefore rated higher for AC than DC.[1][4]
The Omron G5LE power relay can switch 250 V AC but only 125 V DC. Its resistive rating is 10 A at 120 V AC but 8 A at just 30 V DC.[11] Never apply an AC rating to a DC load. (Recap: AC mains.)
Inductive loads such as motors and solenoids make arcing worse: as the contacts open, the coil drives its current on and the voltage across the gap jumps.[1] That is article 5's kickback again. The G5LE's AC rating halves to 5 A for an inductive load.[11]
Inrush current. Some loads draw much more current for a moment at switch-on: 10 to 15 times the running current for an incandescent lamp, 5 to 10 times for a motor, 20 to 40 times for a capacitive load.[2] A 60 W, 120 V bulb draws 0.5 A once lit but could draw 5 to 7.5 A at switch-on (calculated). Lamps, motors and solenoids can weld contacts, melting them together so they stay closed.[2]
Snubbers and wetting current
A snubber, a capacitor and resistor in series across the contacts, reduces arcing. The capacitor absorbs the voltage rise as the contacts open, and the resistor limits its discharge current when they close. Old car ignition points used one, called a condenser.[1] Panasonic suggests starting at 0.5 to 1 µF per amp and 0.5 to 1 Ω per volt.[2] (Recap: RC circuits.)
Too little current is also a problem. A small spark at each operation cleans the film that forms on contacts. The minimum current that keeps a contact healthy is its wetting current; for tiny signals, choose gold contacts.[1] The gold-alloy G5V-1 relay is specified down to 1 mA at 5 V,[5] the silver-alloy G5LE only to 100 mA.[11]
7. Contact bounce and debouncing
Closing contacts hit, spring apart and hit again several times before settling. This contact bounce lasts milliseconds, too short to see on a lamp.[1] A microcontroller is fast enough to see every bounce and count one press as many (Figure 6).
Jack Ganssle tested 18 switches. They bounced for 1.6 ms on average and up to 6.2 ms, excluding two poor ones, one of which bounced for 157 ms on release. A relay bounced for 0.4 to 2.9 ms.[12] Removing the bounce is debouncing:
- Hardware. An RC low-pass filter smooths the bounces into a slow rise or fall. A Schmitt trigger, an input that switches at a higher voltage going up than going down, turns that into one clean step.[1][13] Ganssle warns against feeding the RC voltage straight into a processor pin without one.[13] Make RC longer than the bounce: 10 kΩ and 1 µF give 10 ms (calculated; recap: the time constant).
- Software. Read the switch every few milliseconds and accept a new state only after it has been steady for a set time. Ganssle suggests 20 to 50 ms. Most bounce is under 10 ms, and 50 ms still feels instant. Never wire an undebounced switch to an interrupt.[13]
A button on a microcontroller input also needs a pull-up resistor from the pin to the supply, with the switch from the pin to ground. Open, the pin reads high; pressed, low. The resistor stops the closed switch shorting the supply.[6] More in the Microcontrollers pages.
8. Relays: a switch moved by a coil
A coil that pulls a movable piece of iron is a solenoid, and the moving piece is the armature. A relay is a solenoid whose armature moves switch contacts.[7] It builds directly on article 5's coil and magnetic field, which listed relays among a coil's uses.
How a relay is built
A typical relay has a coil of fine copper wire on an iron core; a hinged iron armature held off the core by a spring; and contacts: a moving common contact on the armature, a fixed NC contact it rests on, and a fixed NO contact it moves to (Figure 7).[7][14] Power the coil and the core pulls the armature in, so COM leaves NC and touches NO. Remove the power and the spring pulls it back.[7] You can usually hear the click.
Two things make relays useful. A small coil current controls a much larger contact current: Kuphaldt's example has a 12 V DC coil switching 480 V AC, with coil currents typically well under 1 A and industrial contacts rated at least 10 A. And the coil and contacts are electrically isolated, sharing no wires.[7] The G5V-1 withstands 1,000 V AC between coil and contacts, the G5LE 2,000 V AC.[5][11]
Analogy: a doorbell for a floodgate. A light press on a small button gets a heavy gate opened on a completely separate channel, and the person pressing never touches the water.
Where it breaks down: a doorbell button does not fight back when released. A relay coil stores energy in its magnetic field and kicks back a voltage spike when its current is cut, so the control side needs protection. And the "gate" is not perfect: contacts arc, wear and can weld.
Coil voltage and current
A relay is chosen by its rated coil voltage. The 5 V G5V-1 has a 167 Ω coil drawing 30 mA, about 150 mW;[5] by Ohm's law, 5 V ÷ 167 Ω ≈ 30 mA (calculated). It also comes with 3 to 24 V coils; the 12 V version is 960 Ω and 12.5 mA.[5] Coil resistance is specified at 23 °C, ±10 percent.[5] Copper's resistance rises about 0.4 percent per °C, so a hot coil needs more voltage to operate.[2]
Pick-up and drop-out
The armature needs a minimum coil current to pull in, the pick-up (pull-in) value. Once in, close to the core, it needs much less to stay, so the current must fall well below pick-up before it drops out. The gap between the two is hysteresis.[7] The G5V-1 is guaranteed to operate by 80 percent of rated voltage (4.0 V) and to release below 10 percent (0.5 V) (Figure 8).[5] In between, its state depends on the individual relay and on its history, so drive the coil at its rated voltage and switch it fully off.
Contact ratings, life and speed
Relay contacts follow all of section 6. The G5V-1 signal relay is rated 0.5 A at 125 V AC or 1 A at 24 V DC; the G5LE power relay, 10 A at 120 V AC.[5][11] Datasheets give a mechanical life with no load and a shorter electrical life at full load: 5,000,000 and 100,000 operations for the G5V-1. It takes up to 5 ms to operate and 5 ms to release.[5]
Driving a relay from a microcontroller
A microcontroller pin cannot safely supply a coil's 30 mA, so a transistor does it (Figure 9). Article 7 worked this example: a 2N3904 with a 1.2 kΩ base resistor switches a 5 V G5V-1 from an Arduino pin, as a low-side switch between coil and ground. A logic-level MOSFET can do the same (recap).
When the transistor turns off, the coil's kickback can destroy it (recap). A flyback diode across the coil, band (cathode) toward the positive supply, gives the current a loop to die away in (recap). Panasonic calls the diode absolutely necessary in a transistor-driven relay circuit. It slows the release to 2 to 5 times the catalog time; a Zener diode in series with it shortens that.[2]
The contacts form a separate circuit. In Figure 9 they switch a 12 V lamp on its own supply, sharing no wire with the microcontroller.
Latching relays
An ordinary relay is on only while its coil is powered. A latching relay stays in its last position with the coil unpowered; a pulse sets it and another resets it. One-coil types use pulses of opposite polarity; two-coil types have separate set and reset coils.[2] They save power, but the circuit must set a known state at power-up.
Reed relays
A reed relay is a reed switch inside a coil, sometimes with a built-in flyback diode; the coil's field replaces the magnet.[15] Its sealed contacts have a very long mechanical life, especially when switching small signals.[15][9]
Contactors
A relay built to switch large power is a contactor. Its contacts are usually normally open, so the load is off whenever the coil is. Its commonest job is starting motors, with three main contacts for a three-phase supply, often 480 V or more, plus a small auxiliary contact for the control circuit.[7]
9. Solid-state relays
A solid-state relay (SSR) has no moving parts (Figure 10). Its input drives an LED whose light crosses an insulating gap to a light-sensitive device; together they form an optocoupler, which provides the isolation. That device switches the output semiconductor:[7][16][14]
- a triac or thyristor, for AC loads only. A triac conducts both ways and stops by itself when the AC current passes through zero;
- a power transistor, for DC loads; or
- power MOSFETs driven by tiny photodiodes, for AC or DC (a MOSFET relay).
Advantages. No contacts to wear, no sparking, no noise, and faster switching.[7][16] Omron quotes about 0.2 ms for a MOSFET relay against 3 to 5 ms for a mechanical one.[14] Zero-cross SSRs turn on only near the point where the AC voltage passes through zero, and a triac turns off when the current does, avoiding spikes and electrical noise.[7][16]
Disadvantages.
- Leakage. An "off" SSR still passes a small current, partly through its built-in snubber, enough to make a small lamp glow; a bleeder resistor across the load can help.[16] One Omron SSR may leak 10 mA at 200 V.[17] MOSFET relays leak at most microamps, and mechanical relays none.[16]
- Heat. An SSR that is on drops a volt or two, which times the current is heat: 1.6 V × 8 A = 12.8 W in Omron's example, needing a heat sink.[17]
- Failure. SSRs tend to fail shorted (stuck on); mechanical contacts tend to fail open.[7] A shorted triac accounts for 80 percent of the SSR failures in Omron's table.[16]
- Limits. SSRs are expensive at very high currents,[7] and a triac SSR cannot switch DC.[16]
10. Transistor, relay or SSR?
| Transistor or MOSFET | Electromechanical relay | Solid-state relay | |
|---|---|---|---|
| Isolation between control and load | None; grounds are joined (recap) | Yes, coil to contacts[7] | Yes, through the optocoupler[16] |
| Speed | Microseconds (recap) | Milliseconds[5] | About 0.2 ms (MOSFET relay)[14] |
| Wear | No moving parts | About 100,000 operations at full load[5][11] | No contacts to wear[16] |
| Off-state leakage | Small | None[16] | Up to milliamps[17] |
- Transistor or MOSFET: low-voltage DC loads sharing the controller's ground, especially fast or frequent switching such as LED strips, small motors and relay coils (recap).
- Relay: isolated loads such as mains, several poles or changeover contacts, AC or DC loads, or a true open circuit with no leakage. Omron says self-holding circuits must use mechanical relays.[17]
- SSR: frequent, silent switching of AC loads such as heaters, where contacts would wear out, with a heat sink.[16][17]
11. Testing switches and relays
Test with the power off and the part isolated from the rest of the circuit.[18]
- Continuity. In continuity mode, a multimeter beeps when there is a complete path between its probes.[18] A switch should beep when closed and stay silent when open. Check every terminal pair, such as COM–NO and COM–NC, on every pole.
- Contact resistance. A good closed contact reads close to zero ohms; datasheet limits are in milliohms (100 mΩ for the G5V-1).[5] Several ohms, or a reading that wanders as you work the switch, means dirty or worn contacts.
- Relay coil. A 5 V G5V-1 should read about 150 to 184 Ω (167 Ω ±10 percent, calculated; more when warm).[5] An open reading means a broken winding.
- Listen for the click. Apply the rated coil voltage from a current-limited bench supply. A good relay clicks on and clicks off. While energized, COM–NO should beep and COM–NC should not; a click proves only that the armature moved. Raising the voltage slowly shows the pick-up point, which should be no higher than 4.0 V for a 5 V G5V-1.[5]
- In a low-voltage working circuit, an open switch reads the full supply voltage across it and a closed one nearly zero (recap).
12. Everyday uses
- Wall switches and 3-way staircase switches.[10]
- Appliance switches in flashlights, vacuum cleaners, air conditioners and hair dryers.[3]
- Micro switches and limit switches stopping machine motion.[1][3]
- Tactile switches in handheld devices and on circuit boards; DIP switches setting options.[3]
- Relays letting a controller switch a lamp, pump or heater; time-delay relays sequencing a backup generator's start-up; contactors starting motors.[7]
- SSRs switching heaters on and off every few seconds for years of temperature control.[16]
13. Safety
Use parts rated for the job. Anything that switches mains must be rated for that voltage and current, with AC ratings for AC loads. (Recap: household AC and mains safety.)
Contacts can weld. Inrush from lamps, motors and capacitive loads can weld contacts shut, so "off" does nothing.[2] Choose relays with margin, and never rely on one relay alone to stop something dangerous.
An "off" SSR is not isolation. Current leaks through an off SSR and its snubber, so Omron says to turn off the input and load power and check that it is safe before wiring or replacing one.[16] Some leak up to 10 mA.[17] For comparison, 1 mA can be felt, many safety rules take 5 mA as the limit, and 10 to 20 mA can make muscles clamp so a person cannot let go.[19] Because SSRs usually fail shorted, Omron advises a contactor or circuit breaker on the load supply that can cut power if the SSR fails, never the SSR alone.[16]
Never trust a switch alone. Contacts weld and SSRs fail shorted, so a device's on-off switch is not a safety disconnect. Kuphaldt says the disconnect should be separate from the regular switch and used only to make the system safe.[20] Before working on wiring:
- Turn off the breaker or remove the fuse for the circuit, not just the switch.
- Lock and tag it. OSHA's first step is to turn off the current at the switch box and padlock it off, "even on so-called low-voltage circuits".[21]
- Prove it dead with a tester you have just checked on a known live circuit; Kuphaldt says to double-check after locking out.[20] (Recap: lockout and proving dead.)
Relay coils kick back. Fit every transistor-driven DC relay coil with a flyback diode.[2]
The whole story in brief
- A switch opens or closes a circuit with contacts moved by an actuator. Contacts are usually silver alloy, with gold for tiny currents.
- Poles are separate circuits; throws are positions per pole: SPST, SPDT, DPST, DPDT. NO and NC describe contacts at rest.
- DC is harder to break than AC because a DC arc never passes through zero. Inductive and inrush loads need extra margin.
- Contacts bounce for milliseconds. Debounce with RC plus a Schmitt trigger, or in software over 20 to 50 ms.
- A relay is a coil pulling an armature that moves contacts, giving isolation and a small current controlling a large one. Drive it with a transistor and a flyback diode.
- SSRs are silent and wear-free, but leak when off, heat up when on and usually fail shorted.
- To make a circuit safe, switch off, lock and tag the breaker, and prove it dead.
Coming up in this section: 13 Batteries and Cells.
Sources
- Tony R. Kuphaldt, Lessons In Electric Circuits, Volume IV (Digital), chapter 4, "Switches": https://www.ibiblio.org/kuphaldt/electricCircuits/Digital/DIGI_4.html
- Panasonic Industry, "Relay Technical Information" (PDF): https://industry.panasonic.eu/storage/custom-upload/Components/Relays/technical_information_relay_en.pdf
- E-Switch, Switches: A Comprehensive Guide (switch whitepaper, version 5.0, PDF): https://www.e-switch.com/wp-content/uploads/2025/07/Switch-Whitepaper-v5.0.pdf
- Omron Electronic Components, "Switches: Technology" (basic knowledge): https://components.omron.com/us-en/products/basic-knowledge/switches/technology
- Omron, G5V-1 low-signal relay datasheet (PDF): https://omronfs.omron.com/en_US/ecb/products/pdf/en-g5v_1.pdf
- SparkFun Electronics, "Button and Switch Basics": https://learn.sparkfun.com/tutorials/button-and-switch-basics/all
- Tony R. Kuphaldt, Lessons In Electric Circuits, Volume IV (Digital), chapter 5, "Electromechanical Relays": https://www.ibiblio.org/kuphaldt/electricCircuits/Digital/DIGI_5.html
- Adafruit Learning System, "Make It Switch" (all pages): https://learn.adafruit.com/make-it-switch?view=all
- Standex Detect, "Reed Switch Operational Characteristics" (Reed Technology Academy): https://standexdetect.com/resources/reed-technology-academy/reed-switch-characteristics/reed-switch-operational-characteristics/
- Brian Matthews, Wake Forest University, "Tutorial: 3-Way Switches and 4-Way Switches": https://www.matthews.sites.wfu.edu/courses/p230/switches/SwitchesTut.html
- Omron, G5LE PCB power relay datasheet (PDF): https://omronfs.omron.com/en_US/ecb/products/pdf/en-g5le.pdf
- Jack G. Ganssle, "A Guide to Debouncing" (part 1, switch bounce measurements): http://www.ganssle.com/debouncing.htm
- Jack G. Ganssle, "A Guide to Debouncing, Part 2: Solutions": http://www.ganssle.com/debouncing-pt2.htm
- Omron Electronic Components, "Relays: Basics" (basic knowledge): https://components.omron.com/us-en/products/basic-knowledge/relays/basics
- Pickering Electronics, "Introduction to Reed Relay Basics (Part 1)": https://www.pickeringrelay.com/introduction-reed-relay-basics-part-1/
- Omron, Technical Guide for Solid-state Relays (PDF): https://files.omron.eu/downloads/latest/manual/en/csn_ssr_tg_technical_manual_en.pdf
- Omron, Solid State Relays Guide Book (PDF): https://edata.omron.com.au/eData/Relays/Y108-E1-1.pdf
- Fluke, "A Guide to Continuity Testing with a Multimeter": https://www.fluke.com/en-us/learn/blog/digital-multimeters/how-to-test-for-continuity
- OpenStax, College Physics 2e, section 20.6, "Electric Hazards and the Human Body": https://openstax.org/books/college-physics-2e/pages/20-6-electric-hazards-and-the-human-body
- Tony R. Kuphaldt, Lessons In Electric Circuits, Volume I (DC), chapter 3, "Electrical Safety": https://www.ibiblio.org/kuphaldt/electricCircuits/DC/DC_3.html
- U.S. Occupational Safety and Health Administration, Controlling Electrical Hazards (OSHA 3075, PDF): https://www.osha.gov/sites/default/files/publications/OSHA3075.pdf