Looking for ideas to identify keypad matrices
Don M
Posts: 1,653
I have an idea for a project that needs to identify the matrix of a keypad. The keypad is an existing part in a system and it could be any variety of layouts, 3x4, 4x4, 2x10, etc.
I am thinking the way to go about this is to unplug the keypad and connect it directly to my "device" and through a series of orchestrated key-presses identify the matrix or "layout" of the keys. The unknown will be the identification of the row and column lines and how many of each there are but that is the intention of this.
So for instance if I have a 4 X 4 keypad one might expect there would be 4 row wires and 4 column wires. You would connect the 8 wires to the device having no idea which wires are the rows or columns and through a series of key-presses the device figures out the matrix. I don't care which are actually rows or columns but more importantly which 2 wires represents which key. This same scenario applies to any combination or rows / columns. They could even be randomly arraigned.
So what I'm looking for is an idea in which to scan the lines. There could be any number of connections from say 6 wires to 12 wires. I'm thinking the Propeller would be good for this application. Maybe take 1 line (wire) and set it as an output and the others as inputs and wait for a key press. Once identified move onto the next line (wire), etc... ?
When they are all identified store the configuration in eeprom and then reconnect the keypad into the system. Then parallel the wires from my device with the wires from the keypad / system so that my device can emulate the keypad. The one problem I see might be the interaction between my device and the original system while the original system is scanning the keypad. My device will only act as a keypad emulator so it won't do any scanning of its own.
Sorry for the rambling on here... just trying to think this out as I'm writing it.
I am thinking the way to go about this is to unplug the keypad and connect it directly to my "device" and through a series of orchestrated key-presses identify the matrix or "layout" of the keys. The unknown will be the identification of the row and column lines and how many of each there are but that is the intention of this.
So for instance if I have a 4 X 4 keypad one might expect there would be 4 row wires and 4 column wires. You would connect the 8 wires to the device having no idea which wires are the rows or columns and through a series of key-presses the device figures out the matrix. I don't care which are actually rows or columns but more importantly which 2 wires represents which key. This same scenario applies to any combination or rows / columns. They could even be randomly arraigned.
So what I'm looking for is an idea in which to scan the lines. There could be any number of connections from say 6 wires to 12 wires. I'm thinking the Propeller would be good for this application. Maybe take 1 line (wire) and set it as an output and the others as inputs and wait for a key press. Once identified move onto the next line (wire), etc... ?
When they are all identified store the configuration in eeprom and then reconnect the keypad into the system. Then parallel the wires from my device with the wires from the keypad / system so that my device can emulate the keypad. The one problem I see might be the interaction between my device and the original system while the original system is scanning the keypad. My device will only act as a keypad emulator so it won't do any scanning of its own.
Sorry for the rambling on here... just trying to think this out as I'm writing it.
Comments
Emulating the keyboard is a bit more involved and may require some hardware (level translators) if the voltage levels are different. For a simple 4x4 matrix where the system runs at a voltage compatible with the prop it would be very simple. Read the 4 inputs from the system, look up the output data and put it on the prop output pins.
PS - This was done on quite a few instruments to use a calculator chip to perform calculations on the raw data and present a final result.
That's easy to say, but could be a challenge to achieve.
If you work in the digital domain, the time from a Scan low, to Sense read can be quite short and your system needs to react fast enough, that it appears like a real button.
So you should test this delay-margin, by stretching until it fails, then you know how much time head room you have.
An alternative approach, is to side step this delay issue with an array of switches, also called crosspoint switches
The ST M22100 looks to be 4x4 cross point, and cheap and still available. You need to determine the X and Y axes, in two groups of 4.
After that, any virtual button can map any X to any Y, and you can emulate multiple key-press as well.
I have seen one scheme there a 4x4 keypad is wired to a resistor network and read by an ADC. That is a very simple 2 wire setup.
Serial is a Tx and a ground plus power, or 3 wires at the least in the asynchronous form.
Synchronous serial also need a clock pulse and is what your keyboard and mouse used to do before USB. But IBM loved to make it hard, so transmissions were 12 bits in one direction and 11 bits in the other.
Parallel would be rather obvious due to a lot of wires.
You may need an oscilloscope to really figure out the serial interfaces or at least the software that does an O-scope on a computer's audio card (the serial is rather slow).
Mostly, you need to get a catalog of what to look for.
Of course, identifying keypads without the driver method is much easier. Just a VOM and careful observations will do the job.
the danger with relays though is the scan time used as some contacts may close slower or not cleanly than others and give spurious readings. though I presume that there will be debounce circuitry further down the chain?