Non matrix keyboard

Hello everybody,
I'm quite new to this forum and not so new to arduino and recently I stumbled to a puzzle I can't solve. So here it is:
I recently acquired a used keyboard/keypad and I want to use it for one of my DIY projects. So i grabbed my multimeter and started figuring out how the buttons are connected in the output pins of attached cable.

What i found out was that it is not a matrix arrangement as I was used to with keypads. Instead the signal arangement is ridiculous. As can be seen on attached image I numbered, the two rows of input pins, from 1 to 20 (from left to right, don't ask why :stuck_out_tongue: )
After some time when I tried all 190 combinations (permutations) i got the result table that I also attached. As can be seen there is no common ground for all buttons or anything like that. All pins of the cable are used except for pun 10 and 20.

So all in all I have 19 pins that are mixed and used multiple times to address all the buttons.

Example: if I push button Esc connection is bridged between pin 14 and 4, but pin 14 is also used for buttons F2, F4, and Code.

Since I have only 13 digital I/O pins on arduino I had a problem on my hands. How to test every button, possibly in a loop??

I tried to use 3x CD4051 multiplexers for putting HIGH on one of 19 pins and another 3 CD4051 for reading all the other pins, but that was an impossible ammount of wiring and still it used 12 Arduino I/O pins.

Anybody has any idea how I could solve this?
Thanx for all the help in advance.

Get a MegaArduino. That have plenty of I/O pins for your task

Have you considered you have three keyboards with a few common connections?

Paul

I'm wondering if the diagram might make better sense if you listed the lines in ribbon-cable order: 1,11,2,12,3,13...

Paul_KD7HB:
Have you considered you have three keyboards with a few common connections?

Paul

No I actualy havent :stuck_out_tongue: Don't know how I didn't see that. Thanx for the insight. Still havin problems with insuficient I/O pins though. I though some kind of IC might exist that would help.

johnwasser:
I'm wondering if the diagram might make better sense if you listed the lines in ribbon-cable order: 1,11,2,12,3,13...

I rearanged it - doesnt make any more sense. What am I missing?

P.s. I also turned the ribbon around 180° so it makes more sense how I numbered the pins. Not that it matters :wink:

10/20 appear to be unconnected.
8/9 is a special pair, so maybe can act as regular switch: one to GND, the other to a dedicated input.
That leaves you with 17 total connections (no problem for an Uno but you're pretty much out of pins).

Then indeed a few groups. It looks like you can group the numbers:
1/4 = 0
1/5 = 9
11/4 =1
11/5 = 3
11/6 = 5
11/7 = 7
1/15 = 8
11/15 = 2
11/16 = 4
11/17 = 6

Anyway, it very much does look like a matrix to me. Just with lots of combinations left unused.

An option to scan the pins would be an MCP23017 port expander (16 outputs - I2C connection to the Arduino). Set all pins to INPUT with pull-up resistor enabled, then set one to OUTPUT, LOW, and read back the pins (you can read all 16 in a single command, otherwise the I2C overhead is too much). Repeat for all 16.

Thanx a lot guys. You've been a great help. I have a way to go now :stuck_out_tongue:

Uno analog pins are also digital pins.

You can attach shift register chips to the SPI bus and add pins.

I see one error and 2 matrices:
"a flip" is listed twice, looks like an error.
(1 2 3 11 12 13 14) x (4 5 6 7 15 16 17)
(9) x (8 18 19)

it is not an error. The keyboard is just made that way.

Thank you guys again. With your help I got to a point where I only have to check a matrix of 8x10 instead of 20x20 from which I started :wink:

Final matrix (1,2,3,9,11,12,13,14) x (4,5,6,7,8,15,16,17,18,19)

or I could break it down to a few smaller ones like DrDiettrich and Paul_KD7HB suggested,
still deciding on that.

I'm sure It's gonna be nothin' but smooth sailing from here on :))