Free wiring guides
Wire the 3×4 keypad to the ESP32-S3
Membrane keypad, 3×4. Twelve keys on seven wires.
When buying: Seven pins: four rows, then three columns.
Which pin goes where
| On the part | On the ESP32-S3 |
|---|---|
| R1 | GPIO 4 |
| R2 | GPIO 5 |
| R3 | GPIO 6 |
| R4 | GPIO 7 |
| C1 | GPIO 15 |
| C2 | GPIO 16 |
| C3 | GPIO 17 |
Wire it with the USB cable unplugged. Follow the names printed on your own part: makers sometimes reorder the pins.
In 3D
Example sketch
// Membrane keypad, 3×4
// on the ESP32-S3-DevKitC-1 (N8R2 or N16R8)
// https://stem.manusignal.com/en/parts/3x4-keypad-esp32-s3
#include <Keypad.h>
const int PIN_R1 = 4;
const int PIN_R2 = 5;
const int PIN_R3 = 6;
const int PIN_R4 = 7;
const int PIN_C1 = 15;
const int PIN_C2 = 16;
const int PIN_C3 = 17;
char keys[4][3] = {{'1', '2', '3'}, {'4', '5', '6'}, {'7', '8', '9'}, {'*', '0', '#'}};
byte rowPins[4] = {PIN_R1, PIN_R2, PIN_R3, PIN_R4};
byte colPins[3] = {PIN_C1, PIN_C2, PIN_C3};
Keypad keypad = Keypad(makeKeymap(keys), rowPins, colPins, 4, 3);
void setup() {
Serial.begin(115200);
}
void loop() {
char key = keypad.getKey();
if (key) Serial.println(key);
}
- Tools > Board > ESP32S3 Dev Module, then Tools > Port and choose the board's port.
- Keypad: install it from Sketch > Include Library > Manage Libraries.
This sketch is compiled for the board before the page is published. It has not been run on real hardware by us.
What you should see
Open the Serial Monitor at 115200. Each key prints its own character.
If it does not work
- The wrong key registers.
- The ribbon is plugged in mirrored. Pin 1 is on the left with the keys facing you.
Build something with it
These Build Packs use this part on this board, with the same pins.
More parts on the ESP32-S3
- ST7789 1.54 in TFT screenESP32-S3 · 7 wires
- ST7789 2.0 in TFT screenESP32-S3 · 7 wires
- GC9A01 round screenESP32-S3 · 7 wires
- SSD1306 OLED 0.96 in screenESP32-S3 · 4 wires
- SSD1306 OLED 0.91 in screenESP32-S3 · 4 wires
- 4.2 in e-paper screenESP32-S3 · 8 wires
- TTP223 touch sensorESP32-S3 · 3 wires
- Push buttonESP32-S3 · 2 wires
- Foot switchESP32-S3 · 2 wires
- Slide switchESP32-S3 · 2 wires
- SW-520D tilt switchESP32-S3 · 2 wires
- MC-38 door switchESP32-S3 · 2 wires
- AM312 PIR motion sensorESP32-S3 · 3 wires
- HC-SR04 ultrasonic sensorESP32-S3 · 4 wires
- Capacitive soil moisture sensorESP32-S3 · 3 wires
- BME280 sensorESP32-S3 · 4 wires
- MLX90614 infrared thermometerESP32-S3 · 4 wires
- SGP30 air quality sensorESP32-S3 · 4 wires
- HX711 load cellESP32-S3 · 4 wires
- KY-040 rotary encoderESP32-S3 · 5 wires
- Passive buzzerESP32-S3 · 2 wires
- WS2812 LED ringESP32-S3 · 3 wires
- WS2812 LED stickESP32-S3 · 3 wires
- WS2812B LED stripESP32-S3 · 3 wires
- KY-016 RGB LEDESP32-S3 · 4 wires
- 2-channel relay moduleESP32-S3 · 4 wires
- 28BYJ-48 stepper motor (ULN2003)ESP32-S3 · 6 wires
- MAX98357A I2S amplifierESP32-S3 · 5 wires
- SX1262 LoRa module (Ra-01SH)ESP32-S3 · 9 wires