Sunday 5 May 2019

Multipole switch debouncing PSoC

Summary
This post looks at a solution using PSoC components to debounce a multipole switch. For testing, an industrial roller lever switch from German switch manufacturer Bernstein was used with a Cypress CY8CKIT-049 development board.


Bernstein Switch
Bernstein Switch
Single pole vs Multipole 
Single pole switches and buttons are commonly used in applications which are non-critical, require no redundancy or have no specific safety requirement. Consider examples such as the reset button on the Cypress CY8CKIT-049 development board or the light switch in a house.

The multipole switch usually contains multiple contact options for various industrial applications. The contact options are Normally Open 'NO' and Normally Closed 'NC' with various brake and make, effectively open and close, options. Consider an example such as the changeover switch for an electric railway signal box or the end stop switch on a gantry crane.

Signal Bouncing
Multipole switches may use the same mechanical actuation design as their single pole counterparts which gives rise to similar signal characteristics. One difference however is that the contacts in a multipole switch may not actuate at the same time.


Bernstein Switch PSoC Test Setup
Bernstein Switch PSoC Test Setup
The test setup in the image above shows the connections between the CY8CKIT-049 development board and the Bernstein switch. Both contacts use a 5V DC supply.


Multipole Switch with Bounce
Multipole Switch with Bounce
Shown in the capture above are the NO and NC contacts of the Bernstein switch when actuated. No bounce is shown for the NC signal (Yellow channel 1) as it switches OFF and the NO signal (Green channel 2) shows signal bounce for less than 5msec as it switches ON.

To remove the unwanted bounce in this design without using external filtering or other components, the two switch signals were debounced in the PSoC using digital 'components' built from Cypress termed Universal Digital Blocks (UDB).

Simple Multipole Glitch Filter (PSoC)
Simple Multipole Glitch Filter (PSoC)
In the example above the Glitch Filter component was used to debounce the two input signals from the switch. The outputs of these filters was combined to drive the on-board LED. For illustrative purposes the filters were not been combined into a single component with a bus.

The filter component was configured for 20ms for both filter components.


Glitch Filter Configuration
Glitch Filter Configuration
Running the example project in the PSoC development kit produces a clean debounced waveform as shown in the capture below. Note the 20ms delay between input and output waveforms.


Multipole Switch Debounce Turn ON
Multipole Switch Debounce Turn ON
The connections for channel 1 and 2 to the switch remain the same as the previous capture. The additional connections for Blue channel 3 show the filtered NO signal and the Pink channel 4 shows the NC signal.

Shown below is the turn OFF waveforms.


Multipole Switch Debounce Turn ON
Multipole Switch Debounce Turn OFF
Fault Blocking
The dual pole switch in this example uses contacts, which in resting condition, are in the opposite state. The addition of another gate and an enable control to the output LED connections provides some fault detection. That is, the two inputs must be in opposite states for the LED to be active.


Simple Multipole Glitch Filter with Fault Detection (PSoC)
Simple Multipole Glitch Filter with Fault Detection (PSoC)

Final Thoughts
Debouncing multipole switches with a PSoC can be achieved using only a digital solution (UDB). The filter components used in the solution require no code however some 25% of the available resources are utilised. Where practical, multiple switches with multipole contacts could be debounced using a suitable multiplexer.

Downloads
The PSoC Creator 4.2 project below with the glitch filters was saved as a minimal archive.
Mutlipole Checker PSoC Creator 4.2 Project
Multipole Checker PSoC Creator 4.2 Project


No comments:

Post a Comment