Capacitive Touch Sensor
12-channel capacitive touch sensor. Detect touches on conductive pads, fruit, water, foil, or any conductive material.
Say it to PAL
“Make a touch piano: each pad plays a different note.”
The code PAL writes
const TOUCH = 'qwiic-mpr121';
const BUZZER = 'modulino-buzzer';
const notes = [262,294,330,349,392,440,494,523,587,659,698,784]; // C4-G5
const names = ['C4','D4','E4','F4','G4','A4','B4','C5','D5','E5','F5','G5'];
let prevState = 0;
p.onSensorChange(TOUCH, 'touch_state', (state: number) => {
const pressed = state & ~prevState;
const released = ~state & prevState & 0xFFF;
prevState = state;
// New electrode pressed — play its note (most recently pressed wins)
if (pressed) {
for (let i = 11; i >= 0; i--) {
if ((pressed >> i) & 1) {
p.write(BUZZER, 'tone', { frequency: notes[i], duration_ms: 2000 });
p.setVariable('note', names[i]);
break;
}
}
}
// All electrodes released — stop buzzer
if (released && state === 0) {
p.write(BUZZER, 'stop');
p.setVariable('note', '—');
}
});
p.setVariable('note', '—');
await p.waitUntilStopped();“Tell me when I touch or let go of a pad.”
The code PAL writes
const TOUCH = 'qwiic-mpr121';
let prevState = 0;
p.onSensorChange(TOUCH, 'touch_state', (state: number) => {
const pressed = state & ~prevState;
const released = ~state & prevState & 0xFFF;
prevState = state;
for (let i = 0; i < 12; i++) {
if ((pressed >> i) & 1) p.log('Electrode ' + i + ' pressed');
if ((released >> i) & 1) p.log('Electrode ' + i + ' released');
}
});
await p.waitUntilStopped();When to pick it
Use for custom touch interfaces, fruit pianos, water level sensing, or any project needing capacitive touch input on arbitrary conductive surfaces.
Good to know
- Electrodes need a connection wire to the conductive surface. Longer wires increase sensitivity to noise.
About it
The MPR121 is a 12-channel capacitive touch sensor controller. Each electrode can detect proximity and touch events on conductive surfaces. Connect to copper pads, conductive fabric, fruit, or any conductive object to create custom touch interfaces. Supports up to 4 sensors on one I2C bus via address selection. Features auto-calibration and configurable sensitivity thresholds.
Where to buy
Facts
Tested
It is in our catalog, but nobody has checked it on a real board. It may not work yet. Its driver is written, but it has not been tested on hardware yet.
I2C address
The Capacitive Touch Sensor answers at I2C address 0x5A. A jumper or pin moves it to 0x5B or 0x5C or 0x5D.
Current
29 µA
The catalog lists a typical draw of 29 µA for the Capacitive Touch, copied from the maker’s description and not measured by Palpable.
Board size
33.02 × 19.18 mm
The Capacitive Touch board measures 33.02 × 19.18 mm and stands 4.6 mm tall with its parts. It has 2 mounting holes. These dimensions are from the maker’s mechanical drawing.
Chip
MPR121
Its touch controller is the NXP MPR121.
Free to reuse
Every fact here is open data under CC BY 4.0. Copy it into your own docs or code, and credit Palpable. Download it
This record was last changed on October 6, 2026.