Button and Switch Basics - SparkFun Learn

07 Oct.,2024

 

Button and Switch Basics - SparkFun Learn

jimblom

jimblom

TMAZTZ contains other products and information you need, so please check it out.

Contributors:

Favorited

Favorite

57

What is a Switch?

A switch is a component which controls the open-ness or closed-ness of an electric circuit. They allow control over current flow in a circuit (without having to actually get in there and manually cut or splice the wires). Switches are critical components in any circuit which requires user interaction or control.

A switch can only exist in one of two states: open or closed. In the off state, a switch looks like an open gap in the circuit. This, in effect, looks like an open circuit, preventing current from flowing.

In the on state, a switch acts just like a piece of perfectly-conducting wire. A short. This closes the circuit, turning the system "on" and allowing current to flow unimpeded through the rest of the system.

A circuit diagram with an LED, resistor, and a switch. When the switch is closed, current flows and the LED can illuminate. Otherwise no current flows, and the LED receives no power.

There are tons and tons of switches out there: toggle, rotary, DIP, push-button, rocker, membrane, ... the list just goes on and on. Each of those switch types has a set of unique characteristics to differentiate it from others. Characteristics like what action flips the switch, or how many circuits the switch can control. Next up, we'll go over some of the more basic switch characteristics.

Defining Characteristics

Actuation Method

In order to change from one state to another, a switch must be actuated. That is, some sort of physical action must be performed to &#;flip&#; the switch&#;s state. The actuation-method of a switch is one of its more defining characteristics.

rocker,

Some examples of switch types. Push button slide , and magnetic

Switch actuation can come from pushing, sliding, rocking, rotating, throwing, pulling, key-turning, heating, magnetizing, kicking, snapping, licking,...any physical interaction which can cause the mechanical linkages inside the switch to come into, or go out of, contact.

Momentary vs. Maintained

All switches fall into one of two distinct categories: momentary or maintained.

Maintained switches -- like the light switches on your wall -- stay in one state until actuated into a new one, and then remain in that state until acted upon once again. These switches might also be called toggle or ON/OFF switches.

Momentary switches only remain active as long as they&#;re actuated. If they're not being actuated, they remain in their &#;off&#; state. You&#;ve probably got a momentary switch (or 50) right in front of you...keys on a keyboard!

Semantic alert! Most of the switches we refer to as "buttons" fall in the momentary category. Activating a button usually means pressing down on it in some manner, which just feels like a momentary control. There are such things as a maintained button, but for this tutorial when we slip and talk about "buttons", think &#;momentary push-down switch&#;.

Mounting Style

As with most components, the termination style of a switch always comes down to either surface mount (SMD) or through-hole (PTH). Through-hole switches are usually larger in size. Some might be designed to fit in a breadboard for easy prototyping.

These Tactile buttons are through-hole and fit perfectly in a breadboard. Great for prototyping!

SMD switches are smaller than their PTH counterparts. They sit flat, on top of a PCB. SMD switches usually require a gentle touch, they&#;re not built to sustain as much switching force as a through-hole switch.

The Arduino Pro has two SMD switches: a slide switch for power control, and a push-button for reset control.

Panel mount switches -- designed to sit outside an enclosure -- are a popular mounting style as well. It&#;s hard to flip a switch when it&#;s hidden inside an enclosure. Panel mount switches come in all sorts of termination styles: PTH, SMD, or heavy-duty solder lugs for soldering to wires.

A panel mounted illuminated toggle switch

One more important switch characteristic, which really deserves a page of its own, is the internal circuit arrangement of a switch. Are you looking for an SPST? DPST? 4PDT? What-P-what-now?

Poles and Throws, Open and Closed

A switch must have at least two terminals, one for the current to (potentially) go in, another to (potentially) come out. That only describes the simplest version of a switch though. More often than not, a switch has more than two pins. So how do all of those terminals line up with the internal workings of the switch? This is where knowing how many poles and throws a switch has is essential.

The number of poles* on a switch defines how many separate circuits the switch can control. So a switch with one pole, can only influence one single circuit. A four-pole switch can separately control four different circuits.

A switch&#;s throw-count defines how many positions each of the switch&#;s poles can be connected to. For example, if a switch has two throws, each circuit (pole) in the switch can be connected to one of two terminals.

Knowing how many poles and throws a switch has, it can be more specifically classified. Commonly you&#;ll see switches defined as &#;single-pole, single-throw&#;, &#;single-pole, double-throw&#;, &#;double-pole, double-throw&#;, which are more often abbreviated down to SPST, SPDT, and DPDT, respectively.

For more how push button switch worksinformation, please contact us. We will provide professional answers.

SPST

A single-pole, single-throw (SPST) switch is as simple as it gets. It's got one output and one input. The switch will either be closed or completely disconnected. SPSTs are perfect for on-off switching. They&#;re also a very common form of momentary switches. SPST switches should only require two terminals.

The circuit symbol for an SPST switch in the off position and a through-hole, right-angle, maintained, SPST, rocker switch

SPDT

Another common switch-type is the SPDT. SPDTs have three terminals: one common pin and two pins which vie for connection to the common. SPDTs are great for selecting between two power sources, swapping inputs, or whatever it is you do with two circuits trying to go one place. Most simple slide switches are of the SPDT variety. SPDT switches should usually have three terminals. (Sidenote: in a pinch an SPDT can actually be made into an SPST by just leaving one of the switch throws unconnected).

An SPDT switch circuit symbol, and an SPDT slide switch

DPDT

Adding another pole to the SPDT creates a double-pole, double-throw (DPDT) switch. Basically two SPDT switches, which can control two separate circuits, but are always switched together by a single actuator. DPDTs should have six terminals.

A DPDT circuit symbol, and a 6-terminal DPDT rocker switch

XPYT

Switches with more than two poles or throws are not too common, but they&#;re out there (in all their oddly-shaped, difficult-to-connect-to glory). Once we get past one or two poles/throws, we just start sticking numbers in the abbreviation. Here's a 4PDT switch, for example, it can control four separate circuits, 2 positions per circuit:

A massive 4PDT circuit symbol, and an physically massive 4PDT toggle switch


* Just remember: it&#;s "poles", not "pulls". Seasoned engineers just love picking on poor saps who were only looking for a &#;single-pull, double-throw&#; switch. (Not speaking from experience here or anything... I mean, in my defence, I didn&#;t read it in a book, just heard it ambiguously pronounced by the professor. Meanies.)

Normally Open/Closed

When a momentary switch is not actuated, it&#;s in a &#;normal&#; state. Depending on how the button is constructed, its normal state can be either an open circuit or a short circuit. When a button is open until actuated, it&#;s said to be normally open (abbreviated NO). When you actuate an NO switch, you&#;re closing the circuit, which is why these are also called &#;push-to-make&#; switches.

Conversely, if a button usually acts like a short circuit unless actuated, it&#;s called a normally closed (NC) switch. NC switches are &#;push-to-break&#;; actuating the switch creates an open circuit.

Among the two types, you&#;re probably much more likely to encounter a normally open momentary switch.

Switch Applications

On/Off Control

Among the most obvious of switch applications is simple on and off control. The type of control you perform every time you walk into a dark room. An on/off switch can be implemented by simply sticking an SPST switch in series with a power-line. Usually the on/off switch will be maintained, like a toggle or slide switch, but momentary on/off switches can have their purpose.

On this Breadboard Power Supply , an SPDT switch is used to turn the circuit on and off. (A second SPDT switch is used to select the adjustable voltage regulator's output value by adjusting a voltage divider .)

When implementing such a switch, keep in mind that all the current your project consumes is going to run through that switch. Ideally a switch is a perfect conductor, but realistically it's got a small amount of resistance between the two contacts. Because of that resistance, all switches are rated for a maximum amount of current they can withstand. Exceed a switch's maximum current rating, and you can expect melted plastic and magic smoke.

For example, this SPDT slide switch is great for controlling current flow in small projects (like Simons or Metronomes), but don't try using it to control beefy motor controllers, or strings of 100 LEDs. For that, consider using something like a 4A toggle switch or a 6A lamp switch.

User Input

Of course, user input is one of the more common applications for switches. For example, if you want to connect a switch to a microcontroller input pin, a simple circuit like this is all you'd need:

When the switch is open, the MCU pin is connected through the resistor to 5V. When the switch is closed, the pin is tied directly to GND. The resistor in that circuit is a pull-up resistor, required to bias the input high, and prevent a short to ground when the switch is closed.

A Complete Guide to Push Button Switches

Arduino Push Buttons

With the support of an international community of creators, Arduino specialises in the development of easy-to-use hardware and software. The buttons are often connected to Arduino circuit boards, enabling them to control the function of an array of equipment.

2-Position Push Button Switches

These have two set positions for turning the connected device off-on. It is quite common for these switches to be encased in protective plastic, with a key being required for operation.

Dual Push Button Switches

Similar to the two-position variety, dual push button switches feature one button for electrical connection and one for disconnection. The on button is typically green; the off button red. LEDs are another common feature, with the backlighting indicating the status of the device.

Miniature Push Button Switches

Miniature or micro push button switches are available from a variety of brands such as C&K. They are often used for resetting small electronic devices.

Push to Break Switches

Also referred to as normally closed (NC), push to break switches are the most commonly used variety, operating oppositely to latching and momentary types. Electricity can flow to the circuit when no pressure is applied to the button. However, the flow will immediately be broken on pressing. The switch can remain on in either position, with the connection made and broken from separate devices.

Push to Make Switches

The push to make switch enables electricity to flow through the circuit whenever the two contacts are held in. The connection will be broken as the button is released. Common examples include doorbells, calculator buttons, and keyboard keys. Some feature both the push to make and push to break variety, depending on the wiring of the switch.

If you want to learn more, please visit our website limit switch operating principle.