MCP23017 I2C to 16‑Bit I/O Expander Module Cascadable 128 IOs 3.3‑5V

Model:
MCP23017 I2C to I/O Module
Core Chip:
MCP23017
Interface:
I2C
I2C Address Range:
0x20 — 0x27
I/O Expansion:
16‑bit
Operating Voltage:
1.8V — 5.5V
I/O Drive Current:
25mA
Interrupt Pins:
INTA, INTB
Typical Operating Current:
1µA
Applications:
Robotics, Interactive media, LED cubes, Industrial automation, Sensor expansion

MCP23017 I2C to I/O module Product Overview

The MCP23017 I2C to I/O module is a 16‑bit I/O expander based on the MCP23017 chip, converting an I2C serial bus into 16 parallel digital I/O pins. It requires only two signal lines (SDA and SCL) to add 16 independently configurable GPIO pins to a microcontroller. Using onboard A0/A1/A2 address pins, up to 8 modules can be cascaded on a single I2C bus, expanding to 128 I/O ports. The module supports 3.3V and 5V logic levels with onboard level‑shifting circuitry, compatible with Arduino, Raspberry Pi, STM32, ESP32, and other mainstream platforms. It is widely used in robotics, interactive media, LED cubes, and industrial automation projects that require extensive I/O capabilities.


MCP23017 I2C to I/O module Core Features

The MCP23017 supports 16 independently configurable I/O pins, divided into two groups: GPIOA (PA0‑PA7) and GPIOB (PB0‑PB7). Each I/O pin can be individually configured as input, output, input with pull‑up (internal 100kΩ pull‑up resistor), or interrupt mode via configuration registers. The module provides two dedicated interrupt output pins, INTA and INTB, corresponding to Group A and Group B interrupt events, enabling efficient event‑driven applications.

The module communicates via a standard I2C interface with clock speeds up to 1.7MHz. Using three hardware address pins (A0, A1, A2), the I2C address can be configured to one of 8 addresses from 0x20 to 0x27, allowing up to 8 modules to be cascaded on the same bus. It supports a wide operating voltage range of 1.8V to 5.5V, compatible with both 3.3V and 5V systems. Typical operating current is only 1µA, making it ideal for battery‑powered devices. The operating temperature range is -40℃ to +125℃, meeting industrial‑grade requirements. Each I/O pin can sink/source up to 25mA, capable of driving small loads such as LEDs directly. Onboard reset circuitry (/RESET pin) restores the device to its default state. The module offers both PH2.0 connector and solder pad interface options, supporting parallel connection of multiple I2C modules.


MCP23017 I2C to I/O module Applications

The MCP23017 I/O expansion module is particularly suitable for projects that require a large number of digital I/Os but have limited microcontroller pins. Typical applications include multi‑channel sensor data acquisition, LED matrix control, keypad matrix scanning, LCD display driving, relay control, robotic arm joint control, robot sensor array integration, interactive art installations, large‑scale LED cubes, and industrial automation control systems.


MCP23017 I2C to I/O module Key Advantages

The MCP23017 I/O expansion module solves the problem of insufficient microcontroller I/O pins at very low cost. With just SDA and SCL signal lines, it provides 16 independently configurable GPIOs, and through cascading, it can expand to up to 128 I/O ports. Each I/O port supports four modes: input, output, input with pull‑up, and interrupt, making it flexible for various peripherals. The wide voltage range (1.8V‑5.5V) and onboard level‑shifting circuit make it compatible with both 3.3V and 5V systems without external level shifters. With 1µA quiescent current and a -40℃ to +125℃ wide temperature range, it meets low‑power and industrial‑grade requirements. Mature driver libraries and abundant sample code for Arduino, Raspberry Pi, and STM32 significantly lower the development barrier, making it an ideal choice for makers and engineers looking to expand I/O capabilities.


Why Choose QIXINWEI

Years of experience in the electronics industry. Trusted by global customers.

Massive In-Stock Inventory – Ready to ship promptly

BOM Matching Service – One-stop solution, save time

PCBA Customization – Professional engineering team creates tailor-made solutions based on your needs

Cost-Effective & Efficient – Better channel, better cost

A dedicated team makes your procurement smoother.

Contact us for BOM quotes or PCBA inquiries





FAQ

1. What is the MCP23017, and what problem does it solve?
The MCP23017 is a chip module that expands 16 general‑purpose input‑output (GPIO) pins over the I2C bus. Its core purpose is to solve the problem of insufficient MCU pins (e.g., on Arduino, ESP32, Raspberry Pi). By using only two I2C pins (SDA and SCL) of the MCU, you gain an additional 16 digital pins that can be independently configured as inputs or outputs. It is ideal for compact projects that need to control many relays, LED arrays, or read multiple switch states without moving to a higher‑pin‑count MCU.

2. Does the module support both 3.3 V and 5 V systems? How do I safely connect it to an MCU with a different logic level?
Fully supported. The MCP23017 operates from 1.8 V to 5.5 V, and both the I2C bus and GPIO pins are logic‑level compatible with 3.3 V and 5 V systems. Simply connect the module’s VCC pin to the corresponding supply voltage of your MCU (3.3 V for a 3.3 V system, 5 V for a 5 V system), and the I2C signal lines can be connected directly—no external level‑shifting ICs are required. The GPIO input and output voltages automatically track the supply voltage.

3. How do I distinguish the A0, A1, and A2 address pins? How do I calculate the module’s I2C address?
The module has three address‑selection pins (A0, A1, A2) that can be tied to GND or VCC to set a 3‑bit hardware address. The MCP23017’s 7‑bit base I2C address is 0x20, and the final address is 0x20 + (the binary value formed by A2 A1 A0). For example, with A0–A2 all connected to GND the address is 0x20; with A0 at VCC and A1, A2 at GND the address is 0x21. Using different combinations of these three pins, up to eight MCP23017 modules can be cascaded on a single I2C bus (addresses 0x20 through 0x27), expanding to a total of 128 GPIOs.

4. How do I use this module on Arduino, ESP32, or Raspberry Pi? Are there ready‑made libraries?
Very mature libraries are available. For Arduino and ESP32 platforms, the Adafruit MCP23017 Arduino library is recommended—it encapsulates all register read/write operations and allows pin direction and level control in just a few lines of code. On Raspberry Pi, you can use the `adafruit‑circuitpython‑mcp23017` Python library or operate the I2C device through the WiringPi library. These libraries provide a clean API, letting you control the expanded pins as if they were local GPIOs.

5. What can the 16 expanded GPIOs do? Can they directly drive relays or high‑power LEDs?
All 16 pins can be independently configured as inputs or outputs. Each output pin typically has a maximum source/sink current of 25 mA, with a total current limit of about 125 mA (check the specific datasheet). It can therefore directly drive ordinary LEDs (with a series current‑limiting resistor) but cannot directly drive relays, high‑power LED strips, or motors. To drive relays, you must pair the outputs with NPN transistors, MOSFETs, or a ULN2803 Darlington array to amplify the current. In input mode, the pins can read push‑buttons, DIP switches, digital sensor signals, etc. The chip also includes internal weak pull‑up resistors, simplifying button‑circuit connections.

6. How does the MCP23017 differ from a 74HC595 shift register? Which one should I choose?
The core difference lies in the interface protocol and control flexibility. The MCP23017 uses the I2C bus, requires no strict timing, allows independent read/write of individual pins, offers higher speed and flexibility, and supports interrupt output. The 74HC595 uses an SPI‑like shift protocol, is cheaper, but requires all output states to be serially shifted in at once; individual pins cannot be independently controlled. If your project only needs multiple digital outputs and cost is critical, the 74HC595 is adequate. If you need independent bidirectional I/O, interrupt capability, or multiple cascaded devices, the MCP23017 is the more professional and convenient choice.

7. What are the interrupt pins (INTA, INTB) for? How do I use them?
INTA and INTB are hardware interrupt output pins. When the state of any pin on the corresponding port changes, the module automatically pulls these pins low (active‑low by default), notifying the MCU that an event has occurred. This avoids the MCU having to continuously poll the I2C bus, dramatically reducing CPU load. Typically, you connect INTA to an external interrupt pin of the MCU. When an interrupt fires, the MCU reads the capture register of the MCP23017 to quickly obtain the changed pin number and current state. This is ideal for real‑time‑response applications such as keyboard scanning, rotary encoder reading, and sensor monitoring.

8. How do you cascade multiple MCP23017 modules? What is the maximum number of GPIOs that can be expanded?
By connecting modules in parallel on the I2C bus and assigning each a different address via A0/A1/A2, up to eight MCP23017 devices can be placed on a single I2C bus. Each chip provides 16 GPIOs, so 8 modules expand a total of 8 × 16 = 128 I/Os. To cascade, simply connect the SDA, SCL, VCC, and GND of each module in parallel, and give each module a unique address. It is recommended to place appropriate termination resistors (e.g., 4.7 kΩ pull‑ups) at the far end of the I2C bus to ensure communication stability over longer distances.

9. Why can’t I scan the module’s I2C address? How do I troubleshoot?
Follow these troubleshooting steps: ① Check that VCC and GND connections are secure—the module must be properly powered. ② Verify SDA and SCL wiring is correct and that pull‑up resistors are present on the I2C bus (typically 4.7–10 kΩ; if the MCU board lacks them, external ones must be added). ③ Ensure there is no address conflict on the same bus—if multiple modules are cascaded, each must have a unique A0/A1/A2 combination. ④ Use an I2C scanner sketch to test whether the address is readable; ready‑made I2C scanner scripts exist for both Arduino and Raspberry Pi. ⑤ If the device is still not found, try replacing the jumper wires or shortening the cable length—excessively long I2C bus lines or heavy interference can cause communication failure.

10. Can this module be used for keyboard scanning? How can I implement a 16‑key matrix?
It is very well suited. You can configure eight pins as outputs (column drivers) and eight pins as inputs (row detectors) to implement a 4×4 or 8×8 matrix keypad. Combined with the hardware interrupt feature, whenever any key is pressed, the MCP23017’s interrupt pin immediately notifies the MCU. The MCU then reads the capture register over I2C to precisely identify which key was pressed. This approach saves far more MCU pins compared to traditional GPIO scanning, eliminates the need for periodic polling, and significantly reduces software complexity and system power consumption.