In electronics, a switch is an electrical component that can break an electrical circuit, interrupting the current or diverting it from one conductor to another. A switch may be directly manipulated by a human as a control signal to a system, such as a computer keyboard button, or to control power flow in a circuit, such as a light switch. Automatically operated switches can be used to control the motions of machines, for example, to indicate that a garage door has reached its full open position or that a machine tool is in a position to accept another workpiece. Switches may be operated by process variables such as pressure, temperature, flow, current, voltage, and force, acting as sensors in a process and used to automatically control a system.
There are a lot of types of switches. We will explain a few common used in microcontroller based systems.
Single Pole, Single Throw (SPST). This is a simple on/off switch. There are a lot of shapes and sizes of switches, but basic function is same, to terminate or establish electrical circuit.
Push-to-make or Push-to-break switches. As the name said when you press switch the circuit is closed or opened as long as switch is pressed. Similar terminology is “normal open” and “normal closed” switches, respectively.
Single Pole, Double Throw (SPDT). This is a simple changeover switch that trough common leg can be connected to separate electric contour, or different voltages can be brought to common leg. It is often called a changeover switch.
Double Pole, Single Throw (DPST). Equivalent to two SPST switches but controlled by a single mechanism. For example, it is often used to separate supply for actuators and control electronics due to interferences from actuators.
Double Pole, Double Throw (DPDT). Equivalent to two SPDT switches but controlled by a single mechanism. A DPDT switch can be wired up as a reversing switch to allowing changes of voltage direction on load (for example motor).
Here some special switches.
Push-Push Switch (SPST). This looks like a momentary action push switch but it is a standard on-off switch: push once to switch on, push again to switch off. This is called a latching action.
Microswitch (SPDT). Microswitches (also known as miniature snap-action switches) are designed to switch fully open or closed in response to small movements. They are available with levers and rollers attached. The defining feature of micro switches is that a relatively small movement at the actuator button produces a relatively large movement at the electrical contacts, which occurs at high speed (regardless of the speed of actuation). Most successful designs also exhibit hysteresis, meaning that a small reversal of the actuator is insufficient to reverse the contacts; there must be a significant movement in the opposite direction. Both of these characteristics help to achieve a clean and reliable interruption to the switched circuit.
Micro switches are very widely used; among their applications are appliances, machinery, industrial controls, vehicles, and many other places for control of electrical circuits. They are usually rated to carry current in control circuits only, although some switches can be directly used to control small motors, solenoids, lamps, or other devices.
Tilt Switch (SPST). Tilt switches contain a conductive liquid and when tilted this bridges the contacts inside, closing the switch. They can be used as a sensor to detect the position of an object. Some tilt switches contain mercury which is poisonous.
Reed Switches (SPST). The contacts of a reed switch are closed by bringing a small magnet near the switch. They are used in security circuits, for example to check that doors are closed or on bicycle to measure the path traveled.
DIP Switch. This is a set of miniature SPST on-off switches. This type of switch is used to set up circuits, e.g. setting the code of a remote control.
Rotary Switch. Multi-way switches have 3 or more conducting positions. They may have several poles (contact sets). A popular type has a rotary action and it is available with a range of contact arrangements from 1-pole 12-way to 4-pole 3 way.
Contact bounce. Contact bounce (also called chatter) is a common problem with mechanical switches and relays. Switch and relay contacts are usually made of springy metals that are forced into contact by an actuator. When the contacts strike together, their momentum and elasticity act together to cause bounce. The result is a rapidly pulsed electric current instead of a clean transition from zero to full current. The effect is usually unimportant in power circuits, but causes problems in some analogue and logic circuits that respond fast enough to misinterpret the on-off pulses as a data stream.
The effects of contact bounce can be eliminated by use of mercury-wetted contacts, but these are now infrequently used because of the hazard of mercury release. Contact circuits can be filtered to reduce or eliminate multiple pulses. In digital systems, multiple samples of the contact state can be taken or a time delay can be implemented so that the contact bounce has settled before the contact input is used to control anything.
Below is a simple circuit for debouncing a switch for digital logic. When the switch is closed, the voltage is pulled down through the switch, and when the switch is open, the output voltage is pulled high through the resistor. The resistor also prevents a short circuit when the switch is closed. The capacitor "absorbs" the bounces when the switch changes states. Keep in mind that this circuit will cause a short delay in switching because the capacitor takes time to charge through the resistor. The delay can be adjusted by varying the values of the capacitor and resistor, but if the resistor is too small, it may not be sufficient to absorb the bounces.