

The Adafruit GPIO Expander Bonnet (Part ID: 4132) is a compact and versatile board designed to provide 16 additional general-purpose input/output (GPIO) pins to your microcontroller or single-board computer. It communicates via the I2C interface, making it an excellent choice for projects requiring more GPIO pins than your device natively supports. This bonnet is particularly well-suited for Raspberry Pi and other I2C-compatible platforms.








The Adafruit GPIO Expander Bonnet is based on the MCP23017 I/O expander chip, which provides robust and reliable GPIO expansion over I2C.
| Parameter | Value |
|---|---|
| Operating Voltage | 3.3V or 5V |
| Communication Protocol | I2C |
| GPIO Pins | 16 (organized as two 8-bit ports) |
| I2C Address Range | 0x20 to 0x27 (configurable) |
| Maximum Current per Pin | 25mA |
| Pull-up Resistors | Configurable internal pull-ups |
| Dimensions | 65mm x 30mm x 5mm |
The GPIO Expander Bonnet has the following key pin connections:
| Pin Name | Description |
|---|---|
| SDA | I2C Data Line |
| SCL | I2C Clock Line |
| GND | Ground |
| VIN | Power input (3.3V or 5V) |
| Pin Name | Description |
|---|---|
| GPA0-GPA7 | General-purpose I/O pins (Port A) |
| GPB0-GPB7 | General-purpose I/O pins (Port B) |
| Pin Name | Description |
|---|---|
| A0, A1, A2 | I2C address configuration pins |
Connect Power and I2C Lines:
VIN pin to a 3.3V or 5V power source.GND pin to the ground of your microcontroller.SDA and SCL pins to the corresponding I2C pins on your microcontroller.Configure the I2C Address:
A0, A1, and A2 pins to set the I2C address. These pins can be tied to GND or VIN to select an address between 0x20 and 0x27.Connect GPIO Devices:
GPA0-GPA7 and GPB0-GPB7).Install Required Libraries:
Write Code to Control the GPIO Pins:
Below is an example of how to use the GPIO Expander Bonnet with an Arduino UNO:
#include <Wire.h>
#include "Adafruit_MCP23X17.h"
// Create an MCP23017 object
Adafruit_MCP23X17 mcp;
void setup() {
Serial.begin(9600); // Initialize serial communication for debugging
while (!Serial) {
delay(10); // Wait for Serial Monitor to open
}
// Initialize the MCP23017
if (!mcp.begin_I2C()) {
Serial.println("Failed to initialize MCP23017. Check connections!");
while (1);
}
Serial.println("MCP23017 initialized successfully!");
// Set pin GPA0 as an output
mcp.pinMode(0, OUTPUT);
// Set pin GPA1 as an input with pull-up resistor enabled
mcp.pinMode(1, INPUT);
mcp.pullUp(1, HIGH);
}
void loop() {
// Blink an LED connected to GPA0
mcp.digitalWrite(0, HIGH); // Turn LED on
delay(500); // Wait 500ms
mcp.digitalWrite(0, LOW); // Turn LED off
delay(500); // Wait 500ms
// Read the state of a button connected to GPA1
if (mcp.digitalRead(1) == LOW) {
Serial.println("Button pressed!");
} else {
Serial.println("Button not pressed.");
}
delay(100); // Short delay for stability
}
MCP23017 Not Detected on I2C Bus:
SDA and SCL lines are correctly connected.A0, A1, and A2 pins.GPIO Pins Not Responding:
Overheating or Damage:
Q: Can I use this bonnet with a 5V microcontroller?
A: Yes, the GPIO Expander Bonnet supports both 3.3V and 5V logic levels.
Q: How many MCP23017 devices can I connect to a single I2C bus?
A: You can connect up to 8 MCP23017 devices by configuring unique I2C addresses using the A0, A1, and A2 pins.
Q: Does the bonnet support PWM output?
A: The MCP23017 does not natively support PWM. However, you can implement software PWM using your microcontroller.
Q: Can I use this with a Raspberry Pi?
A: Yes, the GPIO Expander Bonnet is fully compatible with Raspberry Pi. Use the Adafruit CircuitPython library for easy integration.
This documentation provides all the essential details to get started with the Adafruit GPIO Expander Bonnet. For further assistance, refer to the official Adafruit guide or community forums.