I have a MCP23017 on a custom pcb powered with 5vdc connected to a Pi3.
The I2C is directly connected.
Initially I was using only the internal pull-ups on the GPIOs but even though I am heavily debouncing (100ms guard time) in software I still was seeing lots of flipping. For each GPIO port there are two wires of approx. 5-10m length. One wire connected to the GPIO pin and the other to GND. The two wires are connected to magnetic switches and partially also to opto couplers.
Now I thought that maybe the internal pull ups were too weak so I connected 4.7k external pull-ups additionally.
However when I connect the MCP to my bench power (without even connecting to the Pi and the GPIOs just connected to 5VDC via 4.7k) I can see it pulling 2A - obviously only for some seconds as I quickly shut off the power to avoid frying the poor MCP.
So my questions would be:
a) is my wiring off with the external pull-ups or am I missing something?
b) what would be the recommended way to make sure I get proper readings on my long lead switches?