Cirkit Designer Logo
Cirkit Designer
Your all-in-one circuit design IDE
Home / 
Component Documentation

How to Use IO Expander MCP23017 Breakout: Examples, Pinouts, and Specs

Image of IO Expander MCP23017 Breakout
Cirkit Designer LogoDesign with IO Expander MCP23017 Breakout in Cirkit Designer

Introduction

The MCP23017 IO Expander Breakout, manufactured by Soldered (Part ID: 333007), is a versatile 16-bit I/O expander that communicates via the I2C protocol. It allows microcontrollers to extend their GPIO capabilities by adding 16 additional input/output pins. This breakout board simplifies the integration of the MCP23017 into your projects by providing easy access to all pins and connections.

Explore Projects Built with IO Expander MCP23017 Breakout

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
MCP23017-Expanded I/O Interface with ADS1115 ADC and ESP32 Control
Image of door and window sensors: A project utilizing IO Expander MCP23017 Breakout in a practical application
This circuit features two MCP23017 I/O expanders interfaced with multiple switches, allowing for the expansion of input capabilities. The MCP23017s are connected via I2C to an Olimex ESP32-EVB microcontroller, which likely manages the input states from the switches. Additionally, an Adafruit ADS1115 16-bit ADC is included, suggesting that some analog inputs are being monitored, with the ADC also interfaced with the ESP32 via I2C.
Cirkit Designer LogoOpen Project in Cirkit Designer
I2C-Controlled Relay Switching with ESP32 and MCP23017 for Home Automation
Image of Vloerverwarming: A project utilizing IO Expander MCP23017 Breakout in a practical application
This circuit appears to be a control system utilizing two MCP23017 I/O expanders interfaced with an Olimex ESP32-EVB microcontroller via I2C communication, as indicated by the SDA and SCL connections with pull-up resistors. The MCP23017 expanders control an 8-channel relay module, allowing the microcontroller to switch various loads, potentially for home automation or industrial control. Additionally, there is an Adafruit ADS1115 16-bit ADC for analog signal measurement, and several heating actuators and a thermostat are connected, suggesting temperature control functionality.
Cirkit Designer LogoOpen Project in Cirkit Designer
ESP32-Based I2C Communication Hub with Multiplexer and Expander
Image of Lights: A project utilizing IO Expander MCP23017 Breakout in a practical application
This circuit features an Olimex ESP32-EVB microcontroller unit (MCU) for processing and connectivity, interfaced with an MCP23017 I/O expander and an Adafruit TCA9548A I2C multiplexer to expand the number of I/O lines and allow multiple I2C devices to communicate with the MCU over the same bus. Pull-up resistors are connected to the I2C lines for proper bus operation, and both the MCP23017 and TCA9548A have their reset lines pulled high, likely for normal operation without external reset control.
Cirkit Designer LogoOpen Project in Cirkit Designer
Wi-Fi Controlled Relay Module with ESP8266 and MCP23017
Image of smart home: A project utilizing IO Expander MCP23017 Breakout in a practical application
This circuit is a WiFi-enabled relay control system using an ESP8266-01 module and an MCP23017 I/O expander. The ESP8266 communicates with the MCP23017 via I2C to control an 8-channel relay module based on the state of 8 rocker switches, allowing for remote and manual control of connected devices.
Cirkit Designer LogoOpen Project in Cirkit Designer

Explore Projects Built with IO Expander MCP23017 Breakout

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
Image of door and window sensors: A project utilizing IO Expander MCP23017 Breakout in a practical application
MCP23017-Expanded I/O Interface with ADS1115 ADC and ESP32 Control
This circuit features two MCP23017 I/O expanders interfaced with multiple switches, allowing for the expansion of input capabilities. The MCP23017s are connected via I2C to an Olimex ESP32-EVB microcontroller, which likely manages the input states from the switches. Additionally, an Adafruit ADS1115 16-bit ADC is included, suggesting that some analog inputs are being monitored, with the ADC also interfaced with the ESP32 via I2C.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of Vloerverwarming: A project utilizing IO Expander MCP23017 Breakout in a practical application
I2C-Controlled Relay Switching with ESP32 and MCP23017 for Home Automation
This circuit appears to be a control system utilizing two MCP23017 I/O expanders interfaced with an Olimex ESP32-EVB microcontroller via I2C communication, as indicated by the SDA and SCL connections with pull-up resistors. The MCP23017 expanders control an 8-channel relay module, allowing the microcontroller to switch various loads, potentially for home automation or industrial control. Additionally, there is an Adafruit ADS1115 16-bit ADC for analog signal measurement, and several heating actuators and a thermostat are connected, suggesting temperature control functionality.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of Lights: A project utilizing IO Expander MCP23017 Breakout in a practical application
ESP32-Based I2C Communication Hub with Multiplexer and Expander
This circuit features an Olimex ESP32-EVB microcontroller unit (MCU) for processing and connectivity, interfaced with an MCP23017 I/O expander and an Adafruit TCA9548A I2C multiplexer to expand the number of I/O lines and allow multiple I2C devices to communicate with the MCU over the same bus. Pull-up resistors are connected to the I2C lines for proper bus operation, and both the MCP23017 and TCA9548A have their reset lines pulled high, likely for normal operation without external reset control.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of smart home: A project utilizing IO Expander MCP23017 Breakout in a practical application
Wi-Fi Controlled Relay Module with ESP8266 and MCP23017
This circuit is a WiFi-enabled relay control system using an ESP8266-01 module and an MCP23017 I/O expander. The ESP8266 communicates with the MCP23017 via I2C to control an 8-channel relay module based on the state of 8 rocker switches, allowing for remote and manual control of connected devices.
Cirkit Designer LogoOpen Project in Cirkit Designer

Common Applications and Use Cases

  • Expanding GPIO capabilities of microcontrollers like Arduino, Raspberry Pi, or ESP32.
  • Controlling multiple LEDs, relays, or other digital devices.
  • Reading multiple button inputs or sensors.
  • Building complex projects requiring more I/O pins than the microcontroller natively supports.

Technical Specifications

Key Technical Details

  • Communication Protocol: I2C
  • Operating Voltage: 1.8V to 5.5V
  • Maximum Current per Pin: 25mA
  • Maximum Total Current: 125mA
  • Number of GPIO Pins: 16 (organized as two 8-bit ports: GPIOA and GPIOB)
  • I2C Address Range: 0x20 to 0x27 (configurable via address pins)
  • Interrupt Pins: INT A and INT B for interrupt-driven applications
  • Operating Temperature: -40°C to +85°C

Pin Configuration and Descriptions

The MCP23017 breakout board provides access to all necessary pins for operation. Below is the pinout:

Pin Name Description
VCC Power supply input (1.8V to 5.5V).
GND Ground connection.
SDA I2C data line.
SCL I2C clock line.
A0, A1, A2 Address selection pins (configure I2C address).
RESET Active-low reset pin (optional, can be tied to VCC for normal operation).
INT A Interrupt output for GPIOA (active-low).
INT B Interrupt output for GPIOB (active-low).
GPIOA0-7 General-purpose I/O pins for Port A.
GPIOB0-7 General-purpose I/O pins for Port B.

Usage Instructions

How to Use the MCP23017 in a Circuit

  1. Power the Breakout Board: Connect the VCC pin to your microcontroller's power supply (1.8V to 5.5V) and GND to ground.
  2. Connect I2C Lines: Connect the SDA and SCL pins to the corresponding I2C pins on your microcontroller.
  3. Set the I2C Address: Use the A0, A1, and A2 pins to configure the I2C address. Each pin can be tied to GND (logic 0) or VCC (logic 1), allowing up to 8 unique addresses (0x20 to 0x27).
  4. Connect GPIO Pins: Use GPIOA0-7 and GPIOB0-7 as input or output pins, depending on your application.
  5. Optional Interrupts: If needed, connect INT A and/or INT B to your microcontroller for interrupt-driven applications.

Important Considerations and Best Practices

  • Pull-Up Resistors: Ensure that the I2C lines (SDA and SCL) have appropriate pull-up resistors (typically 4.7kΩ to 10kΩ).
  • Voltage Compatibility: Verify that the voltage levels of the MCP23017 and your microcontroller are compatible.
  • Pin Configuration: Configure each GPIO pin as input or output using the appropriate I2C commands.
  • Interrupts: Use the interrupt pins (INT A and INT B) for efficient handling of input changes without continuous polling.

Example Code for Arduino UNO

Below is an example of how to use the MCP23017 with an Arduino UNO to toggle an LED connected to GPIOA0:

#include <Wire.h>
#include "Adafruit_MCP23017.h"

// Create an MCP23017 object
Adafruit_MCP23017 mcp;

void setup() {
  Wire.begin(); // Initialize I2C communication
  mcp.begin(0); // Initialize MCP23017 with default I2C address (0x20)

  // Set GPIOA0 as output
  mcp.pinMode(0, OUTPUT);

  // Set GPIOA1 as input with pull-up resistor
  mcp.pinMode(1, INPUT);
  mcp.pullUp(1, HIGH); // Enable pull-up resistor on GPIOA1
}

void loop() {
  // Read the state of GPIOA1
  int buttonState = mcp.digitalRead(1);

  // Toggle GPIOA0 based on button state
  if (buttonState == LOW) {
    mcp.digitalWrite(0, HIGH); // Turn on LED
  } else {
    mcp.digitalWrite(0, LOW); // Turn off LED
  }

  delay(100); // Small delay for debounce
}

Troubleshooting and FAQs

Common Issues and Solutions

  1. I2C Communication Not Working:

    • Ensure SDA and SCL lines are correctly connected to the microcontroller.
    • Check for proper pull-up resistors on the I2C lines.
    • Verify the I2C address matches the configuration of the A0, A1, and A2 pins.
  2. GPIO Pins Not Responding:

    • Confirm that the pins are correctly configured as input or output.
    • Check for loose or incorrect connections to the GPIO pins.
  3. Interrupts Not Triggering:

    • Ensure the interrupt pins (INT A or INT B) are connected to the microcontroller.
    • Verify that interrupt functionality is enabled in the MCP23017 configuration.
  4. Overheating or Malfunction:

    • Ensure the total current drawn by all GPIO pins does not exceed 125mA.
    • Verify that the operating voltage is within the specified range (1.8V to 5.5V).

FAQs

Q: Can I use multiple MCP23017 breakout boards in the same project?
A: Yes, you can use up to 8 MCP23017 devices on the same I2C bus by configuring unique addresses using the A0, A1, and A2 pins.

Q: What is the maximum cable length for I2C communication?
A: The maximum length depends on the pull-up resistor values and the capacitance of the cable, but typically it is recommended to keep I2C lines under 1 meter for reliable communication.

Q: Can the MCP23017 handle analog signals?
A: No, the MCP23017 is designed for digital input/output only. Use an ADC (Analog-to-Digital Converter) for analog signals.

Q: How do I reset the MCP23017?
A: You can reset the MCP23017 by pulling the RESET pin low momentarily or by cycling the power supply.