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

How to Use PCF8574N: Examples, Pinouts, and Specs

Image of PCF8574N
Cirkit Designer LogoDesign with PCF8574N in Cirkit Designer

Introduction

The PCF8574N is an I2C I/O expander manufactured by Texas Instruments. It provides 8 additional General Purpose Input/Output (GPIO) pins for microcontrollers, enabling easy expansion of input/output capabilities. This component is particularly useful in applications where the number of GPIO pins on a microcontroller is insufficient. The PCF8574N communicates with the host microcontroller via the I2C protocol, requiring only two pins (SCL and SDA) for data transfer.

Explore Projects Built with PCF8574N

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
Biometric and RFID Security System with Dual Adafruit Feather nRF52840 Controllers
Image of Rfid access control: A project utilizing PCF8574N in a practical application
This circuit features two Adafruit Feather nRF52840 microcontrollers, each interfaced with an RFID-RC522 module for RFID communication and an AT24C256 external EEPROM for additional memory storage. One of the microcontrollers is also connected to an R307 Fingerprint Sensor for biometric input, and both microcontrollers are powered by a shared power supply and a coin cell breakout for backup or RTC power. The circuit is likely designed for secure access control or identification purposes, utilizing both RFID and fingerprint authentication, with data storage capabilities.
Cirkit Designer LogoOpen Project in Cirkit Designer
Cellular-Enabled IoT Device with Real-Time Clock and Power Management
Image of LRCM PHASE 2 BASIC: A project utilizing PCF8574N in a practical application
This circuit features a LilyGo-SIM7000G module for cellular communication and GPS functionality, interfaced with an RTC DS3231 for real-time clock capabilities. It includes voltage sensing through two voltage sensor modules, and uses an 8-channel opto-coupler for isolating different parts of the circuit. Power management is handled by a buck converter connected to a DC power source and batteries, with a fuse for protection and a rocker switch for on/off control. Additionally, there's an LED for indication purposes.
Cirkit Designer LogoOpen Project in Cirkit Designer
Multi-Stage Voltage Regulation and Indicator LED Circuit
Image of Subramanyak_Power_Circuit: A project utilizing PCF8574N in a practical application
This circuit is designed for power management, featuring buck and boost converters for voltage adjustment, and linear regulators for stable voltage output. It includes LEDs for status indication, and terminal blocks for external connections.
Cirkit Designer LogoOpen Project in Cirkit Designer
WiFi-Enabled Environmental Monitoring System with Alert Notifications
Image of GAS LEAKAGE DETECTION: A project utilizing PCF8574N in a practical application
This circuit features a NUCLEO-F303RE microcontroller board interfaced with several modules for sensing, actuation, and communication. It uses I2C communication to display data on an LCD screen, UART communication to interface with an ESP8266 WiFi module, and reads an MQ-2 gas sensor via an ADC pin. The microcontroller also controls a buzzer for audible alerts and a relay module for switching higher power loads, possibly in response to sensor readings or remote commands received over WiFi.
Cirkit Designer LogoOpen Project in Cirkit Designer

Explore Projects Built with PCF8574N

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 Rfid access control: A project utilizing PCF8574N in a practical application
Biometric and RFID Security System with Dual Adafruit Feather nRF52840 Controllers
This circuit features two Adafruit Feather nRF52840 microcontrollers, each interfaced with an RFID-RC522 module for RFID communication and an AT24C256 external EEPROM for additional memory storage. One of the microcontrollers is also connected to an R307 Fingerprint Sensor for biometric input, and both microcontrollers are powered by a shared power supply and a coin cell breakout for backup or RTC power. The circuit is likely designed for secure access control or identification purposes, utilizing both RFID and fingerprint authentication, with data storage capabilities.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of LRCM PHASE 2 BASIC: A project utilizing PCF8574N in a practical application
Cellular-Enabled IoT Device with Real-Time Clock and Power Management
This circuit features a LilyGo-SIM7000G module for cellular communication and GPS functionality, interfaced with an RTC DS3231 for real-time clock capabilities. It includes voltage sensing through two voltage sensor modules, and uses an 8-channel opto-coupler for isolating different parts of the circuit. Power management is handled by a buck converter connected to a DC power source and batteries, with a fuse for protection and a rocker switch for on/off control. Additionally, there's an LED for indication purposes.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of Subramanyak_Power_Circuit: A project utilizing PCF8574N in a practical application
Multi-Stage Voltage Regulation and Indicator LED Circuit
This circuit is designed for power management, featuring buck and boost converters for voltage adjustment, and linear regulators for stable voltage output. It includes LEDs for status indication, and terminal blocks for external connections.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of GAS LEAKAGE DETECTION: A project utilizing PCF8574N in a practical application
WiFi-Enabled Environmental Monitoring System with Alert Notifications
This circuit features a NUCLEO-F303RE microcontroller board interfaced with several modules for sensing, actuation, and communication. It uses I2C communication to display data on an LCD screen, UART communication to interface with an ESP8266 WiFi module, and reads an MQ-2 gas sensor via an ADC pin. The microcontroller also controls a buzzer for audible alerts and a relay module for switching higher power loads, possibly in response to sensor readings or remote commands received over WiFi.
Cirkit Designer LogoOpen Project in Cirkit Designer

Common Applications and Use Cases

  • Expanding GPIO pins for microcontrollers
  • Interfacing with sensors, displays, and keypads
  • Controlling LEDs, relays, or other output devices
  • Reading input from switches or buttons
  • Home automation and IoT projects

Technical Specifications

The following are the key technical details of the PCF8574N:

Parameter Value
Operating Voltage (Vcc) 2.5V to 6V
I2C Bus Speed Up to 100 kHz (Standard Mode)
GPIO Pins 8 (P0 to P7)
Maximum Sink Current (per pin) 25 mA
Maximum Source Current (per pin) -300 µA
Operating Temperature Range -40°C to 85°C
Package Type DIP-16

Pin Configuration and Descriptions

The PCF8574N comes in a 16-pin DIP package. The pinout and descriptions are as follows:

Pin Number Pin Name Description
1 P0 GPIO Pin 0
2 P1 GPIO Pin 1
3 P2 GPIO Pin 2
4 P3 GPIO Pin 3
5 P4 GPIO Pin 4
6 P5 GPIO Pin 5
7 P6 GPIO Pin 6
8 GND Ground
9 P7 GPIO Pin 7
10 INT Interrupt Output (active LOW)
11 SCL I2C Clock Line
12 SDA I2C Data Line
13 A0 I2C Address Selection Bit 0
14 A1 I2C Address Selection Bit 1
15 A2 I2C Address Selection Bit 2
16 Vcc Power Supply (2.5V to 6V)

I2C Address

The I2C address of the PCF8574N is determined by the A0, A1, and A2 pins. These pins can be connected to either GND (logic 0) or Vcc (logic 1). The base address is 0x20, and the final address is calculated as:

I2C Address = 0x20 + (A2 * 4) + (A1 * 2) + (A0 * 1)

For example:

  • A2 = 0, A1 = 0, A0 = 0 → Address = 0x20
  • A2 = 0, A1 = 0, A0 = 1 → Address = 0x21

Usage Instructions

How to Use the PCF8574N in a Circuit

  1. Power Supply: Connect the Vcc pin to a 2.5V to 6V power source and the GND pin to ground.
  2. I2C Connections: Connect the SCL and SDA pins to the corresponding I2C pins on the microcontroller. Use pull-up resistors (typically 4.7 kΩ) on the SCL and SDA lines.
  3. Address Configuration: Set the A0, A1, and A2 pins to configure the I2C address.
  4. GPIO Pins: Use the P0 to P7 pins as input or output. When configured as input, the pins are internally pulled HIGH.
  5. Interrupt Pin: The INT pin can be used to detect changes on the input pins. It is active LOW and requires an external pull-up resistor.

Example: Connecting to an Arduino UNO

Below is an example of how to use the PCF8574N with an Arduino UNO to control LEDs connected to the GPIO pins.

Circuit Diagram

  • Connect Vcc to the Arduino's 5V pin and GND to GND.
  • Connect SDA to A4 and SCL to A5 on the Arduino UNO.
  • Connect LEDs (with current-limiting resistors) to P0 to P7.

Arduino Code

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

#define PCF8574_ADDRESS 0x20 // Base I2C address of the PCF8574N

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

  // Set all GPIO pins to output and turn them off
  Wire.beginTransmission(PCF8574_ADDRESS);
  Wire.write(0x00); // Write 0x00 to set all pins LOW
  Wire.endTransmission();
}

void loop() {
  // Turn on all LEDs
  Wire.beginTransmission(PCF8574_ADDRESS);
  Wire.write(0xFF); // Write 0xFF to set all pins HIGH
  Wire.endTransmission();
  delay(1000); // Wait for 1 second

  // Turn off all LEDs
  Wire.beginTransmission(PCF8574_ADDRESS);
  Wire.write(0x00); // Write 0x00 to set all pins LOW
  Wire.endTransmission();
  delay(1000); // Wait for 1 second
}

Important Considerations and Best Practices

  • Use appropriate pull-up resistors on the I2C lines (SCL and SDA).
  • Avoid exceeding the maximum current ratings for the GPIO pins.
  • If using the INT pin, ensure it is connected to a pull-up resistor.
  • When using the GPIO pins as inputs, note that they are internally pulled HIGH.

Troubleshooting and FAQs

Common Issues and Solutions

  1. I2C Communication Not Working

    • Ensure the SCL and SDA lines have proper pull-up resistors (4.7 kΩ recommended).
    • Verify the I2C address matches the configuration of the A0, A1, and A2 pins.
    • Check the wiring for loose or incorrect connections.
  2. GPIO Pins Not Responding

    • Confirm the GPIO pins are correctly configured as input or output.
    • Check for shorts or excessive current draw on the GPIO pins.
  3. Interrupt Pin Not Functioning

    • Ensure the INT pin is connected to a pull-up resistor.
    • Verify that the input pins are configured correctly and are changing state.

FAQs

Q: Can the PCF8574N be used with 3.3V microcontrollers?
A: Yes, the PCF8574N supports operating voltages from 2.5V to 6V, making it compatible with both 3.3V and 5V systems.

Q: How many PCF8574N devices can be connected to the same I2C bus?
A: Up to 8 devices can be connected by configuring unique I2C addresses using the A0, A1, and A2 pins.

Q: What happens if multiple GPIO pins are set to HIGH while sourcing current?
A: The PCF8574N has a limited source current capability (-300 µA per pin). Exceeding this limit may result in unreliable operation. Use external drivers if higher current is needed.