Source: https://mokxi.com/parts/keypad1x4
Updated: 2026-11-22

Part

# Keypad, 1x4 strip

Four keys on one common line: scan it with the Keypad library as one row of four. The ribbon is not in key order.

See every part

- 5 pins
- In 1 project

Drawn live by the editor's own code, at the size you see it.

At a glance

## The Keypad, 1x4 strip in brief

What it is, and where it sits on the bench.

A 1x4 membrane keypad strip is four keys on a five-wire ribbon: one common line and one line per key. It has no chip and no supply. Under each key is a carbon pad that joins that key's line to the common line while you hold it, and nothing else. The Keypad library reads it as one row, the common line, and four columns, the keys: it pulls COM up, drives each key line low in turn and reads COM. The Mokxi model makes a closed key a real low-resistance contact that passes whatever is on either side in either direction, the same model as the 4x4 keypad. It leaves out contact bounce, so a key closes clean on the first edge; Keypad.h debounces anyway, but a hand-written loop with no debounce may count a press twice on a real strip. It also leaves out the resistance a carbon pad picks up as it wears. With only one row there is no rectangle of keys, so this strip cannot ghost. getKey() hands back only one key at a time.

Family

Inputs

Pins

5

Pins

## 5 pins

Named as the editor names them, so a wire lands where you expect it.

- K2
- K1
- K4
- K3
- COM

How to use it

## How to use the 1x4 membrane keypad strip with an Arduino Uno

The example project puts a four-key membrane strip on an Arduino Uno and prints each key you press. Five straight wires go from the ribbon into pins 6 to 2: K2 to pin 6, K1 to pin 5, K4 to pin 4, K3 to pin 3, and COM to pin 2. The ribbon is not in key order, so those wires put the keys on pins 5, 6, 3 and 4. Every key joins its own wire to the common one, so to the Keypad library the strip is a matrix of one row, COM, and four columns, the keys.

The sketch includes the Keypad library and sets up one row and four columns. rowPins holds pin 2 for COM, and colPins holds 5, 6, 3 and 4 for keys 1, 2, 3 and 4. In loop, keypad.getKey() returns one key at a time, and the sketch prints it after "key ". In setup it opens the serial monitor at 9600 baud and prints a banner naming the pins.

With default settings, the serial monitor printed: "Mokxi Uno: 1x4 keypad, COM on 2, keys 1 to 4 on 5, 6, 3, 4. Press a key." That line is the startup banner. It names pin 2 as the common line and pins 5, 6, 3 and 4 as keys 1 to 4, matching the out-of-order ribbon.

After key 1 was held down, the serial monitor printed: "key 1". The sketch prints the key the library found. You can also click the strip and press keys 1 to 4 on your keyboard. Hold several keys at once: every one closes, but getKey() still hands back only one at a time.

Part pin

Goes to

K2

Arduino Uno R3 pin 6

K1

Arduino Uno R3 pin 5

K4

Arduino Uno R3 pin 4

K3

Arduino Uno R3 pin 3

COM

Arduino Uno R3 pin 2

Click to open it in the editor

This is the simulator itself, running here. Click anything to open it in the editor.

Open this project in the editor Read the full tutorial

sketch.ino · Arduino Uno R3

Common errors

## Common Keypad, 1x4 strip errors and fixes

What goes wrong

The fix

Wiring the ribbon in key order.

Ribbon pin 1 is key 2, not key 1. A sketch that assumes 1-2-3-4 reads keys 1 and 2 swapped and 3 and 4 swapped, so follow the K1 to K4 pin order.

Driving COM high and a key line low with no resistor in between.

Leave the scanning to Keypad.h, or skip the library and put COM on GND with each key line on an INPUT_PULLUP pin.

Counting on contact bounce behavior in a hand-written loop.

Keypad.h debounces anyway, so a sketch that works here works on the bench, but add debounce to a hand-written loop or it may count a press twice on a real strip.

Questions

## Questions and answers

### how do i read a 1x4 keypad with keypad.h

Give the library one row, the common line, and four columns, the keys. It pulls COM up, drives each key line low in turn and reads COM.

### what is the 1x4 keypad ribbon pin order

The ribbon is not in key order. Counted from the end nearest key 1, the pins are K2, K1, K4, K3, then COM, so pin 1 is key 2, not key 1.

### can i read the 1x4 keypad without a library

Yes. Put COM on GND, each key line on an INPUT_PULLUP pin, and a held key reads LOW.

### can the 1x4 keypad ghost

No. With only one row there is no rectangle of keys, so unlike the bigger pads this strip cannot ghost. getKey() still hands back only one key at a time.

How it is modeled

## What is true about the Keypad, 1x4 strip, here

In its help article’s own words: what the simulation gets right, and where it stops.

### Modeled

A closed key is a real low-resistance contact between its line and COM, passing
whatever is on either side in either direction, the same model as the 4x4. Hold
several keys and every one of them closes. With only one row there is no rectangle
of keys, so unlike the bigger pads this strip cannot ghost. getKey() still hands
back only one key at a time, as on the bench; getKeys() and the key[] list read
up to ten at once.

### Not modeled

Contact bounce: a key closes clean on the first edge. Keypad.h debounces anyway,
so a sketch that works here works on the bench, but a hand-written loop with no
debounce may count a press twice on a real strip.

The resistance a carbon pad picks up as it wears: a closed key here is always a
clean, low-resistance contact.

From 1x4 membrane keypad strip, in full.

Projects

## See the Keypad, 1x4 strip in a project

One built-in project uses it. It opens in the editor, already wired.

Boards

## The boards it is shown on

This board has a built-in project with the Keypad, 1x4 strip in it.

- Arduino Uno R3

Libraries

## Arduino libraries for the Keypad, 1x4 strip

Built in, so the sketch compiles with nothing to install. Each page has the calls, the wiring and an example to run.

- Keypad

Keep going

## Keep going

- Keypad, 4x4
- Keypad, 4x3 telephone
- Pushbutton

More parts

## The rest of the bench

Every one of these is drawn and simulated the same way.

Full-size breadboard

A real 0.1 inch grid with the rails and the center channel, 63 columns wide.

Jumper wires

Drag from any pin or hole to any other. Corners snap, and you can drag them.

Power

A supply rail at the voltage you choose.

Ground

The other end of every circuit.

LED

Lights when current flows. Five colors, and the brightness is what your eye would see.

Filament lamp

A tungsten bulb in a holder: an inrush when it is switched on cold, tens of milliseconds to warm up, and dim on half its voltage.

Resistor

Any value you like, with the color bands drawn to match.

ESP32-C3-DevKitM-1

A RISC-V board that runs your firmware at 160 MHz on the real memory map.

Pushbutton

A 12 mm tactile switch. Hold it while the simulation runs.

Raspberry Pi Pico

The RP2040 board on our own Cortex-M0+ core. Pick a program and press Run.

Raspberry Pi Pico W

Raspberry Pi Pico W (RP2040). The same board and the same pinout as a Pico, with the CYW43439 on it. The WiFi is simulated (no radio; real internet through the Cloud panel’s switch), and the on-board LED, which hangs off that chip rather than off GP25, is driven through the same path. Everything else is the Pico.

Raspberry Pi 4 Model B

Raspberry Pi 4 Model B: the 40-pin header, driven by main.py with RPi.GPIO or gpiozero.

See every part

## Wire up the Keypad, 1x4 strip

Open the editor and push it into the breadboard. It is free, and it runs on your own machine.

Start building free Open the editor
