Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

How to Use MCP23017 IO Expansion Board I2C Interface 16 I/O Pins Expands: Examples, Pinouts, and Specs

Image of MCP23017 IO Expansion Board I2C Interface 16 I/O Pins ExpandsDesign with MCP23017 IO Expansion Board I2C Interface 16 I/O Pins Expands in Cirkit Designer

Introduction

The MCP23017 IO Expansion Board, manufactured by SeenGreat (Part ID: SG IO E017), is a versatile component designed to expand the number of input/output (I/O) pins available for microcontroller projects. Utilizing the MCP23017 chip, this board provides an additional 16 I/O pins via the I2C interface, making it an ideal solution for projects requiring more I/O capabilities than what is available on standard microcontrollers.

Explore Projects Built with MCP23017 IO Expansion Board I2C Interface 16 I/O Pins Expands

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 MCP23017-Expanded I/O Interface with ADS1115 ADC and ESP32 Control: A project utilizing MCP23017 IO Expansion Board I2C Interface 16 I/O Pins Expands 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.

Open Project in Cirkit Designer
Image of I2C-Controlled Relay Switching with ESP32 and MCP23017 for Home Automation: A project utilizing MCP23017 IO Expansion Board I2C Interface 16 I/O Pins Expands 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.

Open Project in Cirkit Designer
Image of ESP32-Based I2C Communication Hub with Multiplexer and Expander: A project utilizing MCP23017 IO Expansion Board I2C Interface 16 I/O Pins Expands 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.

Open Project in Cirkit Designer

Common Applications and Use Cases

Technical Specifications

Key Technical Details

Parameter Value
Operating Voltage 1.8V to 5.5V
I/O Pins 16
Communication I2C (up to 1.7 MHz)
Current per I/O Pin 25 mA
Total Current 125 mA
Address Range 0x20 to 0x27 (configurable)
Operating Temperature -40°C to +85°C

Pin Configuration and Descriptions

MCP23017 Pin Configuration

Pin Number Pin Name Description
1 GPA0 General Purpose I/O Pin 0 (Port A)
2 GPA1 General Purpose I/O Pin 1 (Port A)
3 GPA2 General Purpose I/O Pin 2 (Port A)
4 GPA3 General Purpose I/O Pin 3 (Port A)
5 GPA4 General Purpose I/O Pin 4 (Port A)
6 GPA5 General Purpose I/O Pin 5 (Port A)
7 GPA6 General Purpose I/O Pin 6 (Port A)
8 GPA7 General Purpose I/O Pin 7 (Port A)
9 GPB0 General Purpose I/O Pin 0 (Port B)
10 GPB1 General Purpose I/O Pin 1 (Port B)
11 GPB2 General Purpose I/O Pin 2 (Port B)
12 GPB3 General Purpose I/O Pin 3 (Port B)
13 GPB4 General Purpose I/O Pin 4 (Port B)
14 GPB5 General Purpose I/O Pin 5 (Port B)
15 GPB6 General Purpose I/O Pin 6 (Port B)
16 GPB7 General Purpose I/O Pin 7 (Port B)
17 VDD Power Supply (1.8V to 5.5V)
18 VSS Ground
19 SCL I2C Clock Line
20 SDA I2C Data Line
21 RESET Reset (Active Low)
22 A0 I2C Address Bit 0
23 A1 I2C Address Bit 1
24 A2 I2C Address Bit 2
25 INTA Interrupt Output A
26 INTB Interrupt Output B

Usage Instructions

How to Use the Component in a Circuit

  1. Power Supply: Connect the VDD pin to a power supply (1.8V to 5.5V) and the VSS pin to ground.
  2. I2C Communication: Connect the SCL (clock) and SDA (data) lines to the corresponding I2C pins on your microcontroller.
  3. Address Configuration: Set the I2C address by connecting A0, A1, and A2 to either VDD or VSS. The default address is 0x20.
  4. I/O Pins: Connect your devices to the GPA0-GPA7 and GPB0-GPB7 pins.
  5. Interrupts (Optional): Connect INTA and INTB to your microcontroller if you want to use interrupt functionality.

Important Considerations and Best Practices

Example Code for Arduino UNO

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

// Create an instance of the MCP23017
Adafruit_MCP23017 mcp;

void setup() {
  // Start the I2C communication
  Wire.begin();
  
  // Initialize the MCP23017 with the default address (0x20)
  mcp.begin();
  
  // Set all pins on Port A as outputs
  for (int i = 0; i < 8; i++) {
    mcp.pinMode(i, OUTPUT);
  }
  
  // Set all pins on Port B as inputs
  for (int i = 8; i < 16; i++) {
    mcp.pinMode(i, INPUT);
  }
}

void loop() {
  // Turn on all LEDs connected to Port A
  for (int i = 0; i < 8; i++) {
    mcp.digitalWrite(i, HIGH);
  }
  
  // Read the state of all buttons connected to Port B
  for (int i = 8; i < 16; i++) {
    int buttonState = mcp.digitalRead(i);
    // Do something with buttonState
  }
  
  delay(1000); // Wait for 1 second
}

Troubleshooting and FAQs

Common Issues Users Might Face

  1. I2C Communication Failure:

    • Solution: Check the connections for SCL and SDA lines. Ensure pull-up resistors are in place.
  2. Incorrect I/O Pin Behavior:

    • Solution: Verify the pinMode settings in your code. Ensure that the pins are correctly configured as input or output.
  3. Address Conflict:

    • Solution: Ensure that the I2C address set by A0, A1, and A2 does not conflict with other devices on the bus.
  4. Overcurrent Issues:

    • Solution: Ensure that the current drawn by each I/O pin does not exceed 25 mA and the total current does not exceed 125 mA.

Solutions and Tips for Troubleshooting

By following this documentation, users can effectively integrate the MCP23017 IO Expansion Board into their projects, expanding their microcontroller's I/O capabilities with ease.