The Adafruit MCP23017 I2C GPIO Expander Breakout (Part ID: 5346) is a versatile component that provides 16 additional General Purpose Input/Output (GPIO) pins via I2C communication. This breakout board is ideal for expanding the input/output capabilities of microcontroller projects, such as those using Arduino, Raspberry Pi, or other development platforms. It allows for easy integration and control of multiple devices, sensors, and actuators without the need for additional microcontroller pins.
Parameter | Value |
---|---|
Operating Voltage | 1.8V to 5.5V |
I2C Address Range | 0x20 to 0x27 (configurable) |
GPIO Pins | 16 (split into two 8-bit ports) |
Maximum Current | 25mA per pin |
Package Type | DIP |
Communication | I2C |
Pin Number | Pin Name | Description |
---|---|---|
1 | GPA0 | GPIO Port A Pin 0 |
2 | GPA1 | GPIO Port A Pin 1 |
3 | GPA2 | GPIO Port A Pin 2 |
4 | GPA3 | GPIO Port A Pin 3 |
5 | GPA4 | GPIO Port A Pin 4 |
6 | GPA5 | GPIO Port A Pin 5 |
7 | GPA6 | GPIO Port A Pin 6 |
8 | GPA7 | GPIO Port A Pin 7 |
9 | GPB0 | GPIO Port B Pin 0 |
10 | GPB1 | GPIO Port B Pin 1 |
11 | GPB2 | GPIO Port B Pin 2 |
12 | GPB3 | GPIO Port B Pin 3 |
13 | GPB4 | GPIO Port B Pin 4 |
14 | GPB5 | GPIO Port B Pin 5 |
15 | GPB6 | GPIO Port B Pin 6 |
16 | GPB7 | GPIO Port B Pin 7 |
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 Selection Bit 0 |
23 | A1 | I2C Address Selection Bit 1 |
24 | A2 | I2C Address Selection Bit 2 |
25 | INTA | Interrupt Output for Port A |
26 | INTB | Interrupt Output for Port B |
#include <Wire.h>
#include "Adafruit_MCP23017.h"
// Create an instance of the MCP23017 class
Adafruit_MCP23017 mcp;
void setup() {
// Initialize the I2C communication
Wire.begin();
// Initialize the MCP23017
mcp.begin(); // Default address 0x20
// Set GPA0 as an output pin
mcp.pinMode(0, OUTPUT);
// Set GPB0 as an input pin with pull-up resistor
mcp.pinMode(8, INPUT);
mcp.pullUp(8, HIGH);
// Start serial communication for debugging
Serial.begin(9600);
}
void loop() {
// Read the state of GPB0
uint8_t buttonState = mcp.digitalRead(8);
// If the button is pressed, turn on the LED connected to GPA0
if (buttonState == LOW) {
mcp.digitalWrite(0, HIGH);
} else {
mcp.digitalWrite(0, LOW);
}
// Print the button state to the serial monitor
Serial.println(buttonState);
// Small delay to avoid bouncing issues
delay(50);
}
I2C Communication Failure:
Incorrect GPIO Behavior:
Address Conflicts:
Overcurrent on GPIO Pins:
By following this documentation, users can effectively integrate and utilize the Adafruit MCP23017 I2C GPIO Expander Breakout in their projects, expanding their microcontroller's input/output capabilities with ease.