Another vote for mcp23017 from me, its a wonderful I2C chip with 2 banks of 8 pins, supports in/out put and even has 2 interupt pins for medium speed inputs, generally though extended pins are not well suited for highspeed inputs.
Not sure what your requirements are (output?/inputs?)?
But I recommend you to stay away from the MCP23017 i2c… I have had nothing but trouble using it on the Photon.
The only firmware that where the MCP23017 is stable is 0.4.6. Anything lower will causes issues. And also the latest 0.4.7 (as of this post) has issues again. It will cause the Photon to lock up. I am hoping 0.4.8 resolves the issues…
I have a project that uses 2 MCP23017 chips over I2C (for a total of 32 extra GPIOs). They are used for both input and output and I make use of the interrupt pins for input alerts (rather than constant polling). That same project also has 32 8-bit shift registers controlled through some of the MCP23017 pins.
They have worked flawlessly for me with a Photon. In fact, the thing has been running a simulation for about 5 months now that involves sending around 40,000 bits per second down the shift register chain and have had no issues.
One thing I’d be wary of is using over I2C is make sure you don’t have any other I2C devices that require a slower I2C bus (at first I had an I2C LED that was supposed to work at 100k, but had to slow the I2C bus down to 70k for it to be reliable). I ended up throwing that thing away and writing my own LED driver with the MCP23017 pins which eliminated the I2C bus speed bottleneck (your I2C bus speed is global, not a per device basis, so you have to set it to the speed of the slowest device on the bus). So now I have I2C running at 400k.
With a bare chip MCP23017 or MCP23008 you’ll need pull-up resistors on SDA and SCL.
A0, A1, and A2 form an 3-bit offset from the base address. The base address is 0x20 (I think), and if all three A lines are tied to GND, then the address is still 0x20 (offset 0). If you set A0=HIGH, then the address is 0x21. If A1=HIGH and A0=LOW, the address is 0x22. And so on to 0x27.
The pullups are the 4.7K at D1 and D0 in the above diagram.
That reminds me on another I2C device (an OLED) I did not have to use pullups when I used 3V3. Do you think that would apply here? The MCP23017 voltage range is 1.8V to 5.5V. If so then this diagram might work nicely
Most breakout boards including OLED displays and most of the boards from SparkFun and Adafruit have the pull-ups on the board. Any bare chip like this will likely need external pull-ups, either to 3V3 or VIN, depending on what you are powering it from.
The /RESET line can be tied to VIN in your case, or 3V3 if you’re powering from 3V3. The chip resets when powered up and it’s there in case you need to hardware reset it, but I’ve never had to.
The first section of my I2C tutorial explains some of the why you need pull-ups with I2C:
The “bar” across the top of the word RESET (or /Reset) indicates and active-low signal, so to reset a device you wouldn’t use 3.3V or 5V or whatever, but pull the pin to GND (which is always the same for any supply voltage )