Converting 5V from Raspberry Pi to 3.3V at MCP23017
If you look at the datasheet, you have the pins wrong. 

Pin 1 should be Ground, Pin 2 should go to your sensors, pin 3 should go to the 5V from the Raspbery Pi.