

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.








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. |
Connect Power and Ground:
VCC pin to the microcontroller's power supply (e.g., 5V for Arduino).GND pin to the microcontroller's ground.Connect I2C Lines:
SDA pin to the microcontroller's SDA pin.SCL pin to the microcontroller's SCL pin.Set the I2C Address:
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.Connect GPIO Devices:
P0 to P7 pins to connect LEDs, buttons, or other digital devices. Configure each pin as input or output in your code.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
}
I2C Device Not Detected:
SDA and SCL lines are correctly connected.GPIO Pins Not Responding:
Interference with Other I2C Devices:
Low Current Output:
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.