The PCF8574 is an 8-bit I / O port expander connected via an I2C bus. if you have ever suffered from "pin deficiency" in one of your Projects you know what is meant.
Since the job of the PCF8574 is to expand the IO capabilities of a microcontroller, we can use it with our Arduino UNO board to increase the digital IO count to 21. The IO port pins can be used as either input or output
Number of I/Os: 8
Features Interrupt: pin
Supply voltage (Min): (V)2.5
Supply voltage (Max): (V)6
Frequency (Max): (kHz)100
Operating temperature range: (C)-40 to 85
|1, 2, 3||A0, A1, A2||
4, 5, 6, 7,
9, 10, 11, 12
|P0 – P7||
Input / Output Port
Interrupt Output (Must be pulled high to VCC)
Serial Clock of I2C (Must be pulled high to VCC)
Serial Data of I2C (Must be pulled high to VCC)
PCF8574 Connections with Arduino :
Since the PCF8574 works on I2C Communications, we have to use the I2C Pins of the Arduino to control the IO Pins of the IC. Pins A4 and A5 of Arduino UNO are the I2C Pins where A4 is the SDA (Data) pin and A5 is the SCL (Clock) pins.
Connect these pins to the corresponding SDA and SCL Pins of the PCF8574 Board. Now, connect the VCC and GND Pins to the +5V and GND pins of the Arduino.
Code for getting the I2C Address of the PCF8574 IC:
First, we have to figure out the I2C bus slave address of the PCF8574 IC. Use the following code to calculate the address of the. when the A0, A1, and A2 pins are connected to LOW.
byte error, address;
Serial.println(“Scanning for I2C Devices…”);
I2CDevices = 0;
for (address = 1; address < 127; address++ )
error = Wire.endTransmission();
if (error == 0)
Serial.print(“I2C device found at address 0x”);
if (address < 16)
else if (error == 4)
Serial.print(“Unknown error at address 0x”);
if (address < 16)
if (I2CDevices == 0)
Serial.println(“No I2C devices found\n”);
the address turned out to be 0x20 (it can be different). So, we have to use this address in the actual code.
The Library of the PCF8574 IC:
if everything was good till now you can use this library to simply control the IC in your code Click Here to download It.
now to learn morehttps://github.com/xreef/PCF8574_library about the previous library Click Here.