Skip to content
Electronics Basics

Switch Types Explained: Pushbutton, Toggle, DIP, Microswitch and On/Off

12 min readBeginner

A switch changes an electrical connection. That sounds simple, but switches differ in how they move, whether they stay in the selected state, which contacts they connect, and how much voltage or current they can safely interrupt. Choosing the correct switch starts with the circuit behavior you need—not just whether the part looks like a button or lever.

Normally open and normally closed contacts in their resting state; verify the exact part's terminal diagram.

Two different classifications: action and contacts

First decide what the user should experience.

  • A momentary switch changes state only while pressed or held. A tactile pushbutton is a common example; it springs back after release.
  • A latching switch stays in its new state after actuation. A toggle, rocker or many panel on/off switches are latching.
  • A normally open (NO) contact is open when the actuator is in its normal, unpressed state.
  • A normally closed (NC) contact is closed in the normal state.
  • A changeover contact moves a common terminal between two contacts, often marked COM, NO and NC.

“Normally” refers to the mechanical resting condition described by the manufacturer, not necessarily the way your project displays “on” and “off”. A microcontroller can invert the logic in software.

SPST, SPDT and DPDT explained

The contact label tells you how many poles and throws a switch has. A pole is an independently switched circuit; a throw is the contact path it can select.

TypeMeaningExample use
SPSTSingle pole, single throwSimple on/off connection
SPDTSingle pole, double throwSelect one of two signals or route a common terminal to NO/NC
DPSTDouble pole, single throwSwitch two separate conductors together, if the part is rated for the application
DPDTDouble pole, double throwReverse polarity to a small DC motor or change two circuit paths

A switch's number of poles does not increase its current rating. Each contact path still has a maximum voltage, current and load category. Inductive loads such as motors and solenoids can arc at opening because stored energy must go somewhere.

Common physical switch types

Pushbutton switch

Pushbuttons are used for user input, reset, start/stop and menu controls. The contact can be momentary NO or NC, or the pushbutton may be mechanically latching. Small PCB tactile switches often have four legs but only two electrical nodes: each pair on one side is already connected internally, and pressing joins the two sides. Check the datasheet or test continuity before assuming the pin layout.

Toggle switch

A toggle lever stays in one position and usually provides a clear mechanical indication of state. Versions include SPST, SPDT, centre-off and multi-pole variants. It is useful for selecting modes or switching low-voltage power when its DC rating is adequate.

Rocker and slide switches

A rocker is common in appliance panels, power-entry areas and enclosures. A slide switch moves a small actuator across positions and is often used for mode selection on compact equipment. Both are available in latching, multi-pole and multiple-throw forms. A small PCB slide switch is not automatically suitable for switching a motor or supply rail.

DIP switch

A dual-inline-package (DIP) switch contains several tiny independent switches in one package. It is used for address bits, configuration options and legacy device settings. A four-position DIP switch can represent four binary options, but it does not encode a protocol or address unless the firmware interprets each position that way. Read the ON marking carefully; it usually points to the closed state, but confirm the manufacturer's diagram.

Microswitch or snap-action switch

A microswitch uses a spring mechanism to change contacts quickly after the actuator reaches a trip point. It is often used for limit detection, door interlocks, end stops and mechanical position sensing. Lever and roller-lever variants change the actuator geometry. Select operating force, travel, differential travel, mechanical life and contact rating for the actual application. Do not use a low-cost microswitch as a certified safety interlock unless its approvals and complete system design support that use.

Reed switch

A reed switch uses a magnetic field to open or close contacts. It appears in door/window sensors, float switches and simple rotation counters. It is useful when the moving object should not need a wired contact, but the magnet alignment and contact bounce still matter.

Wiring a switch to an Arduino Uno or ESP32

A common method for a simple digital input is to connect one side of a normally open button to ground and the other side to a microcontroller GPIO configured with INPUT_PULLUP. The input reads HIGH when open and LOW while pressed. This works because the internal pull-up weakly holds the input HIGH; pressing the button pulls it to ground.

const int BUTTON_PIN = 2; // Uno D2; choose a suitable GPIO on ESP32

void setup() {
  Serial.begin(115200);
  pinMode(BUTTON_PIN, INPUT_PULLUP);
}

void loop() {
  bool pressed = (digitalRead(BUTTON_PIN) == LOW);
  if (pressed) {
Serial.println("Button pressed");
  }
  delay(10); // demonstration only; not a complete debounce strategy
}

For an ESP32, keep the input at 3.3 V logic and select a GPIO available on your exact board. Do not feed a 5 V switch signal into an ESP32 GPIO. In a basic passive button circuit, the switch should connect the pin to ground or to a safe logic supply, not to an unrelated voltage source.

Debouncing: why one press can look like many

Mechanical contacts do not always change cleanly once. As two metal contacts meet, they can bounce for several milliseconds, creating several rapid transitions. A program may interpret this as multiple button presses or false pulse counts.

There are three common responses:

  1. Software time filtering: accept a new state only when it remains stable for a chosen interval, often several milliseconds for a hand-operated button.
  2. State-machine debounce: track the raw input and only change the logical state after a stable period. This is better than putting long delays in a loop that must do other work.
  3. Hardware filtering: an RC network and, where needed, a Schmitt-trigger input can reduce chatter. Component values and thresholds must match the input's electrical requirements.

Avoid using simple delay-based examples in timing-sensitive motor or encoder applications. A microswitch detecting a fast rotating cam and a button pressed by a person may need very different filtering.

Reading a DIP switch as a binary option

A DIP switch typically provides one contact per position. With each input using a pull-up and each switch connecting to ground, the firmware can read a bank of configuration bits. If a bank contains four switches, there are 16 possible combinations, although your design should reserve invalid combinations where appropriate. Document the ON/OFF direction and provide a default state so floating inputs cannot randomly change the device configuration.

Electrical ratings and safety

Check the manufacturer's datasheet for AC and DC ratings separately. A switch advertised for 250 VAC may have a much lower DC switching capability because DC has no natural zero-crossing to help extinguish an arc. Also check inrush current, inductive-load rating, insulation spacing, temperature and enclosure requirements. When switching a motor, solenoid or relay coil, use a properly rated driver and suppression network where required. Do not route hazardous mains voltage onto a breadboard or student project switch without appropriate engineering, enclosure, isolation and qualified supervision.

Choosing a switch: a practical checklist

  • Behavior: momentary or latching; NO, NC or changeover.
  • Contact configuration: SPST, SPDT, DPST or DPDT.
  • Load: voltage, normal current, inrush, DC versus AC, and whether the load is inductive.
  • Mechanics: actuator style, mounting dimensions, force, travel and durability.
  • Environment: dust, moisture, vibration, operating temperature and required ingress protection.
  • Interface: logic voltage, pull-up or pull-down, debounce method and safe default state.
  • Compliance: required approvals and safety classification for the actual end product.

Troubleshooting switch inputs

SymptomPossible causePractical check
Input changes randomly while untouchedFloating pin, poor ground or long wireEnable a suitable pull-up/down and inspect wiring
Button appears permanently pressedNO/NC assumption is reversed or wrong legs are usedTest continuity in resting and actuated states
One press causes repeated eventsContact bounceAdd a debounce filter or appropriate hardware filter
DIP settings read backwardsFirmware assumes ON means HIGHConfirm wiring and invert logic if needed
Switch heats or arcsLoad exceeds contact rating or has high inrushVerify DC/AC and load ratings; use a suitable driver
Microswitch misses a limitWrong lever, travel, alignment or operating forceCheck mechanical dimensions and the switch datasheet

Related guides

For reading switches in software, see ESP32 GPIO Input vs Output, Arduino PWM control, and transistors and MOSFETs. For load switching, use a properly rated relay module or solid-state driver rather than drawing load current from a microcontroller pin.

Further reading: Omron basic switch technical guide and the exact switch manufacturer's datasheet.

Contact examples: what a meter should show

Before wiring an unfamiliar switch, disconnect it from power and use the continuity or resistance mode of a multimeter. For a simple SPST normally-open pushbutton, the contacts should be open at rest and close when pressed. For an SPDT changeover switch, the common terminal should connect to one throw in one position and to the other throw in the opposite position. A microswitch with COM, NO and NC markings should show continuity from COM to NC at rest and from COM to NO after the actuator passes its operating point, unless its datasheet defines a different mechanism.

Do not infer terminal location from the outside shape. Different pushbuttons that look identical can have different contact blocks, built-in LEDs or latching mechanisms. Built-in illumination may have separate LED pins and may require its own current-limiting resistor or specified voltage.

Example: using a normally closed limit switch

A normally closed switch can be useful for detecting a broken wire as well as an actuated end stop: wire the contact into a defined input circuit and treat an unexpected open state as a fault. That behavior is not automatically fail-safe; a shorted cable, a stuck contact or a software bug can still conceal a fault. For a machine guard or safety interlock, use a certified device and a safety-rated system rather than relying on a hobby GPIO input.

For a non-safety-critical, low-voltage position indicator, a pull-up input can read a switch connected to ground. Decide intentionally which state represents “normal,” what should happen after a disconnected wire, and what startup state the firmware uses. Write the truth table before coding so the wiring, logic polarity and status labels agree.

Debounce checklist for a reliable user interface

A useful debounce routine samples the raw pin regularly and changes the logical state only after the new value has remained stable for a chosen interval. It should update from timestamps rather than blocking all other work with a delay. This matters if the same microcontroller also samples a sensor, services Wi-Fi or controls a motor. The interval is not a universal constant: a mechanical pushbutton and a high-speed microswitch can have different bounce patterns, and a hardware filter may be needed when cable noise is significant.

Finally, verify the switch's specified DC load rating for the load you will actually switch. Do not interpret a high AC rating as permission to break the same current at DC, and do not assume a low-voltage signal rating covers an inductive load.

Choose the failure behavior before choosing the switch

A common design question is whether a device should use a normally-open or normally-closed contact. For a simple door-open indicator, either can work if the firmware interprets it correctly. For detecting a broken wire, a normally-closed loop may expose some faults because an open circuit looks different from its normal state. However, neither arrangement automatically creates a safety function: welded contacts, a short across the cable, a failed input or firmware faults may still prevent detection.

Write a small truth table before wiring a switch into a controller.

Physical conditionExample NC-loop readingFirmware response
Switch at rest, wire intactClosed/defined input stateNormal
Switch actuatedContact opensReport end-stop/door event
Wire disconnectedOften also opensReport fault or event, according to application
Contact shorted or bypassedMay look normalMay be undetectable with one simple input

The application decides which state is safe. A hobby end stop can simply stop a motor in software, but a machine guard or emergency stop requires a correctly rated, safety-designed circuit and validation by qualified personnel. Do not replace that system with a single switch connected to an Arduino pin.