Professional Documents
Culture Documents
Switch Selection Criteria: Some of the more important criteria are as follows:
Switching Speed. Duration of that the contact travels during the make or break
function. It is generally desirable to have high speed during the make function to
minimise the duration of an arc or flashover. If the duration is excessive, the
contact surface will deteriorate and welding of the contacts may occur. Arc-
suppression techniques should be used if higher currents are anticipated. During
the break, it is generally desirable to have a slower speed to minimise both state
and time transients, particularly for DC (Direct Current) and inductive currents.
Contact Snap-over and Bounce Time. Snap-over time is the time a contact
separates from a normally closed position and travels to a normally open position
and makes contact with the circuit. Bounce time is the interval between the initial
contact and steady (stable) contact during which contact bounces as a result of
impact of a moving contact onto a stationary contact. These times should be
kept to a minimum because the time intervals and/or the contacting instability
may influence critical or sensitive circuits.
1 / 13
Figure 1: (Left) Generalised digital signal switch bouncing and (Right) Two
switches connected in parallel.
SWITCH INSTABILITY
2 / 13
Table 1: Two same material switch contacting surfaces.
Switch stages
Initially making contact Stabilising contact Switch makes the circuit
Unstable state Changing state Stable state
Transient state Settled state
Steadying state One single state
Transient signals send Transient signals send Switch completes circuit
Switch mechanically Stabilising, Settling
jittering/bouncy
3 / 13
Special Case: 2 DIFFERENT SWITCH SUR FACES
A hard non-resilient material does not absorb the kinetic energy of motion.
Instead, the energy dissipates over time and friction in the bouncing action acts
against the forces pushing the billiard balls together. Hard metal switch contacts
react in much the same way. Also, switch contacts are not perfectly smooth. As
the contacts move against each other, the imperfections and impurities on the
surfaces cause the electrical connection to be interrupted. The result is switch
bounce.
4 / 13
Table 2: Two different materials switch contacting surfaces.
Switch stages
Initially making contact Stabilising contact Switch makes the circuit
Unstable state Changing state Stable state
Transient state Settled state
Steadying state One single state
Transient signals send Transient signals send Switch completes circuit
Switch mechanically Stabilising, Settling
jittering/bouncy
5 / 13
The Consequences of switch bouncy contact
The consequences of incorrect switch bounce can range from being just
annoying to catastrophic. For example, imagine advancing the TV channel, but
instead of getting the next channel, the channel selector (switch) skips one or two
channels. This is a situation that a designer should strive to avoid. Switch
bounce has been a problem even before the earliest computers. Similarly with a
microcontroller, if debouncing is not implemented, the microcontroller may read
these rapid transitions, as rapidly switching on/off signals and malfunction will
result. Bearing in mind that all bouncing is an erratic action that can wreak
havoc on data, because the exact number of bounces does not necessarily
repeat in the long term. Switch bounce is not consistent from unit to unit, lot to
lot, or even over the life of an individual switch. Membrane switches and some
other types do not appear to bounce when new, but all mechanical switches
bounce at sometime. Though, nothing can ensure that another switch of the
same type will act in the same way, or that a particular switch will remain bounce
free as it ages.
6 / 13
Debouncing for more than one switch
Design
Switch bounce is the intermittent contact and release of switch contacts. Two
parameters characterise switch bounce: bounce period (T or τ [Greek letter Torr])
and bounce duration (t = time). The bounce period is the random length of time
that the contacts remain open, or closed, while the bounce is occurring. Where,
bounce periods can vary anywhere from a few nanoseconds to a few
milliseconds. The difficulty is that bounce duration is indeterminate. Thus,
bounce abatement design starts by making assumptions based on empirical
data. Where, the first assumption is that the bounce period will be absolutely
less than 10 milliseconds. The second assumption is the total bounce duration is
indeterminate. A good design should work regardless of how long the switch
bounces, provided that it eventually does stop bouncing.
Hardware solution
Where, the debounced switch subsystem provides a switch that closes when
pressed. Whenever a mechanical switch is pressed, the switch contacts will
bounce, which produces several very quick on and off signals. Each of these
signals would be counted by a counter subsystem. To overcome this, a
debouncing circuit is used to produce a clean output signal from the switch.
Such as, by using a mechanical debouncer (latch or sample/hold), which is
needed to cancel out the switch’s bouncing effect. In effect a debouncer
registers the first connection and disregards any bouncing. This will allow for the
counter to increment correctly with each toggle of the switch. Some times switch
bouncing can be removed with an analogue filtering and a comparator with
hysteresis output. Though, unfortunately this will not work for all cases; even if it
did, the extra cost in hardware may not be justifiable, especially since most of the
work can be done in software.
7 / 13
SOFTWARE SOLUTION
Consider a simple push button application routine. In this case, some event
should occur when a button is pushed. Ideally, the invoked event will occur
immediately and only once for each button push. The system should also be
ready to respond to a repeat button push as soon as possible after the button is
released. This presents an apparent dilemma. How is the difference between
switch bounce and repeated button pushes determined? Recall the assumption
that the bounce period is less than 10 milliseconds. If the switch-input level is
stable for longer than 10 milliseconds, then bouncing has stopped and the input
level represents the pushed or released Switch State. The Brute Force method
only cares about a button-push event because this is what invokes the action. It
recognises the switch Release State as the stable state and everything else is
considered unstable. When the switch becomes unstable, the action is invoked
permitting nothing to happen until the switch returns to the released stable state.
The flowchart in Figure 3 outlines the software actions that are necessary to
implement the Brute Force debounce method. Notice that the debounce loop is
looking for a stable released state for 10 milliseconds before returning to the top
of the main loop. Any instability, including a stable button pushed state, resets
the debounce function 10 millisecond timer.
This program is a debouncing routine that samples the switch's state at a high
rate. When a change in state is detected, the routine will count anywhere from 1
to 4 to 8 to whatever samples to make sure the transition was not a glitch and
that the switch has settled into its new state. If there are many switches that
need to be debounced simultaneously, it gets rather unwieldy keeping track of
the counters and operations. This is empirically demonstrated by the brute-force
debounce routine.
8 / 13
Figure 3: Outline of the necessary software actions that implement the Brute
Force debounce method.
Notes:
1. NOISE - Unwanted Random Signal in the electronic circuits.
2. KINETIC ENGERY - Force that makes things moves.
9 / 13
Figure 4: CoreChart Main Program for the Switch Debouncing.
10 / 13
Figure 5: CoreChart Initialisation Subroutine for the Switch Debouncing program.
11 / 13
Figure 6: CoreChart ToggleLED Subroutine for the Switch Debouncing program.
12 / 13
Figure 7: CoreChart Debounce Subroutine for the Switch Debouncing program.
13 / 13