Controller Digital

4x4 Keypad

A 4x4 keypad is a matrix of 16 buttons arranged as four rows and four columns.

Part images

4x4 keypad. Sixteen keys are read through a row-column matrix. Image source: SunFounder Pico 2 W Starter Kit documentation, Components section, © 2026 SunFounder.

What it is

A 4x4 keypad is a matrix of 16 buttons arranged as four rows and four columns.

How students use it

Students use it for passcodes, menus, calculators, number games, and projects that need many buttons without spending sixteen GPIO pins.

Pins and power

Eight useful lines: four rows and four columns. Each key connects one row to one column when pressed.

Passive switch matrix. Use 3.3V-safe GPIO scanning with pull-up or pull-down inputs.

Scan one side of the matrix at a time and read the other side. Pull-up or pull-down resistors keep unpressed inputs from floating.

Voltage and safety

Keep all row and column lines on Pico-safe 3.3V GPIO. Do not mix keypad scanning with external voltages.

Power off before moving ribbon/header wiring. Do not pull hard on the membrane tail.

Module internals

Sixteen button contacts, row conductors, column conductors, flexible membrane, printed labels, and an eight-line header/ribbon connection.

Datasheet notes

SunFounder explains the row-column matrix behavior but does not list a manufacturer part number for the keypad.

Common libraries

No required library. A small scanner loop using machine.Pin is enough; debounce and key-repeat behavior should be deliberate.

Common mistakes

Reversing row/column order, leaving inputs floating, scanning too fast without debounce, and not handling two-key ghosting behavior.