Ugenz Academy/IoT Tutorial

Switches And Buttons

12 min read2,376 words

Reading progress

Keep learning

Switches and Buttons

1. Introduction to Switches and Buttons

A switch is an electrical component used to open, close, or change the path of an electrical circuit. It controls the flow of current by changing the electrical connection between two or more terminals.

A button is a control that a person presses to operate a device. In electronics, buttons often use momentary switches, which return to their original state when released.

Switches and buttons are used in almost every electronic system, including lights, fans, computers, mobile devices, remote controls, Arduino projects, and industrial machines.

Example: A wall switch controls a room light, while a push button on a doorbell activates the doorbell only while the button is pressed.

2. Basic Working Principle of a Switch

A switch controls a circuit by changing the connection between its contacts.

There are two basic states.

A. Open Switch (OFF)

Simple open and closed electric circuit vector illustration for education

An open switch breaks the electrical path. In a simple DC circuit, current cannot flow through that path, so the bulb remains OFF.

  • Circuit path: Incomplete
  • Current through the open switch: Ideally zero
  • Example: A light switch in the OFF position

B. Closed Switch (ON)

Different Types of Electric Circuits – Robocraze

robocraze.com

A closed switch completes the electrical path, allowing current to flow through the circuit when a voltage source is present.

  • Circuit path: Complete
  • Current: Flows according to the circuit's voltage and resistance
  • Example: A light switch in the ON position

For a simple resistive circuit, Ohm's law describes the current:

I=VRI=\frac{V}{R}

Where:

  • II = current in amperes (A)
  • VV = voltage in volts (V)
  • RR = total circuit resistance in ohms (Ω\Omega)

An ideal closed switch has zero resistance, while an ideal open switch has infinite resistance. Real switches have small contact resistance and may have leakage or other non-ideal effects.

3. Difference Between Switches and Buttons

The words switch and button are sometimes used interchangeably, but they describe different aspects of a control.

FeatureSwitchButton
MeaningAn electrical switching deviceA control designed to be pressed
Typical operationMay stay in its selected position or return automaticallyOften returns when released
State after releaseDepends on the switch mechanismUsually returns to its normal state
ExamplesToggle switch, rocker switchPush button, tactile button
Common usesPower control and mode selectionStart, stop, reset, and input signals

A push button can operate a latching mechanism, and a switch can be momentary. The actual behavior depends on its design.

4. Types of Switches

A. Toggle Switch

SCI MTE101A1 Sub Miniature Toggle Switch SPST | Rapid Electronics

rapidonline.com

A toggle switch uses a small lever that moves between positions. Many toggle switches remain in the selected position until moved again.

Applications:

  • Power ON/OFF control
  • Selecting operating modes
  • Electronic projects
  • Laboratory equipment

For example, a two-position toggle switch can turn a DC circuit ON or OFF.

B. Rocker Switch

Power switch

tumble-bee.com

A rocker switch has a surface that tilts when pressed on one side. It is commonly used for power control in appliances and electronic equipment.

Applications:

  • Power supplies
  • Extension boards
  • Household appliances
  • Computer equipment

Some rocker switches include indicator lights to show their operating state.

C. Push-Button Switch

Schneider / XB2BA42C / Red / Flat Push Button w/ Contact Block / Metal – HAMMERHEAD INDUSTRIAL

hammerheadindustrial.com

A push-button switch operates when pressed. It may be momentary or latching, depending on the mechanism.

A momentary push button returns to its normal state after it is released.

Applications:

  • Start and stop controls
  • Doorbells
  • Reset controls
  • Microcontroller inputs

D. Tactile Switch

Push Button 6X6 - 4 Pins

circuits-elec.com

A tactile switch is a small push-button switch that produces a noticeable click or tactile sensation when pressed.

It commonly has four physical legs, although many four-pin versions internally contain only two electrical terminals, with the legs paired together.

Applications:

  • Keyboards
  • Calculator buttons
  • Remote controls
  • Arduino and ESP32 projects

E. Slide Switch

A slide switch changes its electrical connection by moving a small slider. It commonly remains in the selected position.

Applications:

  • Small electronic devices
  • Battery-powered circuits
  • Mode selection
  • Electronic toys

Some slide switches have two positions, while others have three or more.

F. Rotary Switch

3P4T 3 Pole 4 Position Single Wafer Band Selector Rotary Switch w Knob | Daraz.com.bd

daraz.com.bd

A rotary switch changes connections by rotating a knob. It can select one of several circuits or operating modes.

Applications:

  • Selecting measurement ranges
  • Audio equipment
  • Test instruments
  • Multi-mode electronic devices

G. Limit Switch

RS PRO Z11 Series Adjustable Roller Lever Limit Switch, 1 NO/1 NC, IP66, Zinc Alloy Housing, 400V ac, 10A | RS

th.rs-online.com

A limit switch is operated when a moving object physically contacts its actuator.

Applications:

  • Detecting the end of machine travel
  • CNC machines
  • Conveyor systems
  • Automatic doors
  • Robotics

For example, a limit switch can signal that a moving mechanism has reached its maximum position.

H. Reed Switch

IC-228 Reed Röle Switch 20 mm Manyetik Anahtar | Voltaj

voltaj.net

A reed switch contains magnetic contacts sealed inside a small glass tube. A suitable magnetic field changes the contact state.

Applications:

  • Door and window sensors
  • Magnetic position detection
  • Security systems
  • Simple proximity detection

Unlike a conventional push button, a reed switch can operate without physical contact when an appropriate magnet approaches it.

I. DIP Switch

DS-08 EKER - DipSwitch Binario 8 Vias Raster 7.62mm | DENA

dena-de.com

A DIP switch contains several small individual switches in one package. Each switch can configure a separate input or setting.

Applications:

  • Hardware configuration
  • Device address selection
  • Setting operating modes
  • Industrial equipment

5. Momentary and Latching Switches

Switches can be classified according to whether they retain their state after the user releases them.

QTEATAK 120 Pcs 6 x 6mm x 5mm Momentary Tactile Tact Push Button Switch for PCB 4 Pin DIP Black

A. Momentary Switch

A momentary switch remains operated only while the actuator is pressed or held. It returns to its normal state when released.

Examples: Doorbell button, keyboard key, and tactile switch.

Red On-Off Latching Round Push Button Switch 12mm SPST — Switch Electronics | Your One Stop Component Shop

B. Latching Switch

A latching switch retains its selected state after the user releases it. Another operation changes it back.

Examples: Many toggle switches, rocker switches, and push-on/push-off switches.

A momentary switch is useful when a device should respond to a temporary command. A latching switch is useful when a selected state should remain active.

6. Switch Contact Configurations

Switches can also be classified by the number of circuits they control and the number of positions they can select.

AbbreviationFull formDescription
SPSTSingle Pole, Single ThrowControls one circuit with one ON/OFF path
SPDTSingle Pole, Double ThrowConnects one common terminal to either of two terminals
DPSTDouble Pole, Single ThrowControls two separate circuits together
DPDTDouble Pole, Double ThrowChanges the connections of two separate circuits

A. SPST Switch

Componenten by Tim van Waardenburg

daltonmavo.nl

An SPST switch is the simplest common type. It opens or closes a single circuit.

Example: Turning a small DC lamp ON or OFF.

B. SPDT Switch

Small Micro Switch G10A | Reliable Miniature Snap Action Switch

unionwellgz.com

An SPDT switch has one common terminal and two selectable contacts.

Example: Selecting between two signal paths or choosing between two circuit modes.

C. DPST Switch

DPST | KONDIK.cz

kondik.cz

A DPST switch operates two separate electrical paths at the same time.

Example: Switching two conductors in a suitably designed electrical system.

D. DPDT Switch

PPT - Switches & Relays PowerPoint Presentation, free download - ID:4452512

slideserve.com

A DPDT switch changes two separate circuit connections between two sets of contacts.

Example: Reversing the polarity applied to a suitable DC motor using an appropriate DPDT circuit.

7. Normally Open (NO) and Normally Closed (NC)

These terms describe the contact state when a switch or button is in its normal, unoperated condition.

FeatureNormally Open (NO)Normally Closed (NC)
Normal conditionContacts are openContacts are closed
When operatedContacts closeContacts open
Current through the contactNormally interruptedCan flow if the rest of the circuit is complete
Common useStart button, event inputStop button, fault detection

For example, a normally open push button can be used to send a signal when pressed. A normally closed button can be used in a control circuit where pressing the button interrupts the normal electrical path.

Important: NO and NC describe the contact condition, not whether the complete device or load is ON or OFF.

8. Switches and Buttons in Microcontroller Circuits

Switches and buttons are commonly connected to microcontrollers such as Arduino and ESP32 to provide user input.

A microcontroller reads the voltage at an input pin to determine the switch state.

A. Basic Button Input

A simple button can connect an input pin to a defined logic level when pressed. A pull-up or pull-down resistor prevents the input from floating when the button is not pressed.

With a pull-up arrangement:

  • Button released: The input is HIGH.
  • Button pressed: The input is LOW, if the button connects the pin to ground.

With a pull-down arrangement:

  • Button released: The input is LOW.
  • Button pressed: The input is HIGH, if the button connects the pin to the supply voltage.

The logic levels depend on the wiring and the microcontroller's electrical specifications.

B. Pull-Up and Pull-Down Resistors

A pull-up resistor connects an input to the positive logic supply through a resistance. A pull-down resistor connects an input to ground through a resistance.

Their purpose is to establish a stable default voltage when the switch is open.

Many microcontrollers have internal pull-up resistors that can be enabled in software, reducing the need for an external resistor in simple circuits.

C. Button Debouncing

Mechanical switch contacts do not always change cleanly from open to closed. When pressed, the contacts can bounce briefly, producing several rapid electrical transitions.

This behavior is called switch bouncing or contact bounce.

A microcontroller may mistakenly interpret one press as multiple presses unless the signal is debounced.

Common debouncing methods include:

  • Software delays or time-based filtering
  • State tracking over a stable time interval
  • RC circuits
  • Dedicated debounce circuitry

9. Switches vs. Relays vs. Transistors

FeatureManual switch/buttonRelayTransistor or MOSFET
Control methodUsually operated by a person or mechanismElectrically controlled coil or electronic inputElectrically controlled semiconductor
Moving partsUsually present in mechanical typesPresent in mechanical relaysNo
Typical roleUser input and manual switchingElectrically controlled circuit switchingElectronic switching and amplification
SpeedDepends on the mechanism and userUsually slower for mechanical typesUsually fast
AutomationRequires a mechanism or another controllerDesigned for electrical controlDesigned for electrical control
Electrical isolationDepends on the switch and installationOften available between coil and contactsNot inherently provided

10. Applications of Switches and Buttons

Switches and buttons are used in many electronic and electrical systems.

  • Home appliances: Power switches on fans, televisions, and other devices.
  • Computers: Keyboard keys, reset buttons, and power buttons.
  • Industrial automation: Start, stop, selector, and limit switches.
  • Robotics: Position detection, mode selection, and user controls.
  • Arduino and ESP32 projects: Reading button presses and changing operating modes.
  • Security systems: Door sensors and emergency controls.
  • Automotive systems: Window controls, dashboard switches, and brake-pedal switches.
  • Consumer electronics: Remote controls, game controllers, and menu buttons.

11. Advantages of Switches and Buttons

  1. Simple operation: They provide a straightforward way to control electrical circuits.
  2. Low cost: Many switches and buttons are inexpensive.
  3. Easy integration: They can be used with electronic circuits and microcontrollers.
  4. Multiple configurations: They are available in momentary, latching, NO, NC, and multi-position types.
  5. Reliable control: Properly selected switches can provide dependable manual or mechanical control.

12. Disadvantages of Switches and Buttons

  1. Mechanical wear: Moving contacts and actuators can wear out over time.
  2. Contact bounce: Mechanical contacts can create unwanted transitions.
  3. Limited ratings: Each switch has specified voltage and current limits.
  4. Physical operation: Many switches require direct mechanical movement.
  5. Contact arcing: Switching certain electrical loads can create arcs and damage contacts.

13. Important Safety Precautions

  • Select switches according to the circuit's voltage, current, and load type.
  • Do not use a small tactile button to switch a high-current load directly unless it is specifically rated for that purpose.
  • Use a transistor, MOSFET, or relay driver when a microcontroller needs to control a load beyond its GPIO capabilities.
  • Disconnect power before changing wiring.
  • Treat mains electricity as hazardous and use appropriately rated switches, insulation, enclosures, and protective devices.
  • For motors and other inductive loads, consider the starting current and contact protection requirements.

In summary: Switches and buttons control electrical connections and provide user input. Switches may remain in their selected positions, while momentary buttons usually return to their normal state when released. Understanding switch types, contact configurations, pull-up and pull-down resistors, and debouncing is important when designing reliable electronic circuits.

Keep learning. Keep building. Keep growing.

© 2026 Ugenz Academy