Switch interfaces - Embedded.com

Switch interfaces


Everywhere you look in industrial electronics there are switches and contacts: proximity switches, limit switches, relay contacts, activation switches and sometimes even keyboard switches. At one point, there was a plethora of integrated circuits that were aimed at switch matrices, but they all seemed to have faded to be replaced by versions of the 8042 that were used by IBM in the PC keyboard. Today if you were interested in making your own matrix encoder you would probably use a microcontroller of your own design. I have a recollection that Intel’s 8279 had a special mode for discrete switches.

However switches in the industrial sphere have their own peculiarities. First of all they often operate at high voltages – 24VDC is common. Second of all they don’t really lend themselves to a matrix configuration. (For you youngsters out there, a switch matrix is a method of multiplexing input contacts as a means to reduce the I/O pins needed to detect the switch state. I did a pair of blog posts on an aspect of this subject “Keyboard and display multiplexing — the traditional approach” and “Keyboard and display multiplexing – Charlieplexing”.)   As a result, techniques are needed to condition the voltage to the microcontroller’s input voltage and to reduce the number of microcontroller I/O pins. In addition, where there is a mechanical contact, there is switch bounce and contact resistance.

I would love to write a blog on switch bounce, but Jack Ganssle beat me to it with a series of definitive articles on the topic (listed at the bottom), and it would be foolhardy to hold myself up for comparison with the master. You must read those articles.

Contact resistance can be a bother as well since sometimes the resistance is too high to be detected as a “make”. Some switches may require a minimum current to overcome the contact resistance (a “wetting” current).

There is a way to encode a number of inputs using a priority encoder, several of which you can find in the conventional logic families. These provide a code at their output that corresponds to the active input with the highest priority. Look at devices like the 74HC148 or the CD4532. You could also look at digital data multiplexers, again in the standard logic families like the 74HC151 (and there are others depending on the configuration you want). Of course you are still left with conditioning the input voltage. Analog switch multiplexers (e.g. CD4067) may add a degree of flexibility since they can work with elevated voltages, but that simply defers the voltage translation problem.

But of course, if I am writing about the subject, there are probably several other more comprehensive solutions. Most of these have serialized communications ports and as a result lend themselves to simplified isolation of the inputs, since each input does not have to be individually isolated.

Freescale/NXP (or whoever owns them now) offer the 33975/A and the 33972/A/T. Both are aimed at the automotive market, but there is no reason they couldn’t be used on the industrial stage. They have up to 15 inputs (at elevated voltage) with wetting current and an SPI output.

TI has a single offering, the industrially targeted SN65HVS880PWP, which has only 8 digital inputs with elevated voltage capability, but it has some other features. It has debounce filters, input current limits, serial output, is cascadable and has drivers for external LEDs that correspond to the inputs.

Maxim does have offerings very similar to TI’s. They are the MAX31911, MAX31912, MAX31913MAX31914, and MAX31915. If you only need to condition a single contact you may want to consider the MAX14838/9 industrial sensor output driver. The variations include a parallel output and SPI interface.

And finally Silicon Labs produces the Si838x family. Aside from the debounce of TI’s and Maxim’s offerings, this device has a diode bridge input (so no wiring polarity issues, although there doesn’t appear to be a smoothing capacitor so AC input appears unlikely) and most importantly include 2.5KV isolation.

I guess this blog complements “Where Have All the (MCU) Outputs Gone?” that I wrote a while back. Together the blogs cover both digital input and output in industrial systems and I hope they have provided some direction to design in that field.

Jack Ganssle’s Articles on Debouncing:

  1. Solving Switch Bounce Problems
  2. My favorite software debouncers
  3. A Guide to Debouncing, or, How to Debounce a Contact in Two Easy Pages- Part 1
  4. A Guide to Debouncing – Part 2, or, How to Debounce a Contact in Two Easy Pages

8 thoughts on “Switch interfaces

  1. “Aubrey, we are never old enough that we cannot learn new things (wetting current I mean) 🙂 . Also thank you for the heads up on the ICs. I have to admit I would probably not think of looking for specific parts like these for this kind of application.nn

    Log in to Reply
  2. “I have got some very nice matrix switching ICs out of old PABXs (phone systems) – I think the biggest was a 16×16. But as you say these are not common, especially now that phone systems have gone over to IP based ones in the main.”

    Log in to Reply
  3. “DavidnnIt's a long time since I thought about crosspoint switches. I checked on Digikey and they seem to go as big as 40×40, although between the price and the BGA, I am not sure you will be using them in a hobby application any time soon.”

    Log in to Reply
  4. “Eldernn” we are never old enough that we cannot learn new things “nnToo true. In my case it's the problem of remembering old (and not so old) things.nn”I would probably not think of looking for specific parts “nnIt seems to me that a few years

    Log in to Reply
  5. “Since I wrote about keyboard scanning (although not the prime focus of the blog) I thought I should point out an app note I just came across using a Silego programmable part as a keyboard scannernhttp://www.silego.com/applications/keypadscanner.html”

    Log in to Reply
  6. “Aubrey, good to know about the chips you mentioned. When it comes to making an elastomeric keyboard, what people forget in the pursuit of cheap..cheap..cheap is I see some try a HASL coated surface for making the switch contact with the carbon pill attac

    Log in to Reply
  7. “Maxim has introduced a new octal industrial digital input, this one with diagnostics: the MAX22190nhttps://www.maximintegrated.com/en/products/sensors/MAX22190.html?utm_source=Eloqua&utm_medium=email&utm_content=MAX22190&utm_campaign=FY19_Q3_2018_F

    Log in to Reply

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.