MCP23017 16-bit I/O expander con ESP32

Alimentazione 3.3-5 V Bus I2C Indirizzo I2C 0x20 / 0x21 / 0x22 / 0x23 / 0x24 / 0x25 / 0x26 / 0x27
VCCGNDSCLSDARESETINTAINTBA0A1A2

Pin e collegamento all’ESP32

PinRuoloPin ESP32Note
VCCAlimentazione3V3
GNDMassaGND
SCLClock I2C (SCL)D22
SDADati I2C (SDA)D21
RESETIngresso (lo pilota l’ESP32)D25Must be HIGH to run: tie to VCC
INTAInterruptD35
INTBInterruptVP
A0Non collegato all’ESP32—Address bit 0
A1Non collegato all’ESP32—Address bit 1
A2Non collegato all’ESP32—Address bit 2. Expander I/O pins GPA0-7 and GPB0-7 go to your LEDs or buttons

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(0x20);
  bool found = Wire.endTransmission() == 0;
  Serial.println(found ? "MCP23017 16-bit I/O expander found at 0x20" : "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.