← All parts
MCP23017 16-bit I/O Expander
MCP23017
Microchipinterface io display
The MCP23017 is a 16-bit I/O expander that communicates via an I2C interface. It provides two 8-bit bidirectional ports, allowing microcontrollers to easily add more general-purpose input/output pins.
In stock
Specifications
13- Operating Voltage
- 1.8 to 5.5 V
- Standby Current Max
- 1 µA
- Supply Current Max
- 1 mA
- Interface
- I2C
- I2c Clock Speed Max
- 1.7 MHz
- Operating Temperature Range
- -40 to +125 °C
- Package
- 28-pin QFN, 28-pin SOIC, 28-pin SPDIP, 28-pin SSOP
- Number Of Io Pins
- 16
- Output Current Per Pin Sink Max
- 25 mA
- Output Current Per Pin Source Max
- 25 mA
- I2c Bus Capacitive Loading Max
- 400 pF
- Gpio Output Capacitive Loading Max
- 50 pF
- I2c Address Pins
- 3
Pinout
28| Pin | Name | Functions | Notes |
|---|---|---|---|
| 1 | GPB0 | GPIO | Bidirectional I/O pin for Port B. |
| 2 | GPB1 | GPIO | Bidirectional I/O pin for Port B. |
| 3 | GPB2 | GPIO | Bidirectional I/O pin for Port B. |
| 4 | GPB3 | GPIO | Bidirectional I/O pin for Port B. |
| 5 | GPB4 | GPIO | Bidirectional I/O pin for Port B. |
| 6 | GPB5 | GPIO | Bidirectional I/O pin for Port B. |
| 7 | GPB6 | GPIO | Bidirectional I/O pin for Port B. |
| 8 | GPB7 | GPIO | Bidirectional I/O pin for Port B. |
| 9 | VDD | POWER | Power supply voltage. |
| 10 | VSS | GND | Ground reference. |
| 11 | A0 | — | Hardware address pin 0. Must be externally biased. |
| 12 | A1 | — | Hardware address pin 1. Must be externally biased. |
| 13 | A2 | — | Hardware address pin 2. Must be externally biased. |
| 14 | RESET | — | Hardware reset input. Must be externally biased. |
| 15 | INTB | GPIO | Interrupt output for Port B. Configurable polarity/open-drain. |
| 16 | INTA | GPIO | Interrupt output for Port A. Configurable polarity/open-drain. |
| 17 | GPA0 | GPIO | Bidirectional I/O pin for Port A. |
| 18 | GPA1 | GPIO | Bidirectional I/O pin for Port A. |
| 19 | GPA2 | GPIO | Bidirectional I/O pin for Port A. |
| 20 | GPA3 | GPIO | Bidirectional I/O pin for Port A. |
| 21 | GPA4 | GPIO | Bidirectional I/O pin for Port A. |
| 22 | GPA5 | GPIO | Bidirectional I/O pin for Port A. |
| 23 | GPA6 | GPIO | Bidirectional I/O pin for Port A. |
| 24 | GPA7 | GPIO | Bidirectional I/O pin for Port A. |
| 25 | SCL | I2C | I2C Serial Clock input. |
| 26 | SDA | I2C | I2C Serial Data I/O. |
| 27 | NC | — | No Connect. |
| 28 | NC | — | No Connect. |
Interactive pinout
Highlight:
MCP23017
Click a pin to copy its name · tap a tag above to spotlight a bus.
Starter code
Community starter examples — minimal, unofficial, and provided to get you wiring fast. Verify against the manufacturer datasheet before relying on them.
Arduino (C++)
Arduino library: Adafruit MCP23017 Arduino Library
arduino
// MCP23017 16-bit I2C I/O expander — community starter example
#include <Adafruit_MCP23X17.h>
Adafruit_MCP23X17 mcp;
void setup() {
Serial.begin(115200);
if (!mcp.begin_I2C(0x20)) { Serial.println("MCP23017 not found"); while (1) delay(10); }
mcp.pinMode(0, OUTPUT); // port A, pin 0
mcp.pinMode(8, INPUT_PULLUP); // port B, pin 0
}
void loop() {
mcp.digitalWrite(0, HIGH);
delay(300);
mcp.digitalWrite(0, LOW);
delay(300);
Serial.println(mcp.digitalRead(8));
}MicroPython
MicroPython library: mcp23017 (mcauser/micropython-mcp23017)
python
# MCP23017 I2C I/O expander (ESP32) — community starter example
# lib: mcauser/micropython-mcp23017 (mcp23017.py on the board)
from machine import Pin, I2C
from mcp23017 import MCP23017
import time
i2c = I2C(0, scl=Pin(22), sda=Pin(21))
mcp = MCP23017(i2c, 0x20)
mcp[0].output() # GPA0 as output
while True:
mcp[0].value(1); time.sleep(0.3)
mcp[0].value(0); time.sleep(0.3)Wiring
| Pin | Arduino Uno R3 | ESP32 DevKitC (WROOM-32) | Notes |
|---|---|---|---|
| VDD | +5V | 3V3 | 1.8-5.5 V |
| VSS | GND | GND | |
| SDA | A4/SDA | GPIO21 | |
| SCL | A5/SCL | GPIO22 | |
| A0/A1/A2 | - | - | Tie to set address 0x20-0x27 |
| RESET | - | - | Tie to VDD (active-low reset) |
Typical uses
- 16 extra GPIO over I2C
- Button matrices and LED banks with interrupts