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

How to Use Adafruit PCF8574 I2C GPIO Expander Breakout: Examples, Pinouts, and Specs

Image of Adafruit PCF8574 I2C GPIO Expander Breakout
Cirkit Designer LogoDesign with Adafruit PCF8574 I2C GPIO Expander Breakout in Cirkit Designer

Introduction

The Adafruit PCF8574 I2C GPIO Expander Breakout (Part ID: 5545) is a versatile module designed to expand the number of digital input/output (GPIO) pins available to your microcontroller. It communicates via the I2C protocol, allowing you to control up to 8 additional GPIO pins using only two microcontroller pins (SDA and SCL). This makes it an excellent choice for projects requiring multiple digital inputs or outputs, such as controlling LEDs, reading button states, or interfacing with sensors.

Explore Projects Built with Adafruit PCF8574 I2C GPIO Expander 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!
ESP32-Based I2C Communication Hub with Multiplexer and Expander
Image of Lights: A project utilizing Adafruit PCF8574 I2C GPIO Expander 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
MCP23017-Expanded I/O Interface with ADS1115 ADC and ESP32 Control
Image of door and window sensors: A project utilizing Adafruit PCF8574 I2C GPIO Expander 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
Raspberry Pi-Controlled Dual Servo Driver with PCA9685 Interface
Image of Copy of PWM, SERVO, ESC Wiring: A project utilizing Adafruit PCF8574 I2C GPIO Expander Breakout in a practical application
This circuit controls two servomotors (MG996R and MG995) using a Raspberry Pi 5 and an Adafruit PCA9685 PWM Servo Breakout board. The Raspberry Pi communicates with the PCA9685 via I2C (using GPIO 2 and GPIO 3 for SDA and SCL, respectively) to send PWM signals to the servos. Power distribution is managed through an Adafruit Perma Proto Small Mint board, which connects the 5V and GND from the Raspberry Pi to the PCA9685 and the servos.
Cirkit Designer LogoOpen Project in Cirkit Designer
I2C-Controlled Relay Switching with ESP32 and MCP23017 for Home Automation
Image of Vloerverwarming: A project utilizing Adafruit PCF8574 I2C GPIO Expander 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

Explore Projects Built with Adafruit PCF8574 I2C GPIO Expander 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 Lights: A project utilizing Adafruit PCF8574 I2C GPIO Expander 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 door and window sensors: A project utilizing Adafruit PCF8574 I2C GPIO Expander 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 Copy of PWM, SERVO, ESC Wiring: A project utilizing Adafruit PCF8574 I2C GPIO Expander Breakout in a practical application
Raspberry Pi-Controlled Dual Servo Driver with PCA9685 Interface
This circuit controls two servomotors (MG996R and MG995) using a Raspberry Pi 5 and an Adafruit PCA9685 PWM Servo Breakout board. The Raspberry Pi communicates with the PCA9685 via I2C (using GPIO 2 and GPIO 3 for SDA and SCL, respectively) to send PWM signals to the servos. Power distribution is managed through an Adafruit Perma Proto Small Mint board, which connects the 5V and GND from the Raspberry Pi to the PCA9685 and the servos.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of Vloerverwarming: A project utilizing Adafruit PCF8574 I2C GPIO Expander 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

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 the state of multiple buttons or switches.
  • Building I2C-based modular systems with multiple PCF8574 modules.

Technical Specifications

Key Technical Details

  • I2C Address Range: 0x20 to 0x27 (configurable via address pins A0, A1, A2)
  • Operating Voltage: 2.5V to 6V
  • Maximum Sink Current per Pin: 25mA
  • Maximum Source Current per Pin: 300µA
  • Number of GPIO Pins: 8 (P0 to P7)
  • Communication Protocol: I2C (400kHz maximum clock speed)
  • Dimensions: 25mm x 18mm x 2mm (excluding header pins)

Pin Configuration and Descriptions

The PCF8574 breakout board has the following pin layout:

Pin Name Description
VCC Power supply input (2.5V to 6V). Connect to the microcontroller's power source.
GND Ground connection.
SDA I2C data line. Connect to the microcontroller's SDA pin.
SCL I2C clock line. Connect to the microcontroller's SCL pin.
A0, A1, A2 Address selection pins. Configure the I2C address by connecting to VCC or GND.
P0 to P7 GPIO pins. Can be configured as inputs or outputs.

Usage Instructions

How to Use the Component in a Circuit

  1. Connect Power and Ground:

    • Connect the VCC pin to the microcontroller's power supply (e.g., 5V for Arduino).
    • Connect the GND pin to the microcontroller's ground.
  2. Connect I2C Lines:

    • Connect the SDA pin to the microcontroller's SDA pin.
    • Connect the SCL pin to the microcontroller's SCL pin.
    • Use pull-up resistors (typically 4.7kΩ) on the SDA and SCL lines if not already present.
  3. Set the I2C Address:

    • Configure the address by connecting the A0, A1, and A2 pins to either VCC (logic HIGH) or GND (logic LOW). The default address is 0x20 when all address pins are connected to GND.
  4. Connect GPIO Devices:

    • Use the P0 to P7 pins to connect LEDs, buttons, or other digital devices. Configure each pin as input or output in your code.

Important Considerations and Best Practices

  • Current Limitations: The GPIO pins can sink up to 25mA but can only source 300µA. Use external transistors or drivers if higher current is required.
  • Pull-Up Resistors: The GPIO pins are open-drain, so external pull-up resistors may be needed for certain applications.
  • I2C Address Conflicts: Ensure that the I2C address does not conflict with other devices on the same bus.

Example Code for Arduino UNO

Below is an example of how to use the PCF8574 with an Arduino UNO to toggle an LED connected to pin P0 and read the state of a button connected to pin P1.

#include <Wire.h>
#include "Adafruit_MCP23008.h" // Include the Adafruit PCF8574 library

#define PCF8574_ADDRESS 0x20 // Default I2C address of the PCF8574

void setup() {
  Wire.begin(); // Initialize I2C communication
  Serial.begin(9600); // Start serial communication for debugging

  // Set P0 as output (for LED) and P1 as input (for button)
  pinMode(0, OUTPUT);
  pinMode(1, INPUT_PULLUP); // Use internal pull-up resistor for button
}

void loop() {
  // Toggle LED on P0
  digitalWrite(0, HIGH); // Turn LED on
  delay(500); // Wait for 500ms
  digitalWrite(0, LOW); // Turn LED off
  delay(500); // Wait for 500ms

  // Read button state on P1
  int buttonState = digitalRead(1);
  if (buttonState == LOW) {
    Serial.println("Button Pressed!");
  } else {
    Serial.println("Button Released!");
  }

  delay(100); // Short delay for stability
}

Troubleshooting and FAQs

Common Issues and Solutions

  1. I2C Device Not Detected:

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

    • Confirm that the pins are correctly configured as input or output in the code.
    • Check for proper connections to external devices (e.g., LEDs, buttons).
  3. Interference with Other I2C Devices:

    • Ensure no address conflicts by configuring the PCF8574 to a unique I2C address.
  4. Low Current Output:

    • Remember that the GPIO pins can only source 300µA. Use external drivers for higher current requirements.

FAQs

Q: Can I use multiple PCF8574 modules on the same I2C bus?
A: Yes, you can connect up to 8 PCF8574 modules by configuring unique I2C addresses using the A0, A1, and A2 pins.

Q: Do I need external pull-up resistors for the GPIO pins?
A: It depends on your application. For open-drain configurations, external pull-up resistors may be required.

Q: What is the maximum I2C clock speed supported?
A: The PCF8574 supports a maximum I2C clock speed of 400kHz.

Q: Can the PCF8574 handle analog signals?
A: No, the PCF8574 is designed for digital input/output only. Use an ADC for analog signals.

This documentation provides a comprehensive guide to using the Adafruit PCF8574 I2C GPIO Expander Breakout effectively in your projects.