Hobbybotics PCF8574A I2C I/O Expander




Build It

Use It

Related Links



The Hobbybotics I2C I/O Expander is based on the Philips PCF8574A.  The PCF8574A provides eight bits of I/O with the use of only two pins on the Hobbyduino.  Analog pins 4 and 5 double as the SDA and SCL, respectively.  The nominal communication rate on the I2C bus is 100 kbits/sec.  The sample code presented below adds an additional eight outputs to the Hobbyduino while only using two pins.

Take a look at the “Build It” section below for a more detailed explanation of the circuit.


  • Philips PCF8574A
  • Supply voltage 2.5V – 6V
  • Latched outputs
  • I2C to parallel port expander
  • 3 hardware address pins allows expansion up to 8 devices (PCF8574A) or 16 devices if PCF8574 is added
  • Size: 1.5W” x 1.875L”


  • Schematic – PDF
  • PCB – PDF
  • Schematic – SCH
  • PCB – PCB
  • Mechanical Drawing – DXF
  • Bill of Materials – TXT

The schematic and PCB was developed with the freely available ExpressPCB software.

Build It

The I2C bus is a two wire connection that can link multiple devices together and allow them to exchange data in a master-slave configuration.  All devices on the I2Cbus are connected in parallel to the same bus lines.  These bus lines are known as serial clock (SCL) and serial data (SDA).  The master device on the bus controls the serial clock.  Bi-directional communication is sent on the serial data line between the master and slave devices.  The SCL and SDA lines must be pulled up to VDD with pullup resistors in the range of 1k to 10k.

To accomplish a read or write to a slave device, the master device sends out a slave address coupled with a one-bit read/write flag.  I2C addresses are seven bits long which allow up to 127 devices to be attached to the same bus.  Each device has an internal address that is made up of the four most significant bits and an external address composed of the three least significant bits.  This seven bit address is shifted left one bit and the least significant bit is used to flag a read or write.  Thus, in simple terms, a complete slave address is one byte (seven address bits and one read/write bit).  The external address for each device is set by pulling each pin of the three least significant bits (A2, A1, and A0) to VDD or GND (1 or 0).  This yields an address range of 38 to 3F hexadecimal (56 to 63 decimal).  If using this device with an Arduino, do not set the eighth bit (read/write flag) as the wire library handles this for you.

A2 – External address bit.  Set to 0 or 1.
A1 – External address bit.  Set to 0 or 1.
A0 – External address bit.  Set to 0 or 1.
R/W – Read/Write bit.  Set to 0 for write and 1 for read.

Reference the B.O.M above for a list of the parts necessary to complete the Hobbybotics PCF8574A I2C I/O Expander.

Only basic soldering skills are needed to put this board together. I recommend you start with the smaller components first such as the resistors. The PCF8574A should be the last component installed.

Reference the below schematic and layout file for component locations.

Use It

I recommend you look over your solder connections before you apply power to the board. This will give you an opportunity to detect and correct any bad solder joints or solder bridges that could possibly let the smoke out. Once that is complete there are a few tidbits we need to take care of before we can make stuff. We’ll need to get some software (free of course) and configure some settings.

1. Go here and download the latest version of the Arduino Ide.
2. Plug the FTDI Serial-to-USB adapter into an available USB port on your computer. The drivers will automatically be downloaded and installed.
3. Go to Device Manager on your computer and expand the Ports (COM & LPT) field. Right-click on the USB serial port and select -> properties -> port-settings tab -> advanced. Set the baud-rate to the appropriate setting for your controller.
4. Extract the compressed file to a location on your computer and launch the “arduino.exe” file.
5. In the Arduino Ide, select Tools -> Board -> Arduino Duemilanove or Nano w/ ATmega328.
6. Ensure the correct serial port is selected in the Arduino Ide.

You are now ready to upload and test a sketch using the Hobbyduino Mini or an Arduino of your choosing.

* PCF8574A I2C Output
* Prototype I2C interface to PCF8574A I/O Expander.
* Arduino analog input 5 - I2C SCL
* Arduino analog input 4 - I2C SDA
// Up to 8 devices can share the same I2C bus starting from address 38h to 3Fh
// hexadecimal (56 to 63 decimal)
#include <Wire.h>
void setup()
Wire.begin(); // Join I2C bus
deviceWrite(B11111111); // Set all LEDs off
void loop()
deviceWrite(B11111001); // Turn on LEDs connected to P1 and P2
// Turn off LED connected to P0
delay(1000); // Delay 1 second
deviceWrite(B11111110); // Turn off LEDs connected to P1 and P2
// Turn on LED connected to P0
delay(1000); // Delay 1 second
void deviceWrite(byte txData)
view raw PCF8574A.pde hosted with ❤ by GitHub

1. Launch the Arduino Ide and either copy and paste the above code or download the file from here.
2. Connect analog pin 4 to SDA and analog pin 5 to SCL of the I2C expander.  Connect an LED/Resistor to P0, P1, and P2 of the I2C expander with the anodes of each connected to +5V and the cathodes connected to the output pins.
3. Connect VDD and GND pins on the I2C board to the +5V and GND pins on the Hobbyduino.
4. Click the upload button and the sketch will be uploaded to the board. You’ll need to do a little troubleshooting if the sketch fails to upload. I recommend checking for the correct serial port and board within the Arduino Ide.
5. If all is successful, the LEDs will blink on/off for 1 second in an alternating pattern.  The LED connected to P0 will be off when the LEDs attached to P1 and P2 are on.

This completes the basic functionality test for the Hobbybotics PCF8574A I2C I/O Expander. Checkout the video to see it in action.

Related Links

Hobbybotics PCF8574A I2C Expander Gallery


This example shows hardware and software used to implement the design. It is recommended the viewer use sound judgment in determining and/or implementing this example for any particular application. This example may include information from 3rd parties and/or information which may require further licensing or otherwise. Additional hardware or software may be required. Hobbybotics or any affiliates does not support or warrant this information for any purpose other than a design example and takes no responsibility for any mishaps (none being implied).


11 thoughts on “Hobbybotics PCF8574A I2C I/O Expander

  1. As of Arduino 1.0, the library inherits from the Stream functions, making it consistent with other read/write libraries. Because of this, send() and receive() have been replaced with read() and write().

    I have tried to build this on a breadboard with my Arduino, but I don’t get any of the LEDs to turn on… I measured the output pins from the PCF8574AP and I get 5 volts on all of them. What could be the problem? Thanks in advance.

    • I changed from an external power source to the Arduino pins and see there, it works!!! Thank you for the great Project.

      • You only have to change one line to make it compile with the latest Arduino IDE:



    • Thanks for the quick answer. I would like to drive a small LED matrix with this chip, (8*11 as that is the size of my perfboard), would that be too much for this chip? I tried to read the datasheet, but I’m not sure… I think it can source 100mA per output? Help would be greatly appreciated.

      • The best way to accomplish what you want to do is to use a go between chip that can handle more current such as a ULN2803. The PCF8574A can only sink 20mA max per bit. Check out the schematic at the following link to see what I’m talking about: http://aquaticus.info/i2c_driver.

      • Nice, I have some of those Darlington arrays here. I have been testing it a little and it seems to work fine with single LEDs. Now I only need some transistors for switching the columns. Thank you very much for the Help. Kind regards

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s