MCP23009T-E/SS: I/O Expander Design Guide and Application Circuit Examples
In embedded system design, the scarcity of General-Purpose Input/Output (GPIO) pins on a microcontroller (MCU) is a common constraint. The MCP23009T-E/SS, a 16-pin serial I/O expander from Microchip Technology, provides an elegant solution to this problem. This device offers 8 additional GPIO pins via a simple I²C serial interface, making it an indispensable component for expanding the I/O capabilities of resource-constrained MCUs. This article serves as a design guide and presents practical application circuits for this versatile IC.
Key Features and Design Considerations
The MCP23009T-E/SS operates as an I²C slave device, with its 7-bit slave address configurable via three address pins (A0, A1, A2), allowing up to eight devices to coexist on the same I²C bus, providing a potential 64 additional I/O lines. Key features that influence design include:
Simple I²C Interface: Requires only two MCU pins (SDA, SCL) for communication, drastically saving MCU resources.
Configurable I/O Pins: Each of the 8 GPIO pins (GP0-GP7) can be individually software configured as an input or output.
Interrupt Output: The INT pin provides a configurable interrupt signal to the host MCU upon changes on any input pin, eliminating the need for constant polling and improving system efficiency.
Internal Registers: A set of registers (IODIR, IPOL, GPINTEN, DEFVAL, INTCON, GPPU, INTF, INTCAP, GPIO, OLAT) allows for precise control over pin direction, input polarity, pull-up resistors, and interrupt behavior.
High Sink/Source Current: Each pin can sink/source up to 25 mA, enabling it to drive LEDs or other small peripherals directly.
Design Guide: Getting Started
1. Hardware Connection: The basic connection involves linking the SDA and SCL pins of the MCP23009 to the corresponding I²C lines on the MCU. Pull-up resistors (typically 4.7kΩ) are mandatory on both SDA and SCL lines for proper I²C bus operation. The VDD and VSS pins are connected to the system power supply (1.8V to 5.5V).
2. Address Configuration: Set the desired I²C address by connecting the A0, A1, and A2 pins to either VSS (logic 0) or VDD (logic 1). The base address for writing is 0x40; for reading, it is 0x41. The full address is (0x40 | (A2<<2) | (A1<<1) | A0).
3. Software Initialization: The MCU must initialize the I/O expander via I²C commands. A typical initialization sequence involves:
Writing to the IODIR register to set the direction of each pin (1 = Input, 0 = Output).
Configuring the GPPU register to enable internal 100kΩ pull-up resistors on input pins, if required.

Setting up the interrupt control registers (GPINTEN, DEFVAL, INTCON) if the interrupt feature is needed.
Application Circuit Examples
1. LED Driver and Tactile Switch Interface
This is a classic application for maximizing MCU pins. Connect 8 LEDs (with current-limiting resistors) to the GPIO pins configured as outputs. Simultaneously, connect 8 tactile switches to the same GPIO pins. By using the internal pull-up resistors (enabled via the GPPU register), the switches can be read directly. The interrupt-on-change feature can be configured so that the INT pin alerts the MCU the moment any switch is pressed, allowing the MCU to read the GPIO register in response and determine which switch changed state. This demonstrates reading inputs and writing outputs on the same port.
2. Multi-Channel Sensor Hub
In a data acquisition system, multiple digital sensors (e.g., temperature, humidity, motion) can be connected to the MCP23009's GPIO pins. The INT pin can be wired to an MCU interrupt pin. Each sensor's data-ready signal can be connected to a different GPIO input pin on the expander. When any sensor has data available, it triggers an interrupt. The MCU reads the INTF register to identify which specific pin caused the interrupt and then services that particular sensor. This allows a single MCU interrupt line to manage events from up to 8 different sensors.
3. LCD Display Control (Using 4-bit Mode)
A standard character LCD in 4-bit mode requires 6 control lines (RS, E, D4, D5, D6, D7). Using the MCP23009, the entire LCD can be controlled, freeing up precious MCU pins. The RS and E control pins are connected to two GPIOs, while D4-D7 are connected to four others. The MCU sends commands and data by writing to the expander's output latch register (OLAT), which updates the states of these six lines, effectively bit-banging the LCD protocol over I²C.
ICGOOODFIND
The MCP23009T-E/SS stands out as an exceptionally flexible and cost-effective solution for I/O expansion. Its simple I²C interface, hardware-configurable addressing, and robust interrupt capability make it ideal for a vast array of applications, from adding simple button and LED interfaces to creating complex multi-sensor monitoring systems. Its ability to simplify PCB layout and reduce MCU resource burden ensures it remains a fundamental component in an embedded engineer's toolkit.
Keywords:
I²C Interface
GPIO Expander
Interrupt-on-Change
Input/Output Expansion
MCP23009
