The is a 16-bit, general purpose parallel I/O port expander for I2C bus applications.
The 16-bit I/O port functionally consists of two 8-bit ports (PORTA and PORTB). The MCP23017 can be configured to operate in 8-bit or 16-bit modes. Lets look at the pinout
The MCP23017 is a +5V device. So we connect VDD to the 5V terminal of the arduino and of course we connect VSS to ground.
The GPB0-GPB7 and the GPA0-GPA7 pins are the 16 I/O ports.
NC is Not Connected.
SCL is the serial clock line. This connects to analog pin 5 on the arduino.
SDA is the serial data line. It connects to analog pin 4 on the arduino.
INTA and INTB are interrupt pins for the outputs. We are not using these here.
The RESET pin is if you want the outputs all reset to 0. We will connect this to +5V.
A0, A1, and A2 are the address pins. This a key thing with this device, you can in fact have 8 of these connected if you use a different address each time, this of course would give a huge amount of outputs potentially.
Here is a table of the address combinations, we will have A0, A1 and A2 tied to 0v, so that means its address 0x20