
Our earlier articles covered how a matrix keypad works and walked through its Keypad.h reading code; this project puts both to use in a small, self-contained combo: showing each pressed key on an LCD screen instead of just the Serial Monitor.
Components needed
An Arduino Uno, a 4x3 or 4x4 membrane keypad, a 16x2 LCD display (direct-wired or via an I2C adapter), and connecting wires.
Wiring it up
The keypad's row and column pins connect to Arduino digital pins exactly as covered in our keypad code article. The LCD follows whichever wiring the module in hand needs — direct 12-pin wiring uses more digital pins but avoids sharing the I2C bus, while an I2C adapter frees up pins if the keypad and other components are already using several.
Programming it
Define the row/column map for the actual keypad and use the Keypad library or explicit debouncing so one press is not counted repeatedly. Track the 16-character line boundary and wrap to the second row or clear/reposition the cursor instead of writing beyond the visible display.
A simple addition: clearing the display
Since a 16x2 screen only holds 32 characters, most versions of this project map one of the keypad's keys — commonly the "*" or "#" key on a standard layout — to a clear-screen command, resetting the cursor to the start whenever the display fills up or the user wants to begin a fresh entry.
You can find membrane keypads and LCD displays at Juthour Tech.
Leave your comment