- It has 16 I/O pins
- Three I2C address select jumpers mean up to 8 expanders to one bus for 128 total GPIO added
- Each pin can be an input with light pull-up or an output sink
- IRQ output will automatically alert you when input pins change value
- This chip does not have a pin direction register. You cannot set the pins as input or output - instead, each pin has two possible states.
GPIO expanders work like this: you have a board with some number of GPIO but not enough for your project - maybe you need more buttons or LEDs. You could upgrade to a board with massive number of GPIO like the Grand Central, or you could pop on one of these boards. Connect it over I2C and then you can send/receive I2C commands to control the GPIO pins to write and read them. It's going to be slower than direct GPIO access, but maybe that doesn't matter if it takes a millisecond instead of a microsecond. You only need the two I2C pins, and you can even share the I2C port with other sensors and devices. Heck, you can even add more expanders for massive I/O control!
The pin direction / state thing is a little odd but it actually works fine for many purposes as long as you know what to expect.
For example, if you want to read button or switch, connect one side to the PCF and the other side to ground. Then set the pin to 'light pull-up input' When the button is pressed it will read low, when released it will read high.
If you want to control an LED, connect the anode to positive voltage through a resistor. When the PCF pin is set to 'light pull-up input' the LED will be off. When the PCF pin is set to 'strong ground output' the LED will connect to ground and turn on.
If you want to send a GPIO output logic level to some other device or peripheral, the light pull-up acts as high logic out, the strong ground output acts as low logic out.
If you want to receive a GPIO input logic level, set the pin to light pull-up and then read the pin to determine if the GPIO input is high or low.
Dimensions: 40.8mm x 17.7mm x 4.5mm / 1.6" x 0.7" x 0.2"
Weight: 2.6g / 0.1oz