Friday, February 26, 2010

LCB #4, PART 1. SWITCHES, and how to interface them with logic.

More on switches, and how to build switch-logic interfaces that work reliably.                                                                                                                                                                             

In my last blog, LCB#3, I discussed switches and how contact material affects reliability.  A "dry" circuit is one where you are switching logic voltage levels at low current.  In these applications, a switch with gold-plated contacts is necessary, since there is not enough energy to burn through the oxide coating that will form on other contact materials.  At higher energies, however, gold plating will burn off and  you should use silver contacts.  See Figure A. 



Broadly speaking:

1. With low voltages and currents (for example, 5V and 20 MA) always use a switch with gold-plated contacts ("dry circuit" rated).  Most magnetic reed switches will also be OK, since their contacts are sealed in an inert atmosphere.
 
2.  With voltages greater than about 12 V and with currents greater then 40mA or so, there is enough energy to burn through the silver oxide coating. Therefore, silver contacts will provide reliable operation while gold plating would be destroyed.

3.  If your application is switching low voltages and very high currents (such as an automotive application), you are on your own because I don't know what to suggest.  This is, actually, a real problem: when was the last time you turned on a flashlight and it didn't flicker until you banged it on a table and cleaned the contacts?  The best solution in this case is often to use copper contacts with extremely high contact pressure and/or a lot of "wiping" action to keep the contacts clean.


Now, finally, we get to the circuits.  I'm going to discuss how to interface logic, or other electronic circuits, with different switch types.  Assume that CMOS gates are used, and I strongly suggest the use of a gate with a Schmitt-trigger input.

Case 1:  Switching a logic level with a "dry circuit" (gold) switch.  An example would be a miniature, on-board, tactile pushbutton of the type that is commonly used as a "reset" button.  In this case it is usually OK to use a relatively high-value pull-up resistor (1K to 22K or so) and wire the switch directly to the logic input.   See Figure 1.


 

Remember, however, that you may still have to contend with contact bounce (see LCB #1).

What is insidious about this circuit, however, is the fact that you no longer have a circuit with good noise immunity; this is because, when the switch is open, you have a relatively high impedance at the logic input-  equal to the pullup resistor.  As a result, fast transients (such as caused by a static discharge) can be easily coupled into the node. One solution is to simply add a capacitor across the switch contacts.  But...... ouch.......lousy idea; see Figure 2

When the switch in Figure 2 is closed, its poor little contacts will short the capacitor, producing a very high-current pulse.  These switches are often only rated for 10-20mA, and the gold plating can be quickly destroyed.  The solution is to add a resistor before the cap to limit the current.  See Figure 2A. 

 

 The added resistance also helps noise immunity by increasing the time constant and forming a low-pass filter.  This is of great value if the switch is located some distance from the gate, such as off the board on a front panel. A gate with a Schmitt-trigger input should definitely be used in this circuit, since the slow transitions should be squared up.  As a plus, you will then have a circuit which is immune to contact bounce; see LCB#1.

CAUTION:  THIS CIRCUIT WILL NOT PROTECT AGAINST STATIC DISCHARGE.  More on that in future blogs.


Case 2:  Switching a logic level with a general-purpose (silver or copper) switch. There are many instances where you have to generate a logic input from a switch that is not designed for "dry circuit" operation.  Examples would include rocker or slide switches, 120V wall switches, "micro switches", heavy-duty toggle switches, or even door-bell buttons.  In these cases, we have to configure the circuit so the switch is switching high voltage and current, yet level-shift down to the necessary logic level.

However, it is a beautiful day with fresh powder, so I am going skiing now.  I'm sorry, but you'll have to wait until next time for the solution to Case 2.  I hope you can stand the suspense. Until then.......


No comments:

Post a Comment

Followers