Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

How to Use I2C PC8574: Examples, Pinouts, and Specs

Image of I2C PC8574Design with I2C PC8574 in Cirkit Designer

Introduction

The I2C PC8574 is an 8-bit I/O expander that communicates via the I2C protocol, enabling microcontrollers to control additional input/output pins. This component is particularly useful in applications where the number of available GPIO pins on a microcontroller is insufficient. By using the PC8574, you can expand the number of digital I/O pins without requiring additional microcontroller resources.

Explore Projects Built with I2C PC8574

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 ESP32-Based I2C Communication Hub with Multiplexer and Expander: A project utilizing I2C PC8574 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.

Open Project in Cirkit Designer

Common Applications and Use Cases

Technical Specifications

The PC8574 is a versatile and efficient I/O expander. Below are its key technical details:

Parameter Value
Operating Voltage 2.5V to 6V
Maximum Sink Current 25mA per pin
Maximum Source Current 300µA per pin
Communication Protocol I2C (2-wire)
I2C Address Range 0x20 to 0x27 (configurable via A0, A1, A2 pins)
Number of I/O Pins 8
Operating Temperature -40°C to +85°C

Pin Configuration and Descriptions

The PC8574 has 16 pins, as described in the table below:

Pin Name Description
1 P0 General-purpose I/O pin 0
2 P1 General-purpose I/O pin 1
3 P2 General-purpose I/O pin 2
4 P3 General-purpose I/O pin 3
5 P4 General-purpose I/O pin 4
6 P5 General-purpose I/O pin 5
7 P6 General-purpose I/O pin 6
8 P7 General-purpose I/O pin 7
9 GND Ground (0V)
10 SDA I2C data line
11 SCL I2C clock line
12 INT Interrupt output (active low, optional use)
13 A2 Address selection bit 2 (used to configure I2C address)
14 A1 Address selection bit 1 (used to configure I2C address)
15 A0 Address selection bit 0 (used to configure I2C address)
16 VCC Power supply (2.5V to 6V)

Usage Instructions

The PC8574 is straightforward to use in a circuit. Below are the steps and considerations for integrating it into your project:

Connecting the PC8574

  1. Power Supply: Connect the VCC pin to a 3.3V or 5V power source and the GND pin to ground.
  2. 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.
  3. Address Configuration: Set the A0, A1, and A2 pins to either HIGH or LOW to configure the I2C address. The base address is 0x20, and the address can be adjusted from 0x20 to 0x27.
  4. I/O Pins: Connect the P0–P7 pins to the devices you want to control or monitor. These pins can be configured as inputs or outputs in your code.

Example Code for Arduino UNO

Below is an example of how to use the PC8574 with an Arduino UNO to toggle an LED connected to one of its pins:

#include <Wire.h> // Include the Wire library for I2C communication

#define PC8574_ADDRESS 0x20 // I2C address of the PC8574 (adjust as needed)

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

  // Set all pins on the PC8574 as outputs and turn them off
  Wire.beginTransmission(PC8574_ADDRESS);
  Wire.write(0xFF); // Write 0xFF to set all pins HIGH (off for active-low devices)
  Wire.endTransmission();
}

void loop() {
  // Turn on the LED connected to P0
  Wire.beginTransmission(PC8574_ADDRESS);
  Wire.write(0xFE); // Set P0 LOW (active) and others HIGH
  Wire.endTransmission();
  delay(1000); // Wait for 1 second

  // Turn off the LED connected to P0
  Wire.beginTransmission(PC8574_ADDRESS);
  Wire.write(0xFF); // Set all pins HIGH (inactive)
  Wire.endTransmission();
  delay(1000); // Wait for 1 second
}

Important Considerations

Troubleshooting and FAQs

Common Issues

  1. I2C Communication Failure

    • Cause: Incorrect wiring or missing pull-up resistors.
    • Solution: Verify SDA and SCL connections and ensure pull-up resistors (4.7kΩ) are in place.
  2. Incorrect I2C Address

    • Cause: A0, A1, and A2 pins are not configured correctly.
    • Solution: Check the state of the address pins and calculate the correct I2C address.
  3. Pins Not Responding

    • Cause: Pins may not be configured correctly in the code.
    • Solution: Ensure the correct data is being sent to the PC8574 to configure pins as inputs or outputs.
  4. Low Current Output

    • Cause: The PC8574 has limited current sourcing capability.
    • Solution: Use external transistors or drivers for devices requiring higher current.

FAQs

Q: Can the PC8574 be used with 3.3V microcontrollers?
A: Yes, the PC8574 operates at 2.5V to 6V, making it compatible with both 3.3V and 5V systems.

Q: How many PC8574 devices can be connected 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: Can the PC8574 handle analog signals?
A: No, the PC8574 is designed for digital I/O only. Use an ADC for analog signals.

Q: What happens if the INT pin is not used?
A: The INT pin is optional. If not used, it can be left unconnected.