MPR121 capacitive touch sensor (12 keys) con ESP32

Alimentazione 3.3 V Bus I2C Indirizzo I2C 0x5A / 0x5B / 0x5C / 0x5D
VCCGNDSCLSDAIRQADDE0E1E2E3E4E5E6E7E8E9E10E11

Pin e collegamento all’ESP32

PinRuoloPin ESP32Note
VCCAlimentazione3V33.3 V (the chip must not get 5 V unless the board has a regulator)
GNDMassaGND
SCLClock I2C (SCL)D22
SDADati I2C (SDA)D21
IRQInterruptD35LOW when a touch changes
ADDNon collegato all’ESP32—Address: GND 0x5A, VCC 0x5B, SDA 0x5C, SCL 0x5D
E0Non collegato all’ESP32—Electrode 0: to a touch pad, foil or fruit
E1Non collegato all’ESP32—
E2Non collegato all’ESP32—
E3Non collegato all’ESP32—
E4Non collegato all’ESP32—
E5Non collegato all’ESP32—
E6Non collegato all’ESP32—
E7Non collegato all’ESP32—
E8Non collegato all’ESP32—
E9Non collegato all’ESP32—
E10Non collegato all’ESP32—
E11Non 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

Provalo in 3D in BoardPilot

BoardPilot Dati del componente (JSON)

Componenti simili

Dati dei componenti: CC BY 4.0, riutilizzabili citando BoardPilot.