Ghost keys on kbd matrix

Sep 02, 2004 19 Replies

Wow, I got bit pretty hard on a switch matrix I designed. I just threw the thing together, row and column, and of course, once three switches are on everything goes to hell.



The application is not a keyboard, I need to several dip switches (96 switches in all), and any combination of the switches may be on or off.



My eyes are bugging out trying to trace through the different combinations. Do I need a diode for each switch, or just for the rows and columns?



Thanks,



Mike


If you are scanning an x-y matrix, you need a diode for each switch. If your inputs are TTL compatible and outputs are CMOS and Vdd is 5V you can use pull-downs and stay within specs with some margin.

Best regards, Spehro Pefhany

"it's the network..." "The Journey is the reward" speff@interlog.com Info for manufacturers: http://www.trexon.com Embedded software/hardware/analog Info for designers: http://www.speff.com

Besides a wire to each sw, Is there any way to do this other than an x-y matrix?

Offhand, I can't think of any, sorry (but hey, it's late).

Consider the case where every switch is closed save one, then look at the difference of the last one being on or off.

Of course, it's possible to use shift registers and/or (de)multiplexers to get your one wire to each sw rather than using diodes.

Best regards, Spehro Pefhany

"it's the network..." "The Journey is the reward" speff@interlog.com Info for manufacturers: http://www.trexon.com Embedded software/hardware/analog Info for designers: http://www.speff.com

You can use a sea of shift registers, but that might count as a wire-per-switch (but so can a matrix ) ? You can also wire two switches across each cross point, by using two diodes in opposite directions, and smarter scan scheme, which doubles the matrix density. Or, you can wire binary weighted resistors on each switch, in small groups of 4-5, and use an analog scan scan to extract the bit information....

-jg

Put the switches in a series string with resistors like this...

100_Ohm --- 200_Ohm --- 400_Ohm --- 800_Ohm --- 1.6_KOhm --- 3.2_KOhm --- ... | | | | | | | | | | | | -- SWITCH ---- SWITCH ---- SWITCH ---- SWITCH ---- SWITCH --- ...

...and use the entire string in a RC circuit like this...

DIGITAL OUT --- RESISTOR_SWITCH_STRING ------ DIGITAL IN | | ----- ----- C | | ----- --- GND

...to measure the resistance by measuring the delay. This will allow you to tell if any combination of switches are closed - each combination has a unique total resistance.

You might want to have several such circuits so as to keep the end resistors from being too large/small, to keep it from being too slow, or avoid having to use precision components and from having to calibrate.

Guy Macon

... snip ...

Search the literature, including this group in the past 5 years. There are some ingenious designs out there that eliminate all components and yet detect multiple key downs, rollover, etc. The basic cost is that the full x*y combinations are not available.

A: Because it fouls the order in which people normally read text. Q: Why is top-posting such a bad thing? A: Top-posting. Q: What is the most annoying thing on usenet and in e-mail?

At that density I'd consider an EEPROM and some display / simpler keypad to set the numerous settings.

One aspect that needs consideration is testing- fully testing a setup like that *requires* physically operating each of the 96 switches individually.

OTOH, switches are easier to understand for some users and don't flip states even with the worst EMI.

Best regards, Spehro Pefhany

"it's the network..." "The Journey is the reward" speff@interlog.com Info for manufacturers: http://www.trexon.com Embedded software/hardware/analog Info for designers: http://www.speff.com

Quite true, but consider the EEPROM route can be quickly set to "factory" settings and allow for settings to be easily transferred to other systems, and can keep customer's statically charged hands away from potentially dangerous voltage levels.

Which means he probably doesn't care that much about rollover, for example, and that he wants to support all 2^96 possible permutations (though I've no idea why.) Anyway, it's a problem and a pain to many 'ingenious' methods.

Jon

with 2^96 permutations possible, it's pretty certain that the OP would have to break things up a lot, given what you are talking about with delay timing. Not a 'might want,' but a *must have*. It's very hard to imagine a single system of time delays, given about 8E28 permutations to separately observe, that could be discerned in human lifetimes though a single arrangement. :)

In any case, 96 diodes start looking really good when compared against ~96 resistors, some number of capacitors, and trying to discern timing.

I wonder if the OP really needs all 8E28 permutations, though.

Jon

That does smell like 96 isolation diodes, at least 8 resistors, and an 8 x 12 scanning matrix.

Some similarities between GWB and Mussolini: a) The strut; b) Making war until brought up short: Mussolini: Ethiopia, France, Greece. GWB: Afghanistan, Iraq.

Twelve strings with eight switches each could be managed. If the I/O can be tri-stated, you would only need one capacitor and one digital input , and would be using 13 I/O lines as opposed to the 20 that a 10x10 or 12x8 matrix would use.

Can 96 diodes handle the all switches closed except one case?

Gee, how about an 8-pin microcontroller with 64 bytes of EEPROM, and a MAX232 so you can program it from a standard serial port? Smaller, cheaper, less bugging out of the eyes.

Thanks to all!

"Jonathan Kirwan" wrote

I think I'm going to go with the 96 wires. Given the actual application, its going to save me a lot of money and board space.

Each switch represents something independent of all the other switches. (Its a crazy mixed up world :-)

Mike

"Fully testing" a parameter space of 2^96? You must be kidding. Even "literally forever" doesn't come close to describing how long that would take.

Hans-Bernhard Broeker (broeker@physik.rwth-aachen.de) Even if all the snow were burnt, ashes would remain.

I wondered if someone would pick up on that. Operating one switch at a time, with the others in the opposite state, (I think) will get ALL faults that are shorts/opens/missing or defective parts. That's (O) 96 operations, not (O) 2^96. Of course it's possible for there to be other faults (for example, if there was heavy PCB leakage that caused a wrong state when several switches were closed), but that is much less likely. Operating 96 switches by hand is still a PITA. I recently built a test routine into a product to check 16 dipswitches and immediately found a problem with my prototype (two port pins shorted).

Best regards, Spehro Pefhany

"it's the network..." "The Journey is the reward" speff@interlog.com Info for manufacturers: http://www.trexon.com Embedded software/hardware/analog Info for designers: http://www.speff.com

Walking ones followed by walking zeros; it's a great RAM test and this switch matrix is in one sense a RAM...

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required