TCA9555 Library for Arduino

TCA9555 is a 16-bit I2C I/O expander from Texas Instruments. It allows the easy addition of 16 I/O ports on any device that supports the I2C bus. This makes it attractive for expanding the number of I/O pins on the standard Arduino platform using ATmega328. Up to eight TCA9555’s can be used on the same I2C bus and thus allowing up to an additional 128 digital pins to be added.

Keith Neufeld had provided a basic C library for PCA9555 in his blog post.TCA9555 is an improved version of PCA9555. Functionally speaking, TCA9555 is identical to PCA9555 and both versions have the same pin-out. So the code for PCA9555 can be used with TCA9555 without any change.

To make it even easier to use, I wrote a C++ Arduino library that can be used with either PCA9555 or TCA9555. The library exposes all the functionalities of the chip.

Here is some sample code demonstrating how this library can be used:

#include <Wire.h>
#include <TCA9555.h>

// intializaing TCA9555, A2 A1 A0 are set to 000.
TCA9555 tca9555(0,0,0);

void setup()
  //set the pin directions for both ports to 
  //change P00 (pin 4), P01 (pin 5) and P17 (pin 20) to high.
  tca9555.setOutputStates(1<<8 | 3);
  //read back the pin states

void loop()

Download TCA9555 Library: TCA9555.tar.gz



Be Sociable, Share!


  1. Adrien J. says:

    Hi, I know this is an old post but could you tell me how this command works please ?

    //change P00 (pin 4), P01 (pin 5) and P17 (pin 20) to high.
    tca9555.setOutputStates(1<<8 | 3);

    I would like to know why you set: 1<<8 | 3 for making P00, P01 and P17 high.
    Thanks you for your help. :)

  2. ZARh says:

    Thank you for this library :)
    Great work and it help me a lot :)

  3. Stocky says:

    I am getting compile errors on Arduino 1.0.5 IDE with this library.
    What version of the IDE is it designed to work with?


    Spelling error. s/Taxes/Texas/

Leave a Reply