A switch is a device that is used for making and breaking electrical connections in a circuit. There are many types of these devices. Some of the more common ones that you may use are shown below. (microswitch, pushbutton, toggle, dip, slide, rotary)</P>
Beside the general type of switch (toggle, slide, pushbutton, etc) there are many configurations of the contacts possible. Often you will see a switch in a schematic referred to as a SPST or DPDT. These stand for Single Pole Single Throw and Double Pole Double Throw. This is illustrated in the diagram at the right. A switch with a single throw has it's lines either connected or unconnected. In otherwords there are two terminals with are electrically connected only when the switch is activated. A switch with a double throw has an extra terminal for each pole so that there are two electrical paths possible instead of just one.
Another term used often with switches is Normally Open or Normally Closed. Most pushbutton-style switches are "normally open", meaning that the switch contacts are in the open-circuit position when the switch is in the non-depressed state. Microswitches often have both normally open and normally closed contacts and a common contact. When wiring a touch sensor with a microswitch, it is customary to use the normally open mode.
Two common uses of switches in mechatronics are power cutoff and as an imput sensor.
The microswitch is a type of touch sensors. A microswitches is a small, momentary switches that can be attached to bumpers to signal when the robot has run into an obstacle. A microswitch is housed in a rectangular body and has a very small buton whcih is the external switching point. Usually, microswitches are also equipped with lever arms to reduce the force needed to actuate the switch.
The following figure shows how a single throw switch can be wired to a sensor input port. When the switch is opened, the sensor input is pulled to the +5V supply by the pull up resistor. When the switch is closed, the input is tied to ground, generating a zero voltage signal. A double throw switch makes life much easier but they are less common.
Most switches are mechanical and vibrate when switched from one position to another. To learn about this and how to counteract it see the section on Schmitt Triggers
Connecting a switch to the PC/104 Stack
Because a switch functions as a digital device, we will be connecting to a digital IN port on the PC/104. You should consult the PC104 I/O page first. Below is a picture of how you might connect a pushbutton switch.