Not to be confused with rotational encoder, which has its own entry in this encyclopedia.
A rotary switch makes an electrical connection between a rotor, mounted on a shaft that is turned by a knob, and one of two or more stationary contacts. Traditionally, it was the component of choice to select wavebands on a radio receiver, broadcast channels on a television or inputs on a stereo preamplifier. Since the 1990s, it has been substantially superceded by the rotational encoder. However it still has applications in military equipment, field equipment, industrial control systems, and other applications requiring a rugged component that will withstand heavy use and a possibly harsh environment. Also, while the output from a rotational encoder must be decoded and interpreted by a device such as a microcontroller, a rotary switch is an entirely passive component that does not require any additional electronics for its functionality.
Two typical schematic symbols for a rotary switch are shown in Figure 7-1. They are functionally identical. A simplified rendering of the interior of a traditional-style rotary switch is shown in Figure 7-2. A separate contact (not shown) connects with the rotor, which connects with each
of the stationary contacts in turn. The colors were chosen to differentiate the parts more clearly, and do not correspond with colors in an actual switch.
Figure 7-1. Typical schematic symbols for a rotary switch. The two symbols are functionally identical. The number of contacts will vary depending on the switch.
A selection of rotary switches is shown in Figure 7-3. At top-left is an open frame switch, providing no protection to its contacts from contaminants. This type of component is now rare. At top-right is a twelve-position, single-pole switch rated 2.5A at 125VAC. At front-left is a four- position, single-pole switch rated 0.3A at 16VDC or 100VAC. At front right is a two-position, two- pole switch with the same rating as the one be side it. All the sealed switches allow a choice of panel mounting or through-hole printed circuit board mounting.
Figure 7-2. A simplified rendering of interior parts in a ba- sic SP6T rotary switch. Arbitrary colors have been added for clarity.
How It Works
A switch may have multiple poles, each connect ing with its own rotor. The rotors are likely to be on separate decks of the switch, but two, three, or four rotors, pointing in different directions, may be combined on a single deck if the switch has only a small number of positions.
Rotary switches are usually made with a maxi mum of twelve positions, but include provision for limiting the number of positions with a stop. This is typically a pin, which may be attached to a washer that fits around the bushing of the switch. The pin is inserted into a choice of holes to prevent the switch from turning past that point. For example, an eight-position rotary switch can be configured so that it has only seven (or as few as two) available positions.
A specification for a rotary switch usually includes the angle through which the switch turns between one position and the next. A twelve- position switch usually has a 30-degree turn an gle.
Figure 7-3. A selection of rotary switches. See text for de- tails.
Variants
Conventional
The traditional style of rotary switch is designed to be panel-mounted, with a body that ranges from 1” to 1.5” in diameter. If there is more than one deck, they are spaced from each other by about 0.5”. The switch makes an audible and tactile “click” as it is turned from one position to the next.
A rugged sealed five-deck rotary switch is shown in Figure 7-4. It has five poles (one per deck), and a maximum of 12 positions. The contacts are rated 0.5A at 28VDC. This type of heavy-duty com ponent is becoming relatively rare.
If the rotor in a switch establishes a connection with the next contact a moment before breaking the connection with the previous contact, this is known as a shorting switch, which may also be described as a make-before-break switch. In a non shorting or break-before-make switch, a tiny
Figure 7-4. A five-pole, twelve-position rotary switch.
interval separates one connection from the next. This can be of significant importance, depending on the components that are connected with the switch.
The shaft may be round, splined, or D-shaped in section. A knob is seldom supplied with a switch and must be chosen to match the shaft. Some shaft dimensions are metric, while others are measured in inches, with 1/4” diameter being the oldest standard. Some switches with a splined shaft are supplied with an adapter for a knob of D-shaped internal section; the adapter can be slipped onto the shaft in any of 12 or more positions, to minimize the inconvenience of positioning the body of the switch itself so that the knob is correctly oriented in relation to positions print ed on the face of the panel.
Miniature rotary switches may be as small as 0.5” diameter, and usually terminate in pins for through-hole mounting on a PC board. Miniature switches usually have lower current ratings than full-size switches.
Rotary switches must be securely anchored to resist the high turning forces that can be inflicted
upon them by users. In a panel-mount design, a nut is tightened around a thread on the bushing of the switch. Through-hole versions can be se cured to the PC board with the shaft protruding loosely through a cutout in the panel. To minimize mechanical stress on the circuit board, the detents in a PC-board switch are usually weaker than in a full-size switch, and the knob is usually smaller, allowing less leverage.
Rotary DIP
A conventional DIP switch is a linear array of miniature SPST switches designed to fit a standard DIP (dual-inline package) layout of holes in a circuit board. It is described in the switch entry of this encyclopedia. A rotary DIP switch (also known as an encoded output rotary switch or a coded rotary switch) does not conform with a DIP layout, despite its name. It is approximately 0.4” square and usually has five pins, one of which can be considered the input or common pin while the other four can function as outputs. The pins are spaced at 0.1” pitch from one another. Pin function and layout are not standardized.
A dial on top of the switch has either 10 positions (numbered 0 through 9) or 16 positions (0 through 9 followed by letters A through F). One switch of each type is shown in Figure 7-5.
Each position of the dial closes pairs of contacts inside the component to create a unique binary- coded decimal pattern (in a 10-position switch) or binary-coded hexadecimal pattern (in the 16- position switch) on the four output pins. The pin states are shown in Figure 7-6. A rotary DIP switch is a relatively flimsy device, and is not designed for frequent or heavy use. It is more likely to be a “set it and forget it” device whose state is established when it is installed in a circuit board.
Because each position of the switch is identified with a unique binary pattern, this is an example of absolute encoding. By contrast, a typical rotational encoder uses relative encoding, as it merely generates a series of undifferentiated pulses when the shaft is turned.
Figure 7-5. A rotary DIP switch, also known as an encoded output rotary switch, may be used as a substitute for a DIP switch in some applications.
A real-coded rotary DIP makes a connection be tween input and output pins wherever a binary 1 would exist. In the complement-coded version, the output is inverted. The switch is primarily in tended for use with a microcontroller, enabling only four binary input pins on the microcontroller to sense up to sixteen different switch positions.
A six-pin rotary DIP variant is available from some manufacturers, with two rows of three pins, the two center pins in each row being tied together internally, and serving as the pole of the switch.
Rotary DIPs are available with a screw slot, small knurled knob, or larger knob. The screw-slot version minimizes the height of the component, which can be relevant where circuit boards will be stacked close together. A right-angle PC variant stands at 90 degrees to the circuit board, with pins occupying a narrower footprint. The switch on the left in Figure 7-5 is of this type.
While most rotary DIPs are through-hole components, surface-mount versions are available.
Most rotary DIPs are sealed to protect their internal components during wave-soldering of circuit boards.
Figure 7-6. Positive and negative states of the four output pins of a real-coded 16-position rotary DIP switch, assuming that the common pin of the switch is connected with a positive supply voltage. A ten-position rotary DIP switch would use only the states from 0 through 9. In a complement-coded switch, the positive and negative states would be reversed.
Gray Code
A Gray code (named after its originator, Frank Gray) is a system of absolute encoding of a switch output, using a series of nonsequential binary numbers that are chosen in such a way that each number differs by only one digit from the pre ceding number. Such a series is useful because it eliminates the risk that when a switch turns, some bits in the output will change before oth ers, creating the risk of erroneous interpretation. A minority of rotary switches or rotational en
coders are available with Gray-coded outputs. Typically, a microcontroller must use a lookup table to convert each binary output to an angular switch position.
PC Board Rotary Switch
Miniature switches with a conventional, non- encoded output are available for printed-circuit board mounting, sometimes requiring a screw driver or hex wrench to select a position. A single- pole eight-position switch of this type is shown in Figure 7-7. Its contacts are rated to carry 0.5A at 30VDC, but it is not designed to switch this current actively.
Figure 7-7. This miniature switch is designed for insertion on a printed circuit board. It can be used to make a setting before a device is shipped to the end user.
Mechanical Encoder
A mechanical encoder functions similarly to a ro tary DIP switch but is intended for much heavier use. It outputs a binary-coded-decimal value corresponding with its shaft position, is typically the size of a miniature rotary switch, and is designed
for panel mounting. The Grayhill Series 51 allows 12 positions, each generating a code among four terminals. The Bourns EAW provides 128 positions, each generating a code among 8 terminals.
Pushwheel and Thumbwheel
A pushwheel switch is a simple electromechanical device that enables an operator to provide a code number as input to data processing equipment, often in industrial process control. The decimal version contains a wheel on which numbers are printed, usually in white on black, from 0 through 9, visible one at a time through a window in the face of the switch. A button above the wheel, marked with a minus sign, rotates it to the next lower number, while a button below the wheel, marked with a plus sign, rotates it to the next higher number. A connector at the rear of the unit includes a common (input) pin and four output pins with values 1, 2, 4, and 8. An additional set of pins with values 1, 2, 3, and 4 is often provided. The states of the output pins sum to the value that is currently being displayed by the wheel. Often two, three, or four pushwheels (each with an independent set of connector pins) are combined in one unit, although individual pushwheels are available and can be stacked in a row.
A thumbwheel switch operates like a pushwheel switch, except that it uses a thumbwheel instead of two buttons. Miniaturized thumbwheel switches are available for through-hole mount ing on PC boards.
Hexadecimal versions are also available, with numbers from 0 through 9 followed by letters A through F, although they are less common than decimal versions.
Keylock
A keylock switch is generally a two-position rotary switch that can be turned only after insertion of a key in a lock attached to the top of the shaft. This type of switch almost always has an OFF- (ON) configuration and is used to control power.
Keylock switches are found in locations such as elevators, for fire-department access; in cash registers; or on data-processing equipment where switching power on or off is reserved for a system administrator.
Values
A full-size rotary switch may be rated from 0.5A at 30VDC to 5A at 125VAC, depending on its purpose. A very few switches are rated 30A at 125VAC; these are high-quality, durable, expensive items.
A typical rotary DIP switch is rated 30mA at 30VDC and has a carrying current rating (continuous current when no switching occurs) of no more than 100mA at 50VDC.
How to Use it
In addition to its traditional purpose as a mode or option selector, a rotary switch provides a user-friendly way to input data values. Three ten- position switches, for instance, can allow user in put of a decimal number ranging from 000 to 999.
When used with a microcontroller, a rotary switch can have a resistor ladder mounted around its contacts, like a multi-point voltage divider, so that each position of the rotor provides a unique potential ranging between the positive supply voltage and negative ground. This concept is il lustrated in Figure 7-8, where all the resistors have the same value. The voltage can be used as an input to the microcontroller, so long as the microcontroller shares a common ground with the switch. An analog-digital converter inside the microcontroller translates the voltage into a digital value. The advantage of this scheme is that it allows very rapid control by the user, while requiring only one pin on the microcontroller to sense as many as twelve input states.
For a ladder consisting of 8 resistors, as shown, each resistor could have a value of 250Ω. (The specifications for a particular microcontroller
Figure 7-8. A resistor ladder can be formed around the contacts of a rotary switch, with the pole of the switch
connected to a microcontroller that has an analog-digital
converter built in. The microcontroller converts the voltage input to an internal digital value. Thus, one pin can sense as many as twelve input states.
might require other values.) To avoid ambiguous inputs, a nonshorting rotary switch should be used in this scheme. A pullup resistor of perhaps 10K should be added to the microcontroller in put, so that there is no risk of it “floating” when the switch rotor is moving from one contact to the next. The code that controls the microcontroller can also include a blanking interval during which the microcontroller is instructed to ignore the switch.
Because the rotary switch is an electromechanical device, it has typical vulnerabilities to dirt and moisture, in addition to being bulkier, heavier, and more expensive than a rotational encoder. Rotary switches have also been partially re placed by pushbuttons wired to a microcontroller. This option is found on devices ranging from digital alarm clocks to cellular phones. In addition to being cheaper, the pushbutton alternative is preferable where space on a control panel, and behind it, is limited.
What Can Go Wrong
Vulnerable Contacts
Most modern rotary switches are sealed, but some are not. Any switch with exposed contacts will be especially vulnerable to dirt and moisture, leading to unreliable connections. This was an issue in old-fashioned TV sets, where periodic contact cleaning of the channel selector switch was needed.
Exposed contacts are also more vulnerable to side-effects from temperature cycling (when a device warms up and then cools down).
Contact Overload
The contacts on a cheap rotary switch are especially vulnerable to arcing, as the user may turn the switch slowly, causing gradual engagement and disengagement of contacts instead of the snap-action that is characteristic of a well-made toggle switch. If a rotary switch may control significant currents or current surges, it must be appropriately rated, regardless of the extra expense. For more information on arc suppression in switches, see “Arcing” (page 47).
Misalignment
Most knobs for rotary switches consist of a point er, or have a white line engraved to provide clear visual indication of the position of the switch. If this does not align precisely with indications printed on the panel, confusion will result. For hand-built equipment, the switch can be in stalled first, after which the control-panel indications can be glued or riveted in place on a sep arate piece of laminated card, plastic, or metal for precise alignment. If the switch is not secured tightly, its body may turn slightly under repeated stress, leading to erroneous interpretation of the knob position.
Misidentified Shorting Switch
If a shorting switch is used where a nonshorting switch was intended, the results can be disconcerting or even destructive, as one terminal will be briefly connected with the adjacent terminal while the switch is being turned. Multiple functions of a circuit may be activated simultaneously, and in a worst case scenario, adjacent terminals may be connected to opposite sides of the same power supply.
User Abuse
The turning force that must be applied to a full- size conventional rotary switch is significantly greater than the force that is applied to most other types of panel-mounted switches. This en courages aggressive treatment, and the turning motion is especially likely to loosen a nut holding the switch in place. The lighter action characteristic of miniature rotary switches does not nec essarily solve this problem, as users who are ac customed to older-style switches may still apply the same force anyway.
Rotary switches should be mounted in expectation of rough use. It is prudent to use Loc-Tite or a similar compound to prevent nuts from loosening, and a switch should not be mounted in a thin or flimsy panel. When using a miniature rotary switch that has through-hole mounting in a circuit board, the board must be sufficiently robust and properly secured.
Wrong Shaft, Wrong Knobs, Nuts That Get Lost, Too Big to Fit
These problems are identical to those that can be encountered with a potentiometer, which are discussed in that entry in this encyclopedia.