4×4 Keypad

A 16-button matrix keypad wired as 4 rows by 4 columns, read over 8 digital pins with no power supply of its own.

4×4 Keypad: 16-button matrix input

What is the 4×4 Keypad?

The 4x4 keypad is a grid of 16 momentary switches arranged as four rows and four columns. Each button simply connects one row line to one column line when pressed, so the whole keypad is passive: it needs no power, just eight digital pins on the microcontroller.

To read it, the microcontroller scans the matrix. It drives one row at a time and checks which column line responds, which tells it exactly which of the 16 keys is down. A keypad library (such as the Arduino Keypad library) handles this scanning and maps each intersection to a character like 0-9, A-D, star, or hash.

Reading 16 keys with only 8 pins is the whole point of the matrix layout. The trade-off is that reliable multi-key detection needs extra diodes, so a plain keypad is best for one keypress at a time.

4×4 Keypad pinout

PinFunctionType
R1 Row 1DigitalBidirectional (GPIO)
R2 Row 2DigitalBidirectional (GPIO)
R3 Row 3DigitalBidirectional (GPIO)
R4 Row 4DigitalBidirectional (GPIO)
C1 Col 1DigitalBidirectional (GPIO)
C2 Col 2DigitalBidirectional (GPIO)
C3 Col 3DigitalBidirectional (GPIO)
C4 Col 4DigitalBidirectional (GPIO)

Specifications

Dimensions
69 × 77 × 1 mm

Verified from the Tinkered component library.

Circuit requirements

  • No VCC or GND is required for the keypad itself. Connect the four row pins and four column pins to eight digital GPIO pins.
  • Enable the internal pull-up (or pull-down) resistors on the pins the scan reads, so an unpressed key reads a defined level instead of floating. The Keypad library sets this up when you list the row and column pins.
  • Get the row and column pin order right. If the wiring order does not match the map in code, the wrong characters are reported even though the hardware is fine.
  • For reliable simultaneous multi-key presses, add a diode in series with each switch to prevent ghosting. Without diodes, some three-key combinations read as phantom presses.

Board compatibility

The 4×4 Keypad connects to any of the microcontrollers supported in Tinkered.

Common 4×4 Keypad mistakes

Mismatched row and column order

The eight pins must be listed in code in the same order as they are wired. A swapped row or column makes the keypad report the wrong characters even though every key works.

Leaving scan pins floating

Without pull-up or pull-down resistors the input pins float and report random presses. Use the internal pull-ups the keypad library expects.

Expecting reliable multi-key input

A plain matrix keypad without diodes suffers from ghosting, so pressing several keys at once can register phantom keys. Design for one key at a time or add per-switch diodes.

Assuming it needs power

The keypad is just switches. Wiring a VCC to it does nothing useful and, if bridged to a scan line, can confuse the reading. Only the eight signal pins are needed.

Popular 4×4 Keypad projects

Passcode door lock

Enter a PIN to release a servo or relay-driven latch, a classic access-control build.

Calculator or number entry

Feed digits into a display or logger for a simple calculator or data-entry pad.

Menu and mode selector

Use the letter keys to move through menus or switch modes on a project.

Combination-lock games

Build safe-cracking or memory games around entering the right key sequence.

Build with the 4×4 Keypad.

Drop the 4×4 Keypad into a circuit, write firmware, and simulate it in your browser, then deploy to real hardware. All in one editable Tinkered project.