Source: https://mokxi.com/parts/mpr121
Updated: 2026-11-19

Part

# Capacitive touch, MPR121

Twelve touch electrodes on I2C at 0x5A: a status bit each, and IRQ low when they change.

See every part

- 6 pins
- 1 setting
- In 1 project
- In 1 lesson

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

At a glance

## The Capacitive touch, MPR121 in brief

What it is, and every setting the properties panel gives it.

The MPR121 is the NXP chip with twelve capacitive touch electrodes on one I2C bus, here wired to twelve foil keys. The chip charges each electrode and measures the voltage it reaches; a finger adds capacitance, so the reading falls, and when it falls far enough below the electrode’s baseline the key is touched. The pins are VIN, 3 V to 5 V, GND, SCL, SDA, IRQ, open drain and low when the touches change, and ADDR, pulled down for address 0x5A. The address property is 0x5A by default, with 0x5B to 0x5D the others. The chip starts stopped and writing an electrode count to register 0x5E starts it. Hold a key to touch it, several at once if you like.

Family

Inputs

Pins

6

address

90

Pins

## 6 pins

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

Pin

What it does

VIN

Supply, 3 V to 5 V.

GND

Ground.

SCL

I2C clock.

SDA

I2C data.

IRQ

Open drain, low when the touches change, let go when the status is read. Optional.

ADDR

Pulled down on the board, for address 0x5A. Not used by the model.

How to use it

## How to build a touch piano with an MPR121 and an Arduino

VIN goes to 5 V and GND to ground, SCL to the Uno’s SCL and SDA to SDA, which are A5 and A4. The address is 0x5A. A piezo has pin 8 on one leg and ground on the other. IRQ is optional and the sketch does not use it.

The Adafruit library starts the chip, and cap.touched() returns a 12 bit mask with a bit for each electrode. The sketch plays the first touched key as a note with tone(), from C at 262 Hz up to B at 494 Hz, one octave, and stops with noTone() when no key is down. A key lights in the part’s window when the chip reports it touched, which is after its next sample, and only once a sketch has started the chip.

Part pin

Goes to

VIN

5 V

GND

GND

SCL

SCL (A5)

SDA

SDA (A4)

Piezo

Pin 8 and ground

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

Twelve keys, one octave

Common errors

## Common Capacitive touch, MPR121 errors and fixes

What goes wrong

The fix

The sketch says no MPR121.

Check SDA, SCL and power. The default address is 0x5A; the others are 0x5B to 0x5D.

The chip ignores the settings.

While it runs it ignores writes to the other registers, so a library writes its settings first and then starts it with register 0x5E.

No key lights in the window.

A key lights after the chip’s next sample and only once a sketch has started the chip. Run the sketch first.

Questions

## Questions and answers

### How many touches can the MPR121 read at once?

All twelve. Hold several keys at once and the touched mask has a bit for each.

### What is the MPR121’s I2C address?

0x5A by default, 90. The address property can be 0x5B, 0x5C or 0x5D.

### How does the MPR121 know a key is touched?

A finger adds capacitance, so the electrode’s reading falls. When it falls far enough below the baseline, past the electrode’s touch threshold, it is touched.

How it is modeled

## What is true about the Capacitive touch, MPR121, here

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

### Modeled

From the MPR121 datasheet:

Stop and run. The chip starts stopped. Writing a number of electrodes to the
electrode configuration register (0x5E) starts it, and while it runs it ignores
writes to the other registers, which is why a library writes its settings first.

The thresholds. Each electrode has its own touch and release threshold
(0x41 to 0x5A); touched when the baseline less the reading is over the touch
threshold, released when it is under the release threshold.

The status and IRQ. Two bytes of touch status at 0x00, and IRQ low until they
are read.

The sample interval. A new reading every 1 ms to 128 ms, as the second front-end
register (0x5D) says: 16 ms after a reset, 1 ms once Adafruit's library sets it up.

### Not modeled

The capacitance itself: an untouched electrode reads 700 counts and a finger takes 40
off, numbers chosen to clear the Adafruit library's default threshold of 12. The
baseline does not drift, and the filter, debounce and auto-configuration registers
are stored but do not change anything. Proximity sensing and the GPIO and LED
drivers are not modeled.

From Capacitive touch, MPR121, in full.

Projects

## See the Capacitive touch, MPR121 in a project

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

Lessons

## Where it turns up in a lesson

One lesson places it in its own circuit.

### Learn articles

1 lesson

- Arduino MPR121: 12-Key Capacitive Touch Piano

Boards

## The boards it is shown on

This board has a built-in project with the Capacitive touch, MPR121 in it.

- Arduino Uno R3

Libraries

## Arduino libraries for the Capacitive touch, MPR121

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

- Adafruit MPR121

Keep going

## Keep going

- Arduino Touch Sensor (TTP223): Wiring and Code
- I2C Explained: Addresses, Acknowledges and Pull-Ups
- Touch sensor, TTP223
- Piezo speaker
- Keypad, 4x4
- Touch foil

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 Capacitive touch, MPR121

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
