Maker Pro
Maker Pro

Multiple push button detection circuit

S

Stephen Inkpen

Jan 1, 1970
0
Hello,

I am working on a microcontroller based system that takes in about 25
push button sources. I am wondering if there is something more
efficient than just using 25 pins of my controller to handle the
simple push button detection. I want to keep the buttons simple and
cheap by sticking with a SPST type. Is there some sort of dedicated
chip that would, in effect, be a unary to binary converter?

Thanks,

Stephen Inkpen
Email code: EA701JXZ2
 
T

Tim Wescott

Jan 1, 1970
0
There used to be, but it's too easy so they aren't made any more. Here's
how you do it:

Arrange your SPST switches in a 5x5 matrix. Set up five of your
microcontroller pins as outputs and connect them to columns on the matrix.
Set up another five pins as inputs (with pulldowns) and connect them to the
rows. Scan a '1' through your five outputs and look for '1's on your
inputs.

This will correctly detect up to any two key closures; sets of three key
closures will confuse the unit. If this is an issue you can use blocking
diodes in series with the switches -- then all 25 switch closures will
produce a unique pattern.
 
S

Stefan Heinzmann

Jan 1, 1970
0
Tim said:
There used to be, but it's too easy so they aren't made any more. Here's
how you do it:

Arrange your SPST switches in a 5x5 matrix. Set up five of your
microcontroller pins as outputs and connect them to columns on the matrix.
Set up another five pins as inputs (with pulldowns) and connect them to the
rows. Scan a '1' through your five outputs and look for '1's on your
inputs.

This will correctly detect up to any two key closures; sets of three key
closures will confuse the unit. If this is an issue you can use blocking
diodes in series with the switches -- then all 25 switch closures will
produce a unique pattern.

Yet another possibility is to use an analog input on microcontrollers
that have an integral ADC. You just arrange a resistor network such that
each key produces a unique voltage on the ADC input.
 
J

John Fields

Jan 1, 1970
0
Hello,

I am working on a microcontroller based system that takes in about 25
push button sources. I am wondering if there is something more
efficient than just using 25 pins of my controller to handle the
simple push button detection. I want to keep the buttons simple and
cheap by sticking with a SPST type. Is there some sort of dedicated
chip that would, in effect, be a unary to binary converter?
 
W

Wade Hassler

Jan 1, 1970
0
Hello,

I am working on a microcontroller based system that takes in about 25
push button sources. I am wondering if there is something more
efficient than just using 25 pins of my controller to handle the
simple push button detection. I want to keep the buttons simple and
cheap by sticking with a SPST type. Is there some sort of dedicated
chip that would, in effect, be a unary to binary converter?

Thanks,

Stephen Inkpen
Email code: EA701JXZ2

Recently saw a reference to a Microchip app-note describing a 4x4
keypad and several resistors connected to a single pin . It used the
phrase 'carefully-chosen resistance values,' of course.
I couldn't find it today, though.
Wade
 
S

Spehro Pefhany

Jan 1, 1970
0
Hello,

I am working on a microcontroller based system that takes in about 25
push button sources. I am wondering if there is something more
efficient than just using 25 pins of my controller to handle the
simple push button detection. I want to keep the buttons simple and
cheap by sticking with a SPST type. Is there some sort of dedicated
chip that would, in effect, be a unary to binary converter?

A priority encoder (eg. some HC148s) will do that, but you may wish to
look at other options. Scanning a matrix (either with or without
diodes, depending on whether multiple switches can be closed at once)
is a good option if the switches are close by (maybe a keyboard). If
they are far away you may wish to use some filtering on each input and
mux them afterwards (eg. HC4051s or a PISO shift register chain).

Best regards,
Spehro Pefhany
 
T

Tim Wescott

Jan 1, 1970
0
I've done something similar when there's fewer inputs, but I'd be worried
about doing it with 25 different switches -- particularly in a production
system.
 
K

Klaus Vestergaard Kragelund

Jan 1, 1970
0
Stephen Inkpen said:
Hello,

I am working on a microcontroller based system that takes in about 25
push button sources. I am wondering if there is something more
efficient than just using 25 pins of my controller to handle the
simple push button detection. I want to keep the buttons simple and
cheap by sticking with a SPST type. Is there some sort of dedicated
chip that would, in effect, be a unary to binary converter?

I saw a circuit recently - I think it just used a number of different
resistors on the switches. It didn't use a dedicated ADC, but instead it
used the res value to charge a cap and one digital input to "monitor" the
cap voltage. When the voltage exceeds the High-level of the input pin a
certain time has passed depending upon which switch was activated

This circuit is however not good if the high-level is loosely spec'ed

Cheers

Klaus
 
Top