Estardyn MCP23017 I2C GPIO Expander Module

Contents

Estardyn MCP23017 I2C GPIO Expander Module

User Manual

1. Introduction

The Estardyn MCP23017 I2C GPIO Expander Module is a versatile 16-bit general-purpose input/output (GPIO) expander that communicates via the I2C serial interface. It is designed to provide additional I/O pins for microcontrollers, such as the Raspberry Pi, when the native GPIO count is insufficient for a project's needs.

The MCP23017 is capable of converting 16-bit parallel data to IIC interface serial data and vice versa. It integrates an internal power-on reset (POR) circuit, ensuring the device resets to its default state upon powering up. It features two programmable interrupt source outputs (INTA and INTB) and a polarity inversion register to configure the GPIO input polarity.

MCP23017 I2C GPIO Expander module with pin headers.
Figure 1: Estardyn MCP23017 I2C GPIO Expander Module with pin headers.

2. Specifications

Feature Specification
Model MCP23017 (CJMCU-2317)
Type Module, GPIO Expander
I/O Pins 16-Bit (GPA0-GPA7, GPB0-GPB7)
Interface I2C (Inter-Integrated Circuit)
Supply Voltage 1.8V - 5.5V
Operating Temperature Range -40°C to 85°C
IIC Communication Frequency Up to 1.7MHz
Operating Current 1µA
Package SMD
Hardware Address Pins A0, A1, A2 (3 pins)
Internal block diagram of the MCP23017 I2C GPIO Expander showing I2C interface, control logic, and GPIO ports.
Figure 2: Internal Block Diagram of MCP23017.

3. Package Contents

Your package should contain the following items:

  • 1 or 2 x MCP23017 I2C GPIO Expander Module(s)
  • Pin Headers (for soldering)
Front and back view of the MCP23017 module with included pin headers.
Figure 3: Front and back view of the module with pin headers.

4. Setup and Connection

Before connecting the module, ensure your development board (e.g., Raspberry Pi, Arduino) is powered off.

4.1 Pinout Description

The MCP23017 module features the following pins:

  • VCC: Power supply pin (1.8V to 5.5V).
  • GND: Ground connection.
  • SDA: I2C data signal line.
  • SCL: I2C clock signal line.
  • RESET: Active low reset pin for the device. Pull this pin low to reset the module.
  • A0, A1, A2: I2C device address configuration pins. These pins allow you to set the unique I2C address for the module.
  • INTA: Interrupt output for Port A.
  • INTB: Interrupt output for Port B.
  • GPA0-GPA7: 8-bit input/output pins for Port A (default to input mode).
  • GPB0-GPB7: 8-bit input/output pins for Port B (default to input mode).
Top view of the MCP23017 module showing pin labels for VCC, GND, I2C, Interrupts, and GPIO ports.
Figure 4: MCP23017 Module Pinout.
Detailed pinout diagram of the MCP23017 module showing connections for VCC, GND, I2C, Interrupts, and GPIO ports with internal pull-up resistors.
Figure 5: Detailed Pinout Diagram with Internal Connections.

4.2 I2C Address Configuration

The MCP23017 uses a 7-bit I2C slave address. The base address is 0x20 (binary 0100000). The A0, A1, and A2 pins allow you to modify the lower three bits of this address, enabling up to eight MCP23017 modules to be connected to a single I2C bus.

To set the address, connect A0, A1, and A2 to either VCC (HIGH) or GND (LOW). The resulting address will be 0x20 + (A2<<2 | A1<<1 | A0). For example:

  • A0=GND, A1=GND, A2=GND: Address 0x20
  • A0=VCC, A1=GND, A2=GND: Address 0x21
  • A0=GND, A1=VCC, A2=GND: Address 0x22
  • ...
  • A0=VCC, A1=VCC, A2=VCC: Address 0x27
I2C Slave Address control byte format for MCP23017, illustrating start bit, address bits A2-A0, and R/W bit.
Figure 6: I2C Slave Address Control Byte.

4.3 Basic Wiring

  1. Power: Connect the VCC pin to your microcontroller's 3.3V or 5V power supply (within the 1.8V-5.5V range) and GND to the ground.
  2. I2C Bus: Connect the SDA pin to your microcontroller's SDA line and SCL to the SCL line. Ensure appropriate pull-up resistors are used on the I2C lines if not already present on your microcontroller board.
  3. Address Pins: Configure A0, A1, A2 pins by connecting them to VCC or GND to set the desired I2C address. If using only one module, you can connect all three to GND for the default address 0x20.
  4. Reset Pin: Connect the RESET pin to VCC for normal operation, or to a GPIO pin on your microcontroller if you need software control over resetting the expander.
  5. GPIO Ports: Connect your external devices (sensors, LEDs, buttons) to the GPA0-GPA7 and GPB0-GPB7 pins as needed.

5. Operation

Operating the MCP23017 involves communicating with it via the I2C protocol from your microcontroller. Most programming environments (e.g., Arduino IDE, Python for Raspberry Pi) have libraries available to simplify this process.

5.1 Key Registers

The MCP23017 has several internal registers that control its behavior:

  • IODIR (I/O Direction Register): Configures each pin as an input (1) or an output (0). There are separate IODIR registers for Port A (IODIRA) and Port B (IODIRB).
  • GPIO (General Purpose I/O Port Register): Reads the current state of the input pins or writes to the output pins. Separate registers for Port A (GPIOA) and Port B (GPIOB).
  • OLAT (Output Latch Register): Provides access to the output latches. Writing to OLAT affects the output pins.
  • GPPU (GPIO Pull-up Resistor Register): Enables (1) or disables (0) the internal pull-up resistors for each pin.
  • INTCON (Interrupt Control Register): Controls how the interrupt-on-change feature works.
  • IOCON (I/O Expander Configuration Register): Configures various device features, including sequential operation, interrupt polarity, and address pin functionality.

5.2 Programming Example (Conceptual)

To use the module, you typically:

  1. Initialize the I2C communication on your microcontroller.
  2. Set the direction of the desired GPIO pins (input or output) by writing to the IODIRA/IODIRB registers.
  3. If using inputs, optionally enable internal pull-up resistors by writing to the GPPUA/GPPUB registers.
  4. To read an input, read from the GPIOA/GPIOB registers.
  5. To write to an output, write to the GPIOA/GPIOB or OLATA/OLATB registers.

Refer to the MCP23017 datasheet and specific library documentation for your chosen microcontroller for detailed programming instructions and register maps.

6. Maintenance

The MCP23017 I2C GPIO Expander Module is a robust electronic component designed for long-term use with minimal maintenance. Follow these guidelines to ensure its longevity:

  • Handle with Care: Avoid dropping or subjecting the module to physical shock.
  • Static Electricity: Always handle the module in an ESD-safe environment to prevent damage from electrostatic discharge.
  • Keep Dry: Protect the module from moisture and humidity, which can cause corrosion and short circuits.
  • Cleanliness: Keep the module free from dust and debris. If cleaning is necessary, use a soft, dry brush or compressed air. Avoid liquid cleaners.
  • Proper Storage: When not in use, store the module in an anti-static bag in a cool, dry place.

7. Troubleshooting

If you encounter issues with your MCP23017 module, consider the following common troubleshooting steps:

  • No I2C Communication:
    • Check Wiring: Verify all VCC, GND, SDA, and SCL connections are correct and secure.
    • I2C Address: Ensure the A0, A1, A2 pins are configured correctly and that your code is using the matching I2C address. If using multiple modules, each must have a unique address.
    • Pull-up Resistors: Confirm that appropriate pull-up resistors (typically 4.7kΩ to 10kΩ) are connected to the SDA and SCL lines. Many development boards have these built-in, but external ones may be needed.
    • Power Supply: Check that the module is receiving the correct voltage (1.8V-5.5V) and that the power supply is stable.
  • GPIO Pins Not Responding:
    • Direction Register: Double-check that you have correctly configured the IODIRA/IODIRB registers to set the pins as inputs or outputs as intended.
    • Output Latch: If writing to outputs, ensure you are writing to the correct register (GPIOA/GPIOB or OLATA/OLATB) and that the values are being latched.
    • Input State: If reading inputs, verify that external components are providing the expected high/low signals. Consider enabling internal pull-up resistors for floating inputs.
  • Module Not Resetting:
    • RESET Pin: Ensure the RESET pin is connected to VCC for normal operation. If controlled by a GPIO, verify the GPIO is not inadvertently holding it low.
    • Power Cycle: A full power cycle of your system can often resolve unexpected states.

8. User Tips

  • Multiple Modules: The A0, A1, and A2 address pins are crucial for using multiple MCP23017 modules on the same I2C bus. By configuring these pins individually (connecting them to VCC or GND), you can assign a unique I2C address to each module, allowing up to eight expanders (128 additional GPIOs) to operate simultaneously.
  • Software Libraries: For ease of use, leverage existing software libraries for the MCP23017 available for popular platforms like Arduino and Raspberry Pi. These libraries abstract away the low-level I2C communication and register manipulation, making it simpler to control the GPIO pins.
  • Power-On Reset: The integrated Power-On Reset (POR) circuit ensures the device starts in a known state (all pins configured as inputs). Always account for this default state in your initialization code.

9. Warranty and Support

For technical support, troubleshooting assistance, or inquiries regarding product warranty, please contact the seller or manufacturer directly through the platform where the product was purchased. Provide your order details and a clear description of the issue to facilitate a quicker resolution.

Ask a question about this manual

Ask about setup, troubleshooting, compatibility, parts, safety, or missing instructions. Manuals+ will review the question and use this page’s manual context to help answer it.

After a successful submission, we securely hash the supplied account or form email before sending it to Microsoft Advertising for conversion attribution. Privacy details.