Use this forum to chat about hardware specific topics for the ESP8266 (peripherals, memory, clocks, JTAG, programming)

User avatar
By Barnabybear
#50054 Hi, what value of resistors did you use? As the ESP only has a 1V ADC it's a lot tighter than an Adruino, I'm guessing that the buttons that returned random values where at the lower end of the resistance scale and where affected by contact resistance.
User avatar
By lotus49
#50072 I used 820R/1K/820R/1K along the columns and 20K/3K3/680R/220R along the rows. You are quite right that it's the low values that cause the problem. Those are the ones near the bottom left hand corner.

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.
User avatar
By Barnabybear
#50079 Hi, I’m guessing that your using an ESP8266-12 as you have ADC broken out. If so you could try using GPIOs 0, 1, 2 & 3 as rows with 10K pullups and GPIOs 12, 13, 14 & 15 as columns with 1k in series (GPIOs 4 & 5 are free for other use) (GPIO 15 also needs a 10K pull down resistor).
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.
Code: Select allpinMode(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.
User avatar
By Jean Marchadier
#62574 Hello,
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.