RutgerWillemsIf you're not sure, call me Will
Research

IO expansion chip selection

Recommendation

For general-purpose digital I/O expansion, use the Microchip MCP23x17 family.

  • MCP23017 — 16 GPIO, I²C
  • MCP23S17 — 16 GPIO, SPI
  • 74HC595 — preferred where large numbers of output-only signals are required

The MCP23x17 family is mature, widely used, well documented, readily available, and has extensive Arduino/ESP32 software support. Both variants remain in production. (microchip.com)

MCP23017 — default general-purpose choice

The MCP23017 provides 16 individually configurable inputs/outputs over I²C. Up to eight devices can share a bus, providing 128 GPIOs without an I²C multiplexer. Current parts support I²C operation up to 1.7 MHz. (microchip.com)

A major advantage over simpler expanders is its comprehensive interrupt support. (Microchip)

Use for: buttons, switches, configuration inputs, low-frequency signals and general mixed I/O.

MCP23S17 — SPI / encoder-oriented option

The MCP23S17 has essentially the same GPIO and interrupt architecture as the MCP23017 but uses SPI at up to 10 MHz. (microchip.com)

It is preferable where interrupt latency or rapid GPIO reads matter. One potential application is supporting banks of mechanical human-operated UI encoders, but not high-speed or position-critical shaft encoders.

Critical encoders should use hardware PCNT peripherals or a dedicated quadrature counter.

74HC595 — outputs

Where pins are exclusively outputs, the 74HC595 remains an attractive solution:

  • extremely common and inexpensive
  • trivial interface
  • easily daisy-chained
  • entire output state can be updated efficiently
  • avoids consuming GPIO-expander resources for signals that do not require input or interrupt functionality

Alternatives

The TI TCA9535 and NXP PCA9555 are good 16-bit I²C GPIO expanders and both provide interrupt outputs. The TCA9535 is an active TI product with eight selectable addresses and 400 kHz I²C; the PCA9555 similarly supports 16 GPIOs, eight addresses and an active-low interrupt output. (Texas Instruments)

They are good choices for straightforward GPIO expansion, but the MCP23x17’s richer interrupt system and INTCAP functionality make it preferable choice.

Default design choice: MCP23017 for general I/O, 74HC595 where output-only expansion is advantageous, and MCP23S17 only where the higher SPI access speed provides a concrete benefit.