MPR121 capacitive touch sensor (12 keys) con ESP32
Alimentazione 3.3 V
Bus I2C
Indirizzo I2C
0x5A / 0x5B / 0x5C / 0x5D
Pin e collegamento all’ESP32
| Pin | Ruolo | Pin ESP32 | Note |
|---|---|---|---|
| VCC | Alimentazione | 3V3 | 3.3 V (the chip must not get 5 V unless the board has a regulator) |
| GND | Massa | GND | |
| SCL | Clock I2C (SCL) | D22 | |
| SDA | Dati I2C (SDA) | D21 | |
| IRQ | Interrupt | D35 | LOW when a touch changes |
| ADD | Non collegato all’ESP32 | — | Address: GND 0x5A, VCC 0x5B, SDA 0x5C, SCL 0x5D |
| E0 | Non collegato all’ESP32 | — | Electrode 0: to a touch pad, foil or fruit |
| E1 | Non collegato all’ESP32 | — | |
| E2 | Non collegato all’ESP32 | — | |
| E3 | Non collegato all’ESP32 | — | |
| E4 | Non collegato all’ESP32 | — | |
| E5 | Non collegato all’ESP32 | — | |
| E6 | Non collegato all’ESP32 | — | |
| E7 | Non collegato all’ESP32 | — | |
| E8 | Non collegato all’ESP32 | — | |
| E9 | Non collegato all’ESP32 | — | |
| E10 | Non collegato all’ESP32 | — | |
| E11 | Non collegato all’ESP32 | — |
Collegamento consigliato per l’ESP32 DevKit a 30 pin, evitando i pin della flash, di sola lettura e di strapping. BoardPilot lo controlla mentre colleghi.
Codice di partenza (Arduino)
#include <Wire.h>
void setup() {
Serial.begin(115200);
Wire.begin(21, 22); // SDA = GPIO 21, SCL = GPIO 22
Wire.beginTransmission(0x5A);
bool found = Wire.endTransmission() == 0;
Serial.println(found ? "MPR121 capacitive touch sensor (12 keys) found at 0x5A" : "Not found: check power, GND and SDA/SCL");
}
void loop() {}
Fonti
- NXP MPR121 datasheet, ADDR pin selects 0x5A to 0x5D; supply 1.71 to 3.6 V
- Common MPR121 breakouts, Header order differs (Adafruit, CJMCU, SparkFun): check the silkscreen
Provalo in 3D in BoardPilot
Componenti simili
Dati dei componenti: CC BY 4.0, riutilizzabili citando BoardPilot.