NodeMCU - Use I2C module to connect 4x4 keypad?

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
Post Reply
kryptxy
Posts: 2
Joined: Tue Mar 13, 2018 11:26 am

NodeMCU - Use I2C module to connect 4x4 keypad?

Post by kryptxy » Sun Mar 25, 2018 5:10 am

Hello all,
I want to connect 4x4 keypad to nodemcu board. I used I2C module to connect LCD to nodemcu, and have an extra I2C module with me.
Would it be possible to connect keypad with LCD I2C module? (Since the I2C module is 16-pin module and keypad has 8 pins)
I wasn't able to find anything on the internet, so asking here.

If not, please suggest alternatives. I read that a gpio extender would be required to connect keypad to nodemcu. And this was the gpio extender available at a local store near me.
I am new to electronics. Apologies if this sounds dumb/in-appropriate.

User avatar
deshipu
Posts: 1388
Joined: Thu May 28, 2015 5:54 pm

Re: NodeMCU - Use I2C module to connect 4x4 keypad?

Post by deshipu » Sun Mar 25, 2018 5:15 pm

Not sure what you mean by "I2C module". Can you elaborate?

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: NodeMCU - Use I2C module to connect 4x4 keypad?

Post by pythoncoder » Mon Mar 26, 2018 6:52 am

If the keypad is just an array of pushbuttons the answer is no. I2C can only be used to connect devices which have an I2C interface.
Peter Hinch
Index to my micropython libraries.

cefn
Posts: 230
Joined: Tue Aug 09, 2016 10:58 am

Re: NodeMCU - Use I2C module to connect 4x4 keypad?

Post by cefn » Mon Mar 26, 2018 8:58 am

I think you mean you have a gpio expander like an MCP23017. It should be straightforward to multiplex a 4x4 button array using such a module using either built-in pull up resistors or wired resistors. I put together https://github.com/ShrimpingIt/micropython-mcp230xx for my own experimentation with the gpio module but you also need to know how to multiplex the buttons, so this link might be useful...
http://www.microchip.com/wwwAppNotes/Ap ... e=en529784

kryptxy
Posts: 2
Joined: Tue Mar 13, 2018 11:26 am

Re: NodeMCU - Use I2C module to connect 4x4 keypad?

Post by kryptxy » Mon Apr 02, 2018 1:01 pm

Sorry for such late response
deshipu wrote:
Sun Mar 25, 2018 5:15 pm
Not sure what you mean by "I2C module". Can you elaborate?
This is the I2C module I have for LCD: https://potentiallabs.com/cart/image/ca ... 00x800.jpg
pythoncoder wrote:
Mon Mar 26, 2018 6:52 am
If the keypad is just an array of pushbuttons the answer is no. I2C can only be used to connect devices which have an I2C interface.
It's a 4x4 keypad. I was able to find some tutorials for interfacing 4x4 keypad with 8-bit gpio module.
cefn wrote:
Mon Mar 26, 2018 8:58 am
I think you mean you have a gpio expander like an MCP23017. It should be straightforward to multiplex a 4x4 button array using such a module using either built-in pull up resistors or wired resistors. I put together https://github.com/ShrimpingIt/micropython-mcp230xx for my own experimentation with the gpio module but you also need to know how to multiplex the buttons, so this link might be useful...
http://www.microchip.com/wwwAppNotes/Ap ... e=en529784
I have the complete module. It has PCF8574A chip.

User avatar
deshipu
Posts: 1388
Joined: Thu May 28, 2015 5:54 pm

Re: NodeMCU - Use I2C module to connect 4x4 keypad?

Post by deshipu » Mon Apr 02, 2018 5:32 pm

If you take the time to read the datasheet for that chip (available at http://www.ti.com/lit/ds/symlink/pcf8574a.pdf), you will realize that you can use it both as input and as output — which means that yes, you can read values from your keyboard with it. The datasheet further explains all the commands that you need to send to do the writing and reading, and if you couple that with any tutorial on button matrices, you should be able to write your program.

Post Reply