PCA9555 Block Diagram


Arduino Interface PCA9555 GPIO Expander

by Lewis Loflin

YouTube Video for this project: PCA9555 32-Bit GPIO Expander with Arduino

In this series I'll be connecting the PCA9555D 32-bit GPIO expander board to an Arduino micro-controller. First we will start out simple with counting from 0 to 255 in binary on eight LEDs.

In part two we will connect a 4X4 keypad to an 8-bit port. Using "polling" the routine getKey() we will check for a key press and return a BCD value from 0 to 16 displayed on the eight LEDs. See Part 2

In part three we will learn to use the interrupt pin to jump to the key scan routine only when a key is pressed. A BCD value is output on the eight LEDs. See Part 3

In part four we will connect a type a Hd44780 type LCD display and learn how to enter data and manipulate character date and strings. In addition to the LCD display we will scan a keypad, use hardware interrupts, all connected through a single PCA9555 module. In addition I'll reveal some code little discussed with Arduino and we will convert/manipulate code for output to the LCD display. See Part 4

This was purchased off of Ebay lacking code examples which is what I'll be doing here. The code can be used with other GPIO expanders. The keypad, LCD display, LEDs are connected as shown above. I redrew the pin outs on the device because the people selling it miss labeled the pins and their pin table was confusing.

Except for the keypad routines which are new most of these are variations of code written for the MCP23016. See Arduino and the MCP23016 GPIO Expander I have found the PCA9555 superior to the Mp23016 in particular in regards to using interrupts and requiring no external RC oscillator.

YouTube Video for this project: PCA9555 32-Bit GPIO Expander with Arduino

Issues with Arduino

I'm now using version 1.0.5 only to run into a score of problems. My older code from version 0022 had to rewritten only to find out many user compiled libraries no longer worked. In addition anything written for the new version wouldn't even load on the older version. In my view this will create endless grief for users and has turned me off to Arduino.

That's not the only bugs I've found. The interrupt control routines attachInterrupt(), detachInterrupt(), interrupts(), and noInterrupts() don't work at all or improperly, at least for me. They did on 0022. This is why I try to avoid user supplied libraries and write my own code. I'll research that interrupt problem later on. I'm using an older NG Arduino with an ATMEGA168 that could be the problem.

The PCA9555D based 32-bit I/O I2C Expander board is for use with any micro-controller such as Arduino, PICAXE, Raspberry Pi, etc. utilizing the I2C standard. There are no external components needed with the only connections being SDA, SCL, VCC and GND. This makes it perfect for embedded systems that require more input/output GPIO pins.

32-bit I/O I2C Expander breakout board features includes:

- Simple I2C interface.
- Unique DIP design make it perfect for prototypes in a breadboard.
- Add 32 additional inputs or outputs to your design over an I2C interface.
- Stand alone module. No external components required.
- I2C address jumpers allow the use of 4 boards for a total of 128 extra I/Os pins.
- On board pull up resistors for INT, SDA and SCL.
- Operating power supply voltage range of 2.3V to 5.5V.
- PWR indication LED.
- All SMD components.
- Small footprint with 2x1 inches in size.
- Interrupt pins for every chip informs of any input change.
- 400kHz clock frequency.

All boards ship by default with addresses 0x20 for U1 and 0x21 for U2 unless buyer ask for specific settings. The board is fully assembled and is 100 percent made in the USA. It comes ready use.

Command Registers:

0 Input port 0
1 Input port 1
2 Output port 0
3 Output port 1
4 Polarity Inversion port 0 -- 1 will invert bit on read.
5 Polarity Inversion port 1 -- works only on read.
6 Configuration port 0 -- 0 is output, 1 is input
7 Configuration port 1 -- 0 is output, 1 is input

A LED is connected through a 470 ohm resistor to VCC and the INT pin on the module. This displays interrupt on change which is cleared during a read of the port. That is not used in this demo.

Demo 1

The following counts from 0 to 255 binary on LEDs connected to pins 1 - 8.

The address for the 1st PCA9555 is 0x20. There are eight resistor/LED indicators on pins 1 - 8. This demo produces a binary count of 0 to 255 on Port1 on the PCA9555 module. The module has two PCA9555 ICs the 2nd at 0x21.

PCA9555 Demo Board
PCA9555 Demo Board



4X4 keypad used in this demo.


PCA9555 interfaced with HD44780 LCD display.
PCA9555 interfaced with HD44780 LCD display.


PCA9555 pin connections and Adapter Board
PCA9555 pin connections and Adapter Board


Update for 2023: the above demo board with two PCA9555s is no longer available. Because the PCA9555 only comes in surface mount, a conversion or Adapter board is needed along with 24, 2.5mm pin headers. (Two rows of twelve.)

For this project one will need two PCA9555s and two Adapter boards.

The "SOIC-24 / SOP24 SMD to DIP Adapter" (search Ebay) sells for $10 for a 10 pack. The PCA9555 sells for ~$2.50 each at www.mouser.com. They have 29,000 in stock as of March 2023.


Download the Arduino code arduino6.txt.

Stepper Motors

Serial LCD Display and assorted Sensors

Web site Copyright Lewis Loflin, All rights reserved.
If using this material on another site, please provide a link back to my site.