Non-matrix keypad layout and Input

Hi Arduino Community,

This is my first post and I am relatively new to Arduinos - mostly using available codes and doing tweaks more than anything. I am currently building an escape room.

I have an old phone that looks like a rotary phone but has physical buttons. The buttons do not appear to be in a matrix, and I don't need all the numbers to work. I have managed to figure out the wires that connect when buttons are pressed, as follows:

A+C=4
C+E=5
C+D=6
A+B=7
B+E=8
B+D=9
A+E=0

Can anyone point me in the right direction as to how to start coding this in an understandable manner please?

My plan is to then code it so when the correct number combination is entered, it activates a relay.

Thanks in advance

Tim

I think it is a matrix.

If it is a matrix, it is hard to see how the E wire could be connected both horizontally and vertically.

OP, you should double check your button/contact assignments. Or, open up the gizmo and actually look at how the buttons are wired.

Somehow like this?

That would be "Charlieplexing".

Easily implemented on an Arduino.

Paul__B:
That would be “Charlieplexing”.

Not exactly. You would only need 4 wires for Charlieplexing. And diodes in series with each button, which the OP didn’t mention, but may not have tested for.

@timdr23 you would connect the 5 wires to 5 Arduino pins. Hint: put those pin numbers into an array. Initially, all 5 pins would be set to INPUT_PULLUP mode. To scan the matrix, you would take each pin in turn and change its mode to OUTPUT and LOW. Then you would read the other 4 pins. If no buttons are pressed, then all 4 pins will read HIGH. But if any pin reads LOW, you have a connection between those two pins. You can make a lookup table to give the button value from the 2 pin numbers.

jremington:
If it is a matrix, it is hard to see how the E wire could be connected both horizontally and vertically.

OP, you should double check your button/contact assignments. Or, open up the gizmo and actually look at how the buttons are wired.

Thanks Guys, I checked my working and added in the other wires. Discovered it was a matrix as follows:

A E D
H1 2 3
C4 5 6
B7 8 9
F 0

This was great and thank you all for your help!!