The PCF8574 is an I2C interface chip that provides 8 additional digital input/output (GPIO) pins for microcontrollers. It is designed to simplify the expansion of GPIO capabilities in embedded systems by utilizing the I2C communication protocol. This component is particularly useful in applications where the number of GPIO pins on a microcontroller is insufficient for the desired functionality.
Explore Projects Built with The PCF8574 I2C to 8-Bit Digital IO Port [Bill Ludwig]
Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
This circuit is an Arduino-based real-time clock and display system. It uses an Arduino UNO to interface with a DS1307 RTC module for timekeeping and a 20x4 I2C LCD to display the current time and date. Additionally, a PCF8574 IO Expansion Board is used to extend the I2C bus for additional I/O operations.
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.
This circuit is a multi-functional embedded system featuring an Arduino Mega 2560 microcontroller that interfaces with a 4x4 membrane keypad, a 20x4 I2C LCD, an 8x8 LED matrix, a DS3231 RTC module, a passive buzzer, and a KY-026 flame sensor. The system is powered by a 5V PSU and is designed to provide real-time clock functionality, user input via the keypad, visual output on the LCD and LED matrix, and flame detection with an audible alert.
This circuit interfaces a 20x4 I2C LCD display with a power source and an I2C communication bus. The LCD is powered by a 4.2V supply from a connector and communicates via I2C through another connector, which provides the SCL and SDA lines as well as ground.
Expanding GPIO capabilities in microcontroller-based projects
Driving LEDs, relays, or other digital outputs
Reading digital inputs such as switches or sensors
Interfacing with LCD displays or keypads
Home automation and IoT devices
Technical Specifications
The PCF8574 is a versatile and efficient I2C GPIO expander. Below are its key technical specifications:
Parameter
Value
Operating Voltage
2.5V to 6V
Maximum Sink Current
25mA per pin
Maximum Source Current
300µA per pin
I2C Address Range
0x20 to 0x27 (configurable)
Communication Protocol
I2C (up to 100kHz)
Number of GPIO Pins
8 (individually configurable)
Operating Temperature
-40°C to +85°C
Package Types
DIP, SOIC, TSSOP
Pin Configuration and Descriptions
The PCF8574 has 16 pins, with the following configuration:
Pin Number
Pin Name
Description
1
A0
I2C address selection bit 0
2
A1
I2C address selection bit 1
3
A2
I2C address selection bit 2
4
P0
GPIO pin 0
5
P1
GPIO pin 1
6
P2
GPIO pin 2
7
P3
GPIO pin 3
8
GND
Ground
9
P4
GPIO pin 4
10
P5
GPIO pin 5
11
P6
GPIO pin 6
12
P7
GPIO pin 7
13
INT
Interrupt output (active low)
14
SCL
I2C clock line
15
SDA
I2C data line
16
VCC
Power supply (2.5V to 6V)
Usage Instructions
The PCF8574 is straightforward to use in a circuit. Below are the steps and considerations for integrating it into your project:
Connecting the PCF8574
Power Supply: Connect the VCC pin to a 3.3V or 5V power source, and the GND pin to ground.
I2C Lines: Connect the SDA and SCL pins to the corresponding I2C pins on your microcontroller. Use pull-up resistors (typically 4.7kΩ) on both lines if not already present.
Address Selection: Configure the I2C address by connecting A0, A1, and A2 to either VCC (logic high) or GND (logic low). This allows up to 8 PCF8574 devices on the same I2C bus.
GPIO Pins: Connect the P0–P7 pins to your desired input or output devices.
Example: Using PCF8574 with Arduino UNO
Below is an example of how to use the PCF8574 to control LEDs with an Arduino UNO:
Circuit Diagram
Connect the PCF8574's SDA and SCL pins to the Arduino's A4 (SDA) and A5 (SCL) pins, respectively.
Connect LEDs to P0–P3 through 220Ω resistors.
Arduino Code
#include <Wire.h> // Include the Wire library for I2C communication
#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
Serial.println("PCF8574 Example: Controlling LEDs");
}
void loop() {
Wire.beginTransmission(PCF8574_ADDRESS); // Start communication with PCF8574
Wire.write(0b00001111); // Turn on LEDs connected to P0–P3
Wire.endTransmission(); // End communication
delay(1000); // Wait for 1 second
Wire.beginTransmission(PCF8574_ADDRESS); // Start communication with PCF8574
Wire.write(0b00000000); // Turn off all LEDs
Wire.endTransmission(); // End communication
delay(1000); // Wait for 1 second
}
Important Considerations
GPIO Configuration: The GPIO pins are open-drain, meaning they can only sink current. Use pull-up resistors or external circuitry for sourcing current.
Interrupt Pin: The INT pin can be used to detect changes on input pins, reducing the need for constant polling.
I2C Address Conflicts: Ensure that no two devices on the same I2C bus share the same address.
Troubleshooting and FAQs
Common Issues
No Response from PCF8574
Verify the I2C address configuration (A0, A1, A2 pins).
Check the pull-up resistors on the SDA and SCL lines.
Ensure proper power supply connections.
Incorrect GPIO Behavior
Confirm that the GPIO pins are correctly configured for input or output.
Check for proper pull-up or pull-down resistors on the GPIO lines.
I2C Communication Errors
Ensure the I2C clock speed does not exceed 100kHz.
Verify the connections between the microcontroller and the PCF8574.
FAQs
Q: Can the PCF8574 handle analog signals?
A: No, the PCF8574 is designed for digital input/output only.
Q: How many PCF8574 devices can I connect to a single I2C bus?
A: Up to 8 devices can be connected by configuring unique I2C addresses using the A0, A1, and A2 pins.
Q: What is the maximum current the PCF8574 can sink?
A: Each GPIO pin can sink up to 25mA, but the total current for all pins should not exceed 100mA.
Q: Can I use the PCF8574 with a 3.3V microcontroller?
A: Yes, the PCF8574 supports operating voltages from 2.5V to 6V, making it compatible with both 3.3V and 5V systems.