I wonder whether increasing all the values to reduce the relative effect of contact resistance would help.
As I mentioned earlier, I have ordered an I2C GPIO expander but it slightly annoys me to have to use another active component when the resistor matrix worked really well with my Arduino. Perhaps I'll try experimenting this evening when I get a few moments.
Set 0 -> 3 as inputs (with interrupts if required) and 12 -> 15 as outputs and low.
With no button press 0 -> 3 should be high, going low on a press.
If a press is detected 12 -> 15 can be taken high in turn, removing the low on 0 -> 3 and giving the column of the press.
GPIOs 1 & 3 are Tx & Rx but can be used as normal GPIOs if you don’t need serial.
pinMode(pin, FUNCTION); // FUNCTION 0 is Tx Rx, FUNCTION 3 is GPIO for pins 1 & 3.
You should be able to use GPIO 16 as well but I can’t find the FUNCTION number for that at the moment.
Not ideal as it uses up a lot of GPIOs but it can be done. If it was me I'd keep Tx & Rx during development and just use rows 0 and 2 of the keypad for prooving.
With esp8266 (ESP-07) you could use a MCP23S17 on SPI bus. I can show you my project (hardware and Arduino software).
Price of MCP23S17: < 2€
http://www.ebay.fr/itm/Mcp23s17-E-Sp-Expande-Spi-16B-28Sdip-Diy-Ic-Developper-Nouveau-N-/262417549557?hash=item3d194e08f5:g:y2EAAOSw4GVYH6n8
My project work like charm.
Jean.