Key switches, also sometimes referred to as lock switches or keylock switches, are electrical switches that are activated by inserting a physical key into a lock and turning it.
Key switches rely on a lock mechanism that only allows a unique key with a specific pattern of notches cut into it to rotate freely, such as a warded lock, pin tumbler lock, or disk tumbler lock. Most switches only come with one or two keys that will fit, although lower quality key switches probably have a higher chance of being keyed-alike.
There are a wide variety of key switches out there.
The most common type of key switch is on/off and has only two terminals, but there are also rotary key switches with three or more terminals. Some rotary key switches have an “off” position where no terminals are connected, while others are always on.
Some key switches will allow you to remove the key in any position, while others will only allow you to remove the key in the “off” position.
Another variation is the type of key - some switches use flat keys, while others use tubular keys.
The most common place you’ll find a key switch is in the ignition system of a car, although increasingly these are being phased out in favor of pushbutton switches. Key ignition switches are typically off-on-on-momentary, with the momentary position used to start the engine and the latching positions used to keep the engine running or put the car in accessory mode.
In a darker example, key switches were also used as the launch controls for the Minuteman and Titan nuclear missiles, with some launch systems requiring two or even four operators to turn their keys simultaneously.
Key switches are difficult to accidentally manipulate; activating a key switch requires the user to both insert and turn the key. This makes them well-suited for situations where it’s important that a control is only operated deliberately, which is why you often find them in cars and other heavy machinery where safety is crucial. However, this same property makes key switches less well-suited to expressive interfaces that require quick gestures, e.g. musical instruments.
Key switches are also difficult to tamper with, because only someone with a working key can turn the switch on or off. A key switch could be a good choice as an on/off switch for a publicly displayed project that you want to prevent strangers from messing with. The downside to this is, of course, that you could lose the key, rendering the switch useless.
Key switches can also introduce a social aspect to projects, in that you have a limited number of keys and can only give them to certain people.