Keypads: 4x3 and 5x4
The membrane keypad in three sizes: a twelve-key telephone pad, a twenty-key calculator pad, and the 4x4 you already know.
They are one part with a different number of crossings under the sticker, and the 4x4's page is the long version of how one works.
keypad (4x4) keypad4x3 (phone) keypad5x4 (calculator)
C1 C2 C3 C4 C1 C2 C3 C1 C2 C3 C4
R1 1 2 3 A R1 1 2 3 R1 C <- % /
R2 4 5 6 B R2 4 5 6 R2 7 8 9 x
R3 7 8 9 C R3 7 8 9 R3 4 5 6 -
R4 * 0 # D R4 * 0 # R4 1 2 3 +
R5 0 . +/- =
Pins
| Pin | What it does |
|---|---|
R1–R4, and R5 on the 5x4 |
Rows. |
C1–C3 on the 4x3, C1–C4 on the others |
Columns. |
Seven pins on the telephone pad, eight on the 4x4 and nine on the calculator pad. There is no chip on any of them and no supply: under each key is a carbon pad that shorts the row it is on to the column it is in, and the whole of reading one is the scan the sketch does.
Properties
None. The legend is a sticker, not wiring.
While it runs
Click a key to hold it down.
Click the pad and it takes your own keyboard: the characters printed on the
caps press their key, so 7 presses 7 and + presses plus. On the calculator pad
Enter is =, Backspace is the ← key, Delete or c is C and n is the
sign key. Escape hands the keyboard back to the canvas.
What the model gets right
Everything the 4x4 gets right, because it is the same model: a closed key is a real low-resistance contact passing whatever is on either side in either direction, and ghosting is there: three keys held in a rectangle make the fourth corner read as pressed, because the current has a way around through the three that are closed.
What it does not model
No diodes on the keys. Some keypads add one per key to stop ghosting; the cheap membrane kind does not, and neither do these.
The calculator pad's legend is one ASCII character per key, because a driver deals
in characters: the model and mokxi_keypad.h call the backspace <, the sign key
~ and the multiply x, while the picture prints ←, +/- and x the way a
desk calculator does.
Common mistakes
Driving a row high while scanning. With two keys held in the same column that puts a driven high and a driven low directly across one another, which is the classic way to let the smoke out of a real board, and the model does nothing to protect against it, because a keypad does not either. Drive the row you are looking at LOW and leave every other row an input.
Assuming the 4x3 is a 4x4 with a column missing in software. It is a different part with seven pins, and a sketch written for the 4x4 will read its columns one to the left.
See it in action
Calculator is the 5x4 pad and a 16x2 LCD doing four functions on an Uno, and Number guess is the telephone pad on the same board. Open either at /templates.